简体   繁体   English

我的android应用的Google云端硬盘服务帐户

[英]Google Drive service account for my android app

I want to use google drive to upload and download file directly from my Andriod app without any user interaction.I have followed google quick start page of drive api and it works correctly but thing is i want app to authenticate it self directly without asking user to select account it there any way that. 我想使用谷歌驱动器直接从我的Andriod应用中上传和下载文件,而无需任何用户交互。我已经遵循了驱动器api的谷歌快速入门页面,它可以正常工作,但是我想让应用直接对自己进行身份验证而不要求用户选择帐户有任何方式。 I can enter username and pass directly during code. 我可以输入用户名并直接在代码中传递。 there are options like service account 有诸如服务帐户之类的选项

when i google for this but no tutorial there are other tutorials with php and ruby but they are on browser i want it to be integrated with my app. 当我用谷歌搜索这个但没有教程时,有其他教程使用php和ruby,但是它们在浏览器中,我希望它与我的应用程序集成。 So as soon as i open my app it should fetch file from google drive without any user need 因此,一旦我打开我的应用程序,它便应从Google驱动器中获取文件,而无需任何用户

any help or link to tutorial for andriod app will be helpful 任何帮助或指向Andriod应用程序的教程的链接都将有所帮助

You can follow the service account sample in this repository . 您可以在此存储库中关注服务帐户示例。

Here's a snippet which shows how to build service account credential. 这是显示如何建立服务帐户凭据的代码段。

HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
...

GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream("MyProject-1234.json"))
    .createScoped(Collections.singleton(PlusScopes.PLUS_ME));
// Set up global Plus instance.
plus = new Plus.Builder(httpTransport, jsonFactory, credential)
    .setApplicationName(APPLICATION_NAME).build();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果我的Android设备没有Google Play服务,如何添加Google云端硬盘帐户 - How to add Google Drive account if my Android device doesn't have Google Play Service 使用 Android java 应用程序中的服务帐户连接到 google Drive API v3 - Connecting to google Drive API v3 with a service account in Android java app 使用Google API从Android应用程序取消驱动器帐户的链接 - Unlink drive account from android app using google api 在我的Android应用中管理Google云端硬盘上的文件 - Managing files on Google Drive in my Android app 允许Android上的Google Drive SDK连接到应用拥有的帐户 - Allow Google Drive SDK on Android to connect to an app-owned account Google Drive作为Android中的服务 - Google drive as service in Android 使用Android中的Google帐户Sigin我的应用 - Sigin my app with Google Account in Android 如何让我的Android应用使用“服务帐户”访问共享的Google日历? - How can I make my Android app use a “Service Account” to access a shared Google Calendar? Google Drive api android 如何在没有用户交互的情况下使用硬代码从我的驱动器帐户登录和注销? - Google Drive api android how to login and logout from my drive account with hard code without user interaction? Google Drive Android API-Google Drive应用 - Google Drive Android API - Google Drive App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM