I am trying to get a msg to my app from a server. I have this server url wich sends msg to all users: https://taub-prayer-ramym.c9.io/send?message=123
my app's token is registered in the server... but I have a problem that the onMessageReceived() method from my GcmListenerService implementation isn't called.
my Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.atheel.prayer" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="com.example.atheel.prayer.permission.C2D_MESSAGE"/>
<uses-permission android:name="com.google.android.c2dm.permission.SEND"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<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.atheel.prayer" />
</intent-filter>
</receiver>
<service
android:name="com.example.atheel.prayer.MyGcmListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.example.atheel.prayer.MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<service android:exported="false" android:name="com.example.atheel.prayer.RegistrationIntentService"/>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".EmptyStatus"
android:label="@string/title_activity_empty_status" >
</activity>
<activity
android:name=".UnEmpty"
android:label="@string/title_activity_un_empty" >
</activity>
</application>
</manifest>
my myGCMListener :
public class MyGcmListenerService extends GcmListenerService {
private static final String TAG = "MyGcmListenerService";
File notificationsFile;
private String sessionForAppClosed;
// [START receive_message]
@Override
public void onMessageReceived(String from, Bundle data) {
Log.i(TAG,"Message Received!!!!!!!!!");
System.out.print("***************Message Received!!!!!!!!!");
}
}
anyone can think why its not working?