Where to put Google key for Google Calendar for Android?
I follow them the tutorial found here: https://developers.google.com/google-apps/calendar/quickstart/android
Compiling and running the project, however, gives a 403 error: "Access not configured. Api (calendar api) is not enabled for your project".
I have searched around and it seems like for most people this is because they got their package name wrong, however I copied it and typed it in directly from the code. I am also wondering why we are generating an api key but never copying it into an android project. I found somewhere that the API key can be added to the android manifest like this:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.calendar.v2.API_KEY" android:value="MYAPIKEY" />
I've tried v2 as above and v3 (which I believe is the current version). I have tried generating keys using my keystore and android keystore, either defining an app or not specifying any apps.
What is the correct way to add api key to a project to get rid of this error? or is there something else I am doing wrong?
EDIT: The post suggested by several people did not solve my problem as I set it to allow connections from all android apps (just like "any referrer is allowed") and it still gives me the error.
source to share
See the last line?
<meta-data android:name="com.google.android.calendar.v2.API_KEY" android:value="MYAPIKEY" />
replace MYAPIKEY with your key.
also your question is very similar to this one: Getting error 403: Access is not configured. Use the Google Developers Console to activate the API for your project .
Luckily it has a working solution, try this.
source to share
I ran into a specific problem and I finally figured it out. Unlike the Google Maps API, the generated "API Key" will not work. You need to create an "OAuth 2.0 Client ID" where SHA1 and Application ID match your project. Since the SHA1 and application ID are used, you no longer need to declare the API key in AndroidManifest.xml.
Take my test project, for example, the API key works in Google Map on Android but not Google Calendar. I needed to create an OAuth 2.0 Client ID for it to work.
source to share
The only problem is generating the SHA-1 key. keytool -exportcert -alias advance -keystore / Users / EazyWorldPeace / Desktop / Advance / yourkey.jks -list -v
run this command on your Mac / Windows according to your path settings and keep the same package name as in your application and it will work.
Let me know if it doesn't work with you - :)
source to share