Discussion Forums  >  Self Hosted Control Panels

Replies: 12    Views: 17171

David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
03/10/15 03:31 PM (9 years ago)

MismatchSenderId - pulling my hair out!

Hi Gang, You're tune to enlighten me. I'm working on a Self Hosted machine and Google Cloud Messaging. I'me having a heck-of-a-time getting GCM to push messages. The result I get from the GCM server EVERYSINGLE TIME is... {"error":"MismatchSenderId"} Project Id: The number in the Android Project. Confirmed OK API Key (Server Key): Confirmed OK Naturally I've done this a zillion times and have never run into this. I realize lots has changed on the GCM platform which is why I'm digging around trying to get it to work. Devices registering, no problem. Server sending message to GCM, no problem. Results from GCM (after the post to https://android.googleapis.com/gcm/send) is always "MismatchSenderId" Sigh...help appreciated.
 
Grateful
buzztouch Evangelist
Profile
Posts: 69
Reg: Dec 03, 2012
Long Beach
5,340
like
03/10/15 06:03 PM (9 years ago)
Hi David, I tried to do a quick search of latest support articles on GCM and found this: Feburary 17, 2015 Delivered messages "The number of GCM messages described as "Delivered" was being underreported. Some "Delivered" messages were described as "Stored." These issues have been corrected for new data, but it wasn’t possible to retrospectively correct older statistics. New expired state A new message state of "Expired" has been added to GCM. The "Expired" state refers to messages that couldn’t be delivered before their time to live (ttl) expired and were discarded. Previously, these messages were included in the "Stored" message count." heres the link: https://support.google.com/googleplay/android-developer/answer/2663268?hl=en (you can find it at the bottom of the page) and then this link also has some interesting things http://developer.android.com/google/gcm/notifications.html I'm not an Android aficionado, but hope that helps in some way. Grateful
 
COOKUP
Aspiring developer
Profile
Posts: 259
Reg: Aug 02, 2011
Coral Sprigs, F...
7,140
like
03/10/15 07:55 PM (9 years ago)
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
03/11/15 05:29 AM (9 years ago)
Double check registration ID and turn it on in the Google Dashboard. LA
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/11/15 09:29 PM (9 years ago)
Yup, nuts. This is the result when sending to ONE device. {"multicast_id":6047824495557336291,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]} --The device is registered with GCM. --The SENDER_ID (that the devices uses to register with Google) seems to be a bit of a mystery. Articles I've seen, you've posted. The Project Number is clearly listed in the Google developer console. The "number" in the URL is clearly different than the easily found Project Number. I've tried both. --The API Key used by the server. Tried all sorts of things here. Server Keys. Browser Keys. Whitelisted IP addresses. No IP Addresses, etc. Every single API KEY I use and every single SENDER_ID is use returns the same results. If I use an obviously bogus SENDER_ID and an obviously bogus API_KEY I alwawys get an "Unauthorized Access" result. Which is expected. So, the API_KEY I use is "allowed" but for whatever reason the message is NEVER sent from GCM to the device. The third-party-server (the one I'm working with) gets the result when it should be getting a "sent to device" result. Major major time suck here...super frustrated...something funky going on and I'l be damned if I can figure it out.
 
LA
Aspiring developer
Profile
Posts: 3278
Reg: Aug 16, 2012
Jerseyville, IL
42,880
like
03/12/15 05:10 AM (9 years ago)
Walk away for a little while David and come back to it. It usually is something simple and when you solve it, you will be like, all that time and I cannot believe it was that little thing. LA
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/12/15 06:24 AM (9 years ago)
Try creating a new key?
 
rburns50
buzztouch Evangelist
Profile
Posts: 168
Reg: May 12, 2014
Bilston - Engla...
9,130
like
03/12/15 07:40 AM (9 years ago)
I have to chip in as I was having the same issue, new project, new server key - device registers but never gets its notification. I had forgot to turn on Google Cloud Messaging for Android within the project API list for my new project (in dev console) - marvellous as mine now works (surprise surprise)! Easy miss so mentioned just in case.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/15/15 07:11 PM (9 years ago)
I finally got it working on my server. I replaced the gcm classes with the bt android studio project classes. I didnt make the changes in the registerForPush method in BT_activity_host.java. In the registerForPush method I changed this line: GCMRegistrar.register(this, BT_gcmConfig.SENDER_ID); and hardcoded the sender id because the method in BT_gcmConfig returns a different string after converting the meta data to a string.So I never used this method Then I just extracted the string from the json payload: String message = intent.getExtras().getString("message"); and passed it into the sendNotification method. Although I get this message when confirming the push: Error sending push notifications? Havent looked into the php code yet to see why it does this, but it works .awesome Oh and google developer console I tested it by allowing all ip addresses and also tried my servers ip address. Both worked !
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
03/15/15 11:28 PM (9 years ago)
So.... --New Key created. --GCM for Android Turned "on" in Google Dev. Console. --Device registered with backend fine (Android Project is doing it's job). Device key on server. --Send to device. Fail! The same message is returned from GCM everytime. To Recap. This is NOT an Android Studio, Android OS, or Device issue. The GCM servers are not even trying to send the message to the device. My server send to GCM, it returns the message... {"multicast_id":6047824495557336291,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]} to the server. As far as I can tell this means the Device's ID (the one returned to the device when it registerd for push, and the one saved on the backend (in the control pane) does not match, or is somehow not associated with the API Key used when sending the message. Sending of course starts on my server, goes to GCM, then goes to the device. This is what's not happening. Message goes from my server to GCM and back to my server - with the error. Super frustrating as all of you can imagine - we've all been throught this nightmarish stuff before :-)
 
rburns50
buzztouch Evangelist
Profile
Posts: 168
Reg: May 12, 2014
Bilston - Engla...
9,130
like
03/16/15 01:32 AM (9 years ago)
Just a thought but is this the same device all the time or every device that registers? I have a test Android tablet (Lenovo Yoga 2) that registers but never gets the push notifications (its a wifi only device). All my other test devices are mobile phones that work without issue.
 
CMCOFFEE
Android Fan
Profile
Posts: 2017
Reg: Jan 04, 2013
Amarillo, Texas
26,670
like
03/16/15 05:10 AM (9 years ago)
Oh ok I see now. that hurts my head thinking about it
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
03/16/15 05:44 AM (9 years ago)
Are you using a browser key or server key? I assume you're properly white listed.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.