I'm running the official GCM sample on a Samsung S6 with 6.0.1
https://github.com/googlesamples/google-services/tree/master/android/gcm
I've gone through all the steps to make it work, registering in Google Cloud Console, adding the json file, etc.
I am able to send messages with GcmSender (included in the sample) and the app on the device receives them, but:
Every time the app receives a message, there are these two errors in the logcat:
FirebaseInstanceId E Failed to resolve target intent service, skipping classname enforcement
E Error while delivering the message: ServiceIntent not found.
Maybe they can be ignored (the app does get the pushed messages), but they have severity = Error, what if there is a good reason for this?
What if this causes GCM to work unreliably (some sort of "exponential backoff")?
What causes them? How can I make it so that these errors do not happen?
Since the official word is that GCM will be supported going forward for existing apps -- I'd like to avoid Firebase messaging.
GCM seems easier to set up and has fewer "magical bits" all around (all the various services / registrations / tokens / APIs and what not). I just need reliable cloud driven push messaging and that's it, nothing else.
So the question is not "should I be using GCM or Firebase", I know the "correct" answer to that.
It's "when running the official GCM sample there are these errors in the logcat, what are they and how can I fix them".
Finally, the app's manifest:
https://github.com/googlesamples/google-services/blob/master/android/gcm/app/src/main/AndroidManifest.xml
and the relevant bits of build.gradle:
```dependencies {
compile 'com.google.android.gms:play-services-gcm:9.2.1'
...
}
apply plugin: 'com.google.gms.google-services'
```
Related
This is a Xamarin.Forms app running on Android, based on the Azure getting started Mobile App example.
I'm trying to register a device's id for notification services. Originally I was getting unauthorized, so I relaxed authorization settings on the backend. Now I am getting this error and cannot find a reason why.
I checked and double checked that notification hub has the correct Firebase details that align with the app and cannot see what the problem is here, any help appreciated.
John,
If you set WEBSITE_PUSH_ENABLED=false in your appsettings, does the problem go away?
Can you check your Mobile App's app settings?
Specifically, I am looking for the existence of the app setting "MS_NotificationHubName". If that app setting doesn't exist, you need to add it, with the name of your notification hub.
There is a bug in the Azure App Service Push blade right now. A fix is being rolled out. In the interim, instead of using RegisterAsync(), use the method described in the book http://aka.ms/zumobook - chapter 5.
I have successfully used the Android TicTacToe app to cast to the TicTacToe receiver app (AppID "TicTacToe"), using unmodified code from the TicTacToe example on github.
Next, I tried to use my personal receiver app. I got the email a couple of hours letting me know that my device was whitelisted and providing the AppID. I put the AppID in line 90 on GameActivity.java (not line 91, as stated in the instructions), and I also put it in line 35 of tictactoe.html (this step was missing from the instructions, but I assume it is needed). I also followed all steps in the Common Errors section of the instructions.
When I click the Start button in the Android app, the Tic-Tac-Toe board appears in the Android app, but the Chromecast device does not noticeably react.
Here is the LogCat:
07-28 00:13:47.776: W/StartSessionTask(10892): StartApplicationRequest failed with status: -4
07-28 00:13:47.826: E/ApplicationSession(10892): StartSessionTask failed with error: failed to start application: request failed
07-28 00:13:47.826: D/GameActivity(10892): start session failed: failed to start application: request failed
Try checking the box that says "Send this Chromecast's serial number when checking for updates".
Mine didn't work at first, after doing this and restarting mine seemed to pick up the whitelisted appID.
As mentioned by the author of question: Make sure to do from ChromeOS, Windows or Mac OSX client until they fix the issue from Android app.
Clients can be downloaded here: https://cast.google.com/chromecast/setup
This was fixed for me after I restarted the chromecast by removing power.
I tried Aaron's answer several times (was finally able to get the setting to stick using the Chromecast Mac app) but it still was giving this same error.
Then, I discovered I actually uploaded the receiver file to the wrong url. So double check which url was actually whitelisted!
Though even after fixing the url it still was broken. So I think I must have entered the wrong serial number when I made the whitelist request. I resent the whitelist request and the new app ids are working properly.
I solved same problem by using HTTP instead of HTTPS for my local hosted receiver, it seems Chromecast looks for valid certificate.
I use the following plugin: marknutter/GCM-Cordova from git hub.
I installed this plugin on eclipse and ran it on an android device.
I manage to register the device for GCM messages + receive messages.
When The device receives a message from Google Cloud, it calls the onMessage event handler, line 55, in this file:
https://github.com/marknutter/GCM-Cordova/blob/master/src/com/cordova2/gcm/GCMIntentService.java
The event handler reaches line 77 to run this command: GCMPlugin.sendJavascript( json );
this commands supposed to send the data received to the webView of the app.
However the static class' GCMPlugin members, are not initialized at all so, when the call to GCMPlugin.sendJavascript( json ) all the members of GCMPlugin members are null. As a result an exception occurs and the message can't be delivered to the webView.
Anyone has an idea how to fix this ?
I would not waste any time trying to run some obscure plug-ins, when there is officially supported PhoneGap plugin for push notifications: https://github.com/phonegap-build/PushPlugin. I'm using it in a couple of my apps already and it works wonders. Updates to it are pushed every couple of months.
If anyone is interested, I'm working on this plugin to support the latest Cordova and using the latest GCM from Google which will allow you to send push notifications to Android and iOS devices: https://github.com/gonzaloaune/GCMPushPlugin
I am following Android Push Notifications using Google Cloud Messaging (GCM) to implement GCM with my application it was working fine on single device (Galaxy S) when i tried to test it with another device( Galaxy Tab 7') its generating error.
handleRegistration: registrationId = null, error = INVALID_SENDER, unregistered = null
here is the Log which i am getting
V/GCMRegistrar(5649): Registering app my_maypackage of senders APA91bHvzZbO_nyYvaA_QRGDaV-wRAYKjt0qJSQmzPUi2unqG7j0OGuyhVY1A3zh-ZfnA0XT0ffgyKypVJ_5owLZvZBNGARpTBkBg9ED8gVVCDejaIpShghq_tXGhMnFQEufwdCL1ibm
V/GCMRegistrar(5649): Setting registeredOnServer status as true until 2013-04-02 11:02:07.847
V/GCMBroadcastReceiver(5649): onReceive: com.google.android.c2dm.intent.REGISTRATION
V/GCMBroadcastReceiver(5649): GCM IntentService class: my_maypackage.GCMIntentService
V/GCMBaseIntentService(5649): Acquiring wakelock
V/GCMBaseIntentService(5649): Intent service name: GCMIntentService-980172650021-7
D/GCMBaseIntentService(5649): handleRegistration: registrationId = null, error = INVALID_SENDER, unregistered = null
D/GCMBaseIntentService(5649): Registration error: INVALID_SENDER
I/GCMIntentService(5649): Received error: INVALID_SENDER
V/GCMBaseIntentService(5649): Releasing wakelock
Note: both devices are configured with same gmail account.
Log is showing incorrect sender ID. it should be taken from Google api project url. e.g
https://code.google.com/apis/console/b/0/#project:65464654646546
then 65464654646546 is sender ID.
For me what did it was enabling the "Google Cloud Messaging for Android" from the Console's API section:
[Adding to #spanjeta's answer:]
The problem is that it’s not trivial to get the project number, due to Google ever going modifications of the developer console. While Google was kind enough to give developers the possibility to declare a friendly/textual id for their projects, they didn't update the GCM documentation in that this cannot replace project ID in a GCM client.
When you do that (give the project a textual name/ID ) - you cannot use it, because you will get an INVALID_SENDER error.
You must get the pure numerical project ID somehow.
So how do you get the project number? You need to get somehow to the old developer console.
The following way works (for now):
Yo go to The developer console → Your Project → APIS → Google Cloud Messaging for Android → Quota
Then a new, old google devloper console tab will be opened with the following URL:
https://code.google.com/apis/console/b/0/?noredirect#project:YOUR_PROJECT_NUMBER:quotas
Then, use YOUR_PROJECT_NUMBER as the GCM SENDER_ID in your app.
I just wanted to share with you that I ran into this same problem just now.
GCM push worked perfectly fine before, nothing's got changed, and all of the sudden our users flushed back with complaints about not getting push notifications.
So I did check out all the StackOverflow thread re. this issue and still couldn't figure things out (had the app id / keys all correctly input, code's perfectly fine, even tried out on the Google demo and blah blah blah)
So in an act of desperate I went to the dev console and disabled GCM, then re-enabled it... everything just worked!
There is a project ID and the Project Number shown on the top of the Project Dashboard.
Project ID: aaaa-bbb-000000 Project Number: 00000111112
You have to use the numeric Project Number as SENDER_ID.
maybe you need change the GOOGLE_PROJ_ID
First
Second
Good Luck!!
Is there anyone using Flurry to generate reports for uncaught exceptions that could post some sample code on how to do this?
I don't see any example via Flurry themselves, and though I've seen code samples of custom exception reporters, I haven't seen a simple example of how to implement the basic error reporting just using Flurry.
Thanks.
This is all good feedback. We're looking into adding full stack traces for error reporting which we'll hopefully see in our next major SDK release. We'll also look at filtering by device model.
In the meantime we've added a new REST API for exporting your error reports if you want to do your own analysis. If you need help using it you can just contact our support or message me.
Sean / CTO / Flurry, Inc.
Flurry does it automatically (if you have it running). However, the error reporting is lame. They only catch the message w/o giving you the stack trace, so you may end up seeing (for example) that people are getting lots of NullPointerExceptions, but you won't have any idea where, or how, they're happening. If you try to do it yourself with the FlurryAgent.onEvent() method you'll quickly discover that they limit you to 255 characters.
If you need detailed error reporting it really is better to roll your own right now.
I wasn't going to post this initially, but since it sounds like Flurry's error reporting sucks, you should check android-remote-stacktrace. It sends the stack trace to a url, which you can use to redirect it to an e-mail or just gather it on the server.
I'm not using it for uncaught exceptions , but you can catch it and then send it to flurry.
I am using bugsense for error reports. It catches full stack trace when an uncaught exception happens and also gives some useful information about the device - OS version, you app's version, is WiFi available on the device, etc. You can add custom messages and tags for specific events.
I've already fixed a couple crashes in my app thanks to it.
Since people are posting alternatives for getting stack traces, I'll recommend ACRA. ACRA can send the stack trace to a spreadsheet on google drive/docs. Or you can also have it send to your server if you wish too. By default it also includes phone model, android version, memory of device, and other data too.