android - Custom GcmListenerService not working -


this manifest file

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="be.customapp" >     <uses-permission android:name="android.permission.internet" />     <!-- gcm: keep device awake while receiving notification -->     <uses-permission android:name="android.permission.wake_lock"/>     <!-- gcm: receive push notifications -->     <permission android:name="be.customapp.permission.c2d_message"         android:protectionlevel="signature" />     <uses-permission android:name="be.customapp.permission.c2d_message" />     <uses-permission android:name="com.google.android.c2dm.permission.receive"/>      <application         android:allowbackup="true"         android:icon="@drawable/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >          <!-- meta data -->         <meta-data             android:name="com.google.android.maps.v2.api_key"             android:value="@string/google_maps_key"/>          <!-- activities -->         <activity             android:name=".ui.activities.mainactivity"             android:label="@string/app_name"             android:launchmode="singletop"             android:screenorientation="portrait">             <intent-filter>                 <action android:name="android.intent.action.main" />                 <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>          <!-- services -->         <service             android:exported="false"             android:name=".services.gcm.mygcmlistenerservice">             <intent-filter>                 <action android:name="com.google.android.c2dm.intent.receive" />             </intent-filter>         </service>         <service             android:exported="false"             android:name=".services.gcm.gcmregisterservice"/>         <service             android:name=".services.gcm.myinstanceidlistenerservice"             android:exported="false">             <intent-filter>                 <action android:name="com.google.android.gms.iid.instanceid"/>             </intent-filter>         </service>           <!-- broadcastreceivers -->                 <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="be.prior_it.evapp" />             </intent-filter>         </receiver>     </application>  </manifest> 

and service gets/registers registration id;

instanceid instanceid = instanceid.getinstance(this); string token =      instanceid.gettoken(getstring(r.string.gcm_defaultsenderid),                     googlecloudmessaging.instance_id_scope, null); 

mygcmlistenerservice;

public class mygcmlistenerservice extends gcmlistenerservice {      @override     public void onmessagereceived(string from, bundle data) {         super.onmessagereceived(from, data);         log.i(constants.log_tag, "got gcm message " + data.getstring("message"));     } } 

the server uses pushjack , sends registration id's. can see server can send messages, can registration id , register our server, onmessagereceived never gets called... made google-services.json using link on website, should okay.

any or ideas welcome.

you're missing

<uses-permission android:name="android.permission.internet" /> 

in permissions.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -