Appcelerator/ Titanium: Getting Android credentials to push notifications

后端 未结 2 1315
日久生厌
日久生厌 2021-01-26 09:22

I want to be able to send push notifications using Titanium on Android. However I get a back-end error whenever I try this, which I believe is to do with invalid credentials. I

相关标签:
2条回答
  • 2021-01-26 09:59

    When I did this I created an API Key, not an OAuth client ID. Same screens you had, but choose API Key from the Create credentials dropdown.

    Here's a snip from my notes:

    Create a Google API Project

    The first step is creating a Google API project and enabling its GCM service. You also need to obtain a GCM sender ID and create a Google API server key.

    create/edit a project from here : https://console.developers.google.com/project

    After it is created, click the hamburger menu in the upper left, and Mouse over API Manager and choose Credentials

    On the Credentials tab Click Create Credentials and choose API Key

    copy it and paste it into the Arrow dashboard

    Click hamburger menu - IAM & Admin -> Settings copy the project number - paste that into Arrow dashboard

    0 讨论(0)
  • 2021-01-26 10:07

    I finally managed to get this to work. Basically the docs are heavily out of date.

    The way I managed to get it to work is by linking the app to Firebase. From there I went to "Cog/ Settings" > "Cloud Messaging".

    This shows your "Sender ID" (which is the same as your project number). For me this was a 12 digit number.

    The page also shows a Server key and a Legacy server key. It does not seem to matter which one you use.

    If you still receive the following error when pushing a notification:

    Exception Type: GCM; Error Code: 3006; Error Message: The sender_id contained in the registration_id does not match the sender_id used to register with the GCM servers

    simply uninstall the app and rebuild it.

    SIDENOTE:

    Linking your app to Firebase creates quite a few API keys automatically in your Google Console API credentials page named like "____ key (auto created by Google Service)".

    The "Legacy server key" seems to match the one called: Server key (auto created by Google Service).

    Note that just creating an API key yourself does not seem to work. It has to be the API key associated with Firebase.

    0 讨论(0)
提交回复
热议问题