I see a very strange behviour for gcm messages now - after I register device for push notifications, I receive an empty message. Just once, but for each device running android 5+. Is this a normal behaviour? My server developer swears that he doesn't sending anything to me on device registration...
Code: registration:
String regid = Preferences.getC2DMKey(ApplicationXXX.getInstance());
GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(ApplicationXXX.getInstance());
try {
regid = gcm.register(Customization.getGcmCode());
Preferences.setC2DMKey(ApplicationXXX.getInstance(), regid);
Log.d(TAG, "GCM key received! key:"+regid);
} catch (IOException ex) {
Log.w(TAG, "Unable to update GCM key", ex);
}
//say regid to server
if (!TextUtils.isEmpty(regid)) {
requests().reportPushNotification(regid);
}
ApplicationXXX is Application-derived class.
Manifest:
<permission android:name="com.xxx.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.xxx.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application...>
<receiver
android:name="com.pinbonus.gcm.ReceiverGCM"
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="com.xxx" />
<category android:name="com.xxx.gcm" />
</intent-filter>
</receiver>
</application>