Using Google api for Photos java client in android
Asked Answered
I

0

6

Almost all the google services are available in 'google play services' for android and some are still only available as java library and there are instructions to use those java libraries in android,

https://developers.google.com/api-client-library/java/google-api-java-client/oauth2#android

The above link talks about creating 'GoogleAccountCredential' using Oauth2 and to use it for 'Tasks' service.

Now I wanna follow the same flow to use the newly released, 'Google Photos API',

https://developers.google.com/photos/library/guides/get-started-java#get-library

The code snippet here,

PhotosLibrarySettings settings =
     PhotosLibrarySettings.newBuilder()
    .setCredentialsProvider(
        FixedCredentialsProvider.create(/* Add credentials here. */)) 
    .build();

But couldn't find any way to get the Oauth2 credentials in android in here, they both seems to be incompatible.

So in short, what should go in the 'credentialsprovider' in the above code snippet if i have to use the library in android?

Imprison answered 14/9, 2018 at 9:49 Comment(1)
Take a look at this answer from Jan-Felix Schmakeit who's working on the Google Photos API: stackoverflow.com/questions/52762861/… As far as I know there is no one-liner to get the credentials, I quoted another SO post on Jan-Felix answer if you need more information on how to build the UserCredentialsWeightless

© 2022 - 2024 — McMap. All rights reserved.