Java 谷歌图书馆照片Api
所以我的问题是如何传递此参数的凭据?(我想在本机android上使用它,而不是在web应用程序或后端服务器上使用它)我真的很挣扎,让google登录工作了,不过如果我能用它来获取凭据那就太好了:)Java 谷歌图书馆照片Api,java,android,google-photos,google-photos-api,Java,Android,Google Photos,Google Photos Api,所以我的问题是如何传递此参数的凭据?(我想在本机android上使用它,而不是在web应用程序或后端服务器上使用它)我真的很挣扎,让google登录工作了,不过如果我能用它来获取凭据那就太好了:) 感谢您的帮助 创建UserCredetials对象 // Set up the Photos Library Client that interacts with the API PhotosLibrarySettings settings = PhotosLibrarySetting
感谢您的帮助 创建UserCredetials对象
// Set up the Photos Library Client that interacts with the API
PhotosLibrarySettings settings =
PhotosLibrarySettings.newBuilder()
.setCredentialsProvider(
FixedCredentialsProvider.create(/* Add credentials here.
*/))
.build();
try (PhotosLibraryClient photosLibraryClient =
PhotosLibraryClient.initialize(settings)) {
// Create a new Album with at title
Album createdAlbum = photosLibraryClient.createAlbum("My
Album");
// Get some properties from the album, such as its ID and
product URL
String id = album.getId();
String url = album.getProductUrl();
} catch (ApiException e) {
// Error during album creation
}
并将其传递给FixedCredentialsProvider.create())
看看这个项目,以获得完整的代码
UserCredentials.newBuilder()
.setClientId("your client id")
.setClientSecret("your client secret")
.setAccessToken("Access Token")
.build()