Android - GCM is not present in google-services.json - android

I'm planning to add the notification functionality to my android app, I added GCM through Google Developer Console and I got the API key and I used this key at the server side to send notifications to devices, however my GCM receiver is not working I don't know why, moreover, GCM is not present in my google-services.json.Apart from this, I also sent my device token to the server and it's sent successfully.
I cannot find a clue why I'm not receiving my notifications.
Here's my manifest code:
<permission
android:name="com.example.android.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission
android:name="com.example.android.permission.C2D_MESSAGE" />
<!--Services-->
<!--Service for retrieving device token and sending it to the server side-->
<service
android:name=".utils.RegistrationIntentService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<!--Service for checking updated device token-->
<service
android:name=".utils.GCMInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<!--Service to catch notifications sent from the server-->
<service
android:name=".utils.GcmMessageHandler"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<!--Receivers-->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.android.utils" />
</intent-filter>
</receiver>

Related

APP_ID_MISMATCH in web engage while sending push notification

Proceedings:
I am using push notifications to send message
Device is getting registered in Web-Engage
When I send a push notification to a device, Status on the console is
seen as 'ENDED'
Finally push notification is not received on device
Error on Console:
APP_ID_MISMATCH
Manifest web-engage code:
<receiver
android:name="com.webengage.sdk.android.WebEngagePushReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="${applicationId}"/>
</intent-filter>
</receiver>
<service android:name="com.bakmi.app.service.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<meta-data
android:name="com.webengage.sdk.android.project_number"
android:value="$102353245239034"/>
<meta-data
android:name="com.webengage.sdk.android.key"
android:value="#string/ACCOUNT_ID"/>
<meta-data
android:name="com.webengage.sdk.android.auto_gcm_registration"
android:value="true"/>
<meta-data
android:name="com.webengage.sdk.android.location_tracking"
android:value="false"/>
<meta-data
android:name="com.webengage.sdk.android.debug"
android:value="true"/>
<service android:name="com.webengage.sdk.android.ExecutorService"/>
<service android:name="com.webengage.sdk.android.EventLogService"/>
<receiver
android:name="com.webengage.sdk.android.WebEngageReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action android:name="com.webengage.sdk.android.intent.ACTION"/>
<category android:name="com.bakmi.loyalty"/>
</intent-filter>
</receiver>
<receiver
android:name="com.webengage.sdk.android.InstallTracker"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
</receiver>
APP_ID_MISMATCH is fired in one of the two cases:
1. If the package name of the receiving app is not the one to which the push was sent from our server, i.e. your app's package-name is different from the package-name entered in WebEngage dashboard.
2. If the GCM/FCM token to which the push was sent is not tied to the server key i.e. sever key entered in WebEngage dashboard is not from the GCM/FCM project which is integrated in the App.
Apart from this, your FCM push integration seems to be mixed up with GCM push integration.
It is recommended to use FCM for push notifications and remove the following GCM related tags from your AndroidManifest.xml file.
<!-- remove these tags
<receiver
android:name="com.webengage.sdk.android.WebEngagePushReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="${applicationId}"/>
</intent-filter>
</receiver>
<meta-data
android:name="com.webengage.sdk.android.project_number"
android:value="$102353245239034"/>
<meta-data
android:name="com.webengage.sdk.android.auto_gcm_registration"
android:value="true"/>
-->

EnhancedIntentService warning On Incoming Notifications

I have been getting two errors in my log once a notification is received
EnhancedIntentService: Service took too long to process intent: com.google.android.c2dm.intent.RECEIVE App may get closed
EnhancedIntentService: binding to the service failed
There is NOTHING on Google of either of these messages or even EnhancedIntentService.
Relevant code:
<service
android:name="---.GcmMCIntentService"
android:exported="false" >
<intent-filter android:priority="10">
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="---.GCMInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service android:name="---.GCMRegIntentService"
android:exported="false" >
<intent-filter android:priority="5">
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
This is on a 8.0 emulator. Play Services 11.4.2
Let me know if I can show any other code. I just find it curious there is nothing on these error messages at all on S.O. or Google.

Parse Push not displaying on Android

We are using Parse Push Plugin https://github.com/taivo/parse-push-plugin with custom parse server. Push messages are coming to the device into GCMService but not rendering. The ParsePushBroadcastReceiver not sure if its being invoked. I don't see any errors in logs.
Also on debugging i see that GCM Receive Intent's are getting called, and not
com.parse.push.intent.RECEIVE , not sure if its default behaviour.
I have the following in AndroidManifest.xml , Also i am using parse android version com.parse:parse-android:1.13.1
<receiver android:exported="false" android:name="github.taivo.parsepushplugin.ParsePushPluginReceiver">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
Any help would be of greatly appreciated

GCM error on receive: Failed to resolve target intent service, skipping classname enforcement

I followed the instructions here to set up a client GCM app: https://developers.google.com/cloud-messaging/android/client
I opted to use the standard GCM rather than the new Firebase Cloud Messaging, for now.
My app server is a node.js instance using node-gcm to send push notifications.
My app receives the notifications successfully, however prints out the following errors:
E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.
Here are the relevant bits of my AndroidManifest.xml:
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.example.myapp" />
</intent-filter>
</receiver>
<service
android:name="com.example.myapp.gcm.GcmListener"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.example.myapp.gcm.InstanceIDListener"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service android:name="com.example.myapp.gcm.RegistrationIntentService"
android:exported="false" />
My project has all of the above classes (minus GcmReceiver which is provided by Google).
GcmReceiver extends GcmListenerService
InstanceIDListener extends InstanceIDListenerService
RegistrationIntentService extends IntentService
Am I missing anything that might be causing this error? Does the error actually affect anything?

Receive Android Push notification in Library

I am trying to implement a library for Android devices which will take care of push notification in your application.
I have a server which take care of storing AppToken and DeviceToken (I can can generate tokens and send it to my server). The problem is when I try to test it (sending a request to GCM https://gcm-http.googleapis.com/gcm/send the app with my library doesn't seem to receive it)
Request :
Content-Type: application/json
Authorization: key=AIza...N04 (correct value generated for library)
{
"data": {
"message": "test",
"title": "testTitle"
},
"to" : "ewud...UySu" (token send by device)
}
I was following GCM tutorial https://developers.google.com/cloud-messaging/android/client so I generate google-services.json (for library package) and set up everything like they say (keep in mind library) but I am struggling with the manifest (which I think is the problem).
This is the manifest:
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="cz.united121.notifit.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="cz.united121.notifit.permission.C2D_MESSAGE" />
...
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="cz.united121.notifit" />
</intent-filter>
</receiver>
<service
android:name="cz.united121.notifit.GCM.GcmListenerService"
android:exported="true" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="cz.united121.notifit" />
</intent-filter>
</service>
<service
android:name="cz.united121.notifit.GCM.InstanceIDListenerService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
<category android:name="cz.united121.notifit" />
</intent-filter>
</service>
<service
android:name="cz.united121.notifit.GCM.RegistrationIntentService"
android:exported="true">
</service>
I have this code in app manifest, but it was even in lib manifest with no effect.
I rather upload whole project on github for better understanding https://github.com/petrLorenc/PushNotificationProject
Thank you in advance

Categories

Resources