Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 任务API 403禁止访问_Android_Google Api_Google Api Java Client_Google Tasks Api - Fatal编程技术网

Android 任务API 403禁止访问

Android 任务API 403禁止访问,android,google-api,google-api-java-client,google-tasks-api,Android,Google Api,Google Api Java Client,Google Tasks Api,我在尝试执行get-on任务列表时遇到此错误 03-30 15:20:53.422: W/System.err(25384): "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project." 在开发人员控制台中,任务API以0%的使用率启用。在凭证中,我有一个用于Android应用程序的OAuth2客户端ID,该ID由debu

我在尝试执行get-on任务列表时遇到此错误

03-30 15:20:53.422: W/System.err(25384):       "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
在开发人员控制台中,任务API以0%的使用率启用。在凭证中,我有一个用于Android应用程序的OAuth2客户端ID,该ID由debug.keystore中的SHA1定义,并定义了包名


我错过什么了吗?我也在我的应用程序中获得了一个权限弹出窗口,我接受了它,但它没有显示在中,不管是什么原因。

所以问题是debug.keystore的SHA1在开发控制台中是小写的。删除那个客户机ID并创建一个新的以大写SHA1的客户机ID解决了这个问题

GoogleAccountCredential  credential = GoogleAccountCredential.usingOAuth2(context, TasksScopes.all());

SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
String accountName = settings.getString(GoogleIntegrationUtilities.GTASK_ACCOUNT_NAME, "None");
// assume accountname is always defined properly
credential.setSelectedAccountName(accountName);

httpTransport = AndroidHttp.newCompatibleTransport();
jsonFactory = GsonFactory.getDefaultInstance();
tasksServiceBuilder = new Tasks.Builder(httpTransport, jsonFactory, credential).setApplicationName("App name");
tasksService = tasksServiceBuilder.build();