Receiving GCM in android app, what do i need?










0















I have a new version of my Android app and it is not receiving GCM messages from the server, but the prior version of the app works fine. Here is the situation:



I used to have an app with a package name com.mycompany.myappnamehere. (Obviously I am changing the names here to protect the innocent). In that version of the app, GCM worked fine - my server would send messages and my app running on any Android device would receive it.



However, my macbook died before I could submit my newest version to Google Play, and since my signing keys (For Android Studio) went away along with my macbook, I had to get a new macbook and use new signing keys. This of course meant that the new version of the app on Google Play was actually a completely new app. I had to change the package name for the new app to com.mycompany.mynewapp.



I looked in the Google API console and my I see a Google Console project that I created for my first app called (say) MyApp. Inside the MyApp project I see several keys listed, one of which is the server API key for GCM. Right now this key is not restricted (the None radio button is selected) so it has no application restrictions. (Yes I know I should tie this down, but for now it is fine until I get this issue worked out). If I understand correctly, this means that my server and any other server can send out GCM messages using this key.



In the MyApp Credentials page,at the bottom I also see a single OAuth 2.0 Client ID that I must have created called "Android client 1". If I click on that, I see that I have entered the Package name and gotten the app fingerprint from the keytool command (I got this a couple years ago for my old app). Of course it specifies the old app package name, which is different from the new app package name.



So I'd like to understand what is going on here. Does the fact that I have a single Oauth 2.0 client ID that points to my old app package name mean that only my old app can receive GCMs? If I go thru this process again and add a new Oauth 2.0 key with my new app package name and new app signing fingerprint, will that make GCMs magically work for my new app? Do I need to somehow tie this new OAuth client ID to my new app, either in my new app code or in the Google console?



Note: my new app made absolutely no changes whatsoever to the GCM code in Android, or to the server code that sends GCMs. We know the server code is fine because the old apps receive the push messages while the new app does not. So it must be some issue with keys.



Can someone please help and explain what is going on here, and what I must do to fix it?










share|improve this question

















  • 2





    If this is a completely new app then I highly recommend that you NOT use the depreciated GCM and upgrade to FCM. Google has plans to remove the GCM server as soon as April 2019! Any effort to build an app based on GCM is pretty much a waste of your time.

    – Barns
    Nov 15 '18 at 19:51











  • Yes I know this. The new app is already on Google Play, but GCMs don't work. I need to get this fixed quickly just to get GCMs working for now, and then over the next few weeks (or at least before April 2019) I need to update the code in the app to use FCM instead. These are 2 separate things. My immediate bug fix effort is not a waste of time.

    – Marc
    Nov 15 '18 at 19:55











  • "The new app is already on Google Play...." So I assume you tested the new app before you published it and it worked properly in debug modus?

    – Barns
    Nov 15 '18 at 19:58












  • We thought we did.

    – Marc
    Nov 15 '18 at 20:10















0















I have a new version of my Android app and it is not receiving GCM messages from the server, but the prior version of the app works fine. Here is the situation:



I used to have an app with a package name com.mycompany.myappnamehere. (Obviously I am changing the names here to protect the innocent). In that version of the app, GCM worked fine - my server would send messages and my app running on any Android device would receive it.



However, my macbook died before I could submit my newest version to Google Play, and since my signing keys (For Android Studio) went away along with my macbook, I had to get a new macbook and use new signing keys. This of course meant that the new version of the app on Google Play was actually a completely new app. I had to change the package name for the new app to com.mycompany.mynewapp.



I looked in the Google API console and my I see a Google Console project that I created for my first app called (say) MyApp. Inside the MyApp project I see several keys listed, one of which is the server API key for GCM. Right now this key is not restricted (the None radio button is selected) so it has no application restrictions. (Yes I know I should tie this down, but for now it is fine until I get this issue worked out). If I understand correctly, this means that my server and any other server can send out GCM messages using this key.



In the MyApp Credentials page,at the bottom I also see a single OAuth 2.0 Client ID that I must have created called "Android client 1". If I click on that, I see that I have entered the Package name and gotten the app fingerprint from the keytool command (I got this a couple years ago for my old app). Of course it specifies the old app package name, which is different from the new app package name.



So I'd like to understand what is going on here. Does the fact that I have a single Oauth 2.0 client ID that points to my old app package name mean that only my old app can receive GCMs? If I go thru this process again and add a new Oauth 2.0 key with my new app package name and new app signing fingerprint, will that make GCMs magically work for my new app? Do I need to somehow tie this new OAuth client ID to my new app, either in my new app code or in the Google console?



Note: my new app made absolutely no changes whatsoever to the GCM code in Android, or to the server code that sends GCMs. We know the server code is fine because the old apps receive the push messages while the new app does not. So it must be some issue with keys.



Can someone please help and explain what is going on here, and what I must do to fix it?










share|improve this question

















  • 2





    If this is a completely new app then I highly recommend that you NOT use the depreciated GCM and upgrade to FCM. Google has plans to remove the GCM server as soon as April 2019! Any effort to build an app based on GCM is pretty much a waste of your time.

    – Barns
    Nov 15 '18 at 19:51











  • Yes I know this. The new app is already on Google Play, but GCMs don't work. I need to get this fixed quickly just to get GCMs working for now, and then over the next few weeks (or at least before April 2019) I need to update the code in the app to use FCM instead. These are 2 separate things. My immediate bug fix effort is not a waste of time.

    – Marc
    Nov 15 '18 at 19:55











  • "The new app is already on Google Play...." So I assume you tested the new app before you published it and it worked properly in debug modus?

    – Barns
    Nov 15 '18 at 19:58












  • We thought we did.

    – Marc
    Nov 15 '18 at 20:10













0












0








0








I have a new version of my Android app and it is not receiving GCM messages from the server, but the prior version of the app works fine. Here is the situation:



I used to have an app with a package name com.mycompany.myappnamehere. (Obviously I am changing the names here to protect the innocent). In that version of the app, GCM worked fine - my server would send messages and my app running on any Android device would receive it.



However, my macbook died before I could submit my newest version to Google Play, and since my signing keys (For Android Studio) went away along with my macbook, I had to get a new macbook and use new signing keys. This of course meant that the new version of the app on Google Play was actually a completely new app. I had to change the package name for the new app to com.mycompany.mynewapp.



I looked in the Google API console and my I see a Google Console project that I created for my first app called (say) MyApp. Inside the MyApp project I see several keys listed, one of which is the server API key for GCM. Right now this key is not restricted (the None radio button is selected) so it has no application restrictions. (Yes I know I should tie this down, but for now it is fine until I get this issue worked out). If I understand correctly, this means that my server and any other server can send out GCM messages using this key.



In the MyApp Credentials page,at the bottom I also see a single OAuth 2.0 Client ID that I must have created called "Android client 1". If I click on that, I see that I have entered the Package name and gotten the app fingerprint from the keytool command (I got this a couple years ago for my old app). Of course it specifies the old app package name, which is different from the new app package name.



So I'd like to understand what is going on here. Does the fact that I have a single Oauth 2.0 client ID that points to my old app package name mean that only my old app can receive GCMs? If I go thru this process again and add a new Oauth 2.0 key with my new app package name and new app signing fingerprint, will that make GCMs magically work for my new app? Do I need to somehow tie this new OAuth client ID to my new app, either in my new app code or in the Google console?



Note: my new app made absolutely no changes whatsoever to the GCM code in Android, or to the server code that sends GCMs. We know the server code is fine because the old apps receive the push messages while the new app does not. So it must be some issue with keys.



Can someone please help and explain what is going on here, and what I must do to fix it?










share|improve this question














I have a new version of my Android app and it is not receiving GCM messages from the server, but the prior version of the app works fine. Here is the situation:



I used to have an app with a package name com.mycompany.myappnamehere. (Obviously I am changing the names here to protect the innocent). In that version of the app, GCM worked fine - my server would send messages and my app running on any Android device would receive it.



However, my macbook died before I could submit my newest version to Google Play, and since my signing keys (For Android Studio) went away along with my macbook, I had to get a new macbook and use new signing keys. This of course meant that the new version of the app on Google Play was actually a completely new app. I had to change the package name for the new app to com.mycompany.mynewapp.



I looked in the Google API console and my I see a Google Console project that I created for my first app called (say) MyApp. Inside the MyApp project I see several keys listed, one of which is the server API key for GCM. Right now this key is not restricted (the None radio button is selected) so it has no application restrictions. (Yes I know I should tie this down, but for now it is fine until I get this issue worked out). If I understand correctly, this means that my server and any other server can send out GCM messages using this key.



In the MyApp Credentials page,at the bottom I also see a single OAuth 2.0 Client ID that I must have created called "Android client 1". If I click on that, I see that I have entered the Package name and gotten the app fingerprint from the keytool command (I got this a couple years ago for my old app). Of course it specifies the old app package name, which is different from the new app package name.



So I'd like to understand what is going on here. Does the fact that I have a single Oauth 2.0 client ID that points to my old app package name mean that only my old app can receive GCMs? If I go thru this process again and add a new Oauth 2.0 key with my new app package name and new app signing fingerprint, will that make GCMs magically work for my new app? Do I need to somehow tie this new OAuth client ID to my new app, either in my new app code or in the Google console?



Note: my new app made absolutely no changes whatsoever to the GCM code in Android, or to the server code that sends GCMs. We know the server code is fine because the old apps receive the push messages while the new app does not. So it must be some issue with keys.



Can someone please help and explain what is going on here, and what I must do to fix it?







android oauth-2.0 google-cloud-platform google-cloud-messaging






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 19:44









MarcMarc

1,11242339




1,11242339







  • 2





    If this is a completely new app then I highly recommend that you NOT use the depreciated GCM and upgrade to FCM. Google has plans to remove the GCM server as soon as April 2019! Any effort to build an app based on GCM is pretty much a waste of your time.

    – Barns
    Nov 15 '18 at 19:51











  • Yes I know this. The new app is already on Google Play, but GCMs don't work. I need to get this fixed quickly just to get GCMs working for now, and then over the next few weeks (or at least before April 2019) I need to update the code in the app to use FCM instead. These are 2 separate things. My immediate bug fix effort is not a waste of time.

    – Marc
    Nov 15 '18 at 19:55











  • "The new app is already on Google Play...." So I assume you tested the new app before you published it and it worked properly in debug modus?

    – Barns
    Nov 15 '18 at 19:58












  • We thought we did.

    – Marc
    Nov 15 '18 at 20:10












  • 2





    If this is a completely new app then I highly recommend that you NOT use the depreciated GCM and upgrade to FCM. Google has plans to remove the GCM server as soon as April 2019! Any effort to build an app based on GCM is pretty much a waste of your time.

    – Barns
    Nov 15 '18 at 19:51











  • Yes I know this. The new app is already on Google Play, but GCMs don't work. I need to get this fixed quickly just to get GCMs working for now, and then over the next few weeks (or at least before April 2019) I need to update the code in the app to use FCM instead. These are 2 separate things. My immediate bug fix effort is not a waste of time.

    – Marc
    Nov 15 '18 at 19:55











  • "The new app is already on Google Play...." So I assume you tested the new app before you published it and it worked properly in debug modus?

    – Barns
    Nov 15 '18 at 19:58












  • We thought we did.

    – Marc
    Nov 15 '18 at 20:10







2




2





If this is a completely new app then I highly recommend that you NOT use the depreciated GCM and upgrade to FCM. Google has plans to remove the GCM server as soon as April 2019! Any effort to build an app based on GCM is pretty much a waste of your time.

– Barns
Nov 15 '18 at 19:51





If this is a completely new app then I highly recommend that you NOT use the depreciated GCM and upgrade to FCM. Google has plans to remove the GCM server as soon as April 2019! Any effort to build an app based on GCM is pretty much a waste of your time.

– Barns
Nov 15 '18 at 19:51













Yes I know this. The new app is already on Google Play, but GCMs don't work. I need to get this fixed quickly just to get GCMs working for now, and then over the next few weeks (or at least before April 2019) I need to update the code in the app to use FCM instead. These are 2 separate things. My immediate bug fix effort is not a waste of time.

– Marc
Nov 15 '18 at 19:55





Yes I know this. The new app is already on Google Play, but GCMs don't work. I need to get this fixed quickly just to get GCMs working for now, and then over the next few weeks (or at least before April 2019) I need to update the code in the app to use FCM instead. These are 2 separate things. My immediate bug fix effort is not a waste of time.

– Marc
Nov 15 '18 at 19:55













"The new app is already on Google Play...." So I assume you tested the new app before you published it and it worked properly in debug modus?

– Barns
Nov 15 '18 at 19:58






"The new app is already on Google Play...." So I assume you tested the new app before you published it and it worked properly in debug modus?

– Barns
Nov 15 '18 at 19:58














We thought we did.

– Marc
Nov 15 '18 at 20:10





We thought we did.

– Marc
Nov 15 '18 at 20:10












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326857%2freceiving-gcm-in-android-app-what-do-i-need%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326857%2freceiving-gcm-in-android-app-what-do-i-need%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線