我想将google photos api集成到android中,我已经完成了google登录过程,但是我无法获取访问令牌,因为在传递参数时我在FixedCredentialsProvider.create方法中遇到了错误。
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
}
答案 0 :(得分:-1)
我能够找到解决问题的方法
recordMapList
您可以将此UserCredentials对象传递给`FixedCredentialsProvider.create())
使用
获取访问令牌UserCredentials.newBuilder()
.setClientId("your client id")
.setClientSecret("your client secret")
.setAccessToken("Access Token")
.build()
https://github.com/erickogi/AndroidGooglePhotosApi
希望有帮助