Ok, I figured it out myself. Just in case, if someone else faces this problem in the future; I will try to explain what the problem is.
So, I had a library project with GCM integration: com.test.gcm-library . I wanted to use this library in another application project: com.example.gcmtest . Following the accepted answer here , I was able to successfully use the library in my com.example.gcmtest project. It worked fine with API level 17, but when I tried it with api level 10, none of the GCMIntenetService methods would be called and no answer would be generated, as I posted in my question, but I managed to fix it. The trick was to change the category of intent for the recipient in the manifest file. To be precise, I changed the recipient declaration in the manifest file com.example.gcmtest from this:
<receiver android:name="com.test.gcm-library.MyCustomBroadcastReceiver" 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.test.gcm-library" /> </intent-filter> </receiver>
:
<receiver android:name="com.test.gcm-library.MyCustomBroadcastReceiver" 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.gcmtest" /> </intent-filter> </receiver>
I don’t know why, but the recipient category field looked like a “not caring” condition for API 17, but for lower APIs this is what I had to do to get it working.
source share