So I've been working with Pubnub and GCM. Although this question is more GCM/Android specific than Pubnub. I've 2 apps - one is my own the other is pubnub's example.
Pubnub manifest's receiver tag:
<receiver
android:name="com.pubnub.pubnubexample.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.gcm" />
</intent-filter>
</receiver>
My app's receiver tag:
<receiver
android:name="com.myapp.app.MyReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.example.gcm" />
</intent-filter>
</receiver>
Apparently the pubnub sample app's broadcast receiver does gets called but not the one in mine. Both of them have these uses-permission
:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
Infact mine has even more.
What might I be doing wrong that my own app's receiver isn't being called by GCM when a notification is sent through it ? My expectation was that since it's a broadcast multiple apps with similar receivers would receive them ?
Note: This is not really a requirement in my work but testing and trying to understand how this concept works.