Android push notification using Sinch not working -


hi i've been following tutorial sinch: https://www.sinch.com/learn/sinch-managed-push-calling-android/, , problem gcmbroadcastreceiver doesn't seem able receive anything.

before able have instant-messages between users chat activity open. i'm trying notifications when chat activity not opened. far i'm understanding, sinch supposed take care of push , need receive push notification , whatever want it. when send message 1 device using another, nothing happens far push notification's concerned. help? thank much!

my androidmanifest related parts:

<uses-permission android:name="android.permission.internet"/>     <uses-permission android:name="android.permission.access_network_state"/>     <uses-feature android:name="android.hardware.camera"         android:required="true" />      <uses-permission android:name="com.google.android.c2dm.permission.receive"/>     <uses-permission android:name="android.permission.wake_lock"/>     <permission android:name="com.myapppackage.c2d_message"         android:protectionlevel="signature"/>     <uses-permission android:name="com.myapppackage.permission.c2d_message"/>     ...     <!-- chat activities -->         <service android:name=".managers.messageservice"             android:enabled="true"/>         <service android:name=".gcmintentservice" />         <receiver             android:name=".gcmbroadcastreceiver"             android:permission="com.google.android.c2dm.permission.send">             <intent-filter>                 <action android:name="com.google.android.c2dm.intent.receive"/>                 <category android:name="com.myapppackage"/>             </intent-filter>         </receiver> 

messageservice

... public void startsinchclient(string username) {         log.d("sinchclient", "started");         sinchclient = sinch.getsinchclientbuilder().context(this).userid(username).applicationkey(app_key)                 .applicationsecret(app_secret).environmenthost(environment).build();          //sinchclient.setsupportcalling(true);         sinchclient.setsupportmanagedpush(true);         sinchclient.addsinchclientlistener(this);         sinchclient.setsupportmessaging(true);         sinchclient.setsupportactiveconnectioninbackground(true);         sinchclient.checkmanifest();          sinchclient.start();     } ... @override     public void onclientstarted(sinchclient client) {         broadcastintent.putextra("success", true);         log.d("messageservice", "onclient success");         broadcaster.sendbroadcast(broadcastintent);          client.startlisteningonactiveconnection();         messageclient = client.getmessageclient();     } 

gcmbroadcastreceiver

    public class gcmbroadcastreceiver extends wakefulbroadcastreceiver {     @override     public void onreceive(context context, intent intent) {         log.d("onreceive", "called!");         componentname comp = new componentname(context.getpackagename(), gcmintentservice.class.getname());         startwakefulservice(context, (intent.setcomponent(comp)));         setresultcode(activity.result_ok);     } } 

gcmintentservice

public class gcmintentservice extends intentservice implements serviceconnection {      private intent mintent;     private notificationmanager mnotificationmanager;     public gcmintentservice() {         super("gcmintentservice");         log.d("gcmintentservice", "created");     }      @override     protected void onhandleintent(intent intent) {         log.d("gcmintentservice", "onhandleintent");         if (sinchhelpers.issinchpushintent(intent)) {             mintent = intent;             connecttoservice();         } else {             gcmbroadcastreceiver.completewakefulintent(intent);         }     }      private void connecttoservice() {         log.d("gcmintentservice", "connecttoservice");         getapplicationcontext().bindservice(new intent(this, sinchclient.class), this, context.bind_auto_create);     }      @override     public void onserviceconnected(componentname componentname, ibinder ibinder) {         log.d("gcmintentservice", "onserviceconnected");         if (mintent == null) {             return;         }if (sinchhelpers.issinchpushintent(mintent)) {             sinchclient sinchservice = (sinchclient) ibinder;             if (sinchservice != null) {                 //notificationresult result = sinchservice.relayremotepushnotificationpayload(mintent);                 // handle result, e.g. show notification or similar                 mnotificationmanager = (notificationmanager) this.getsystemservice(context.notification_service);                 pendingintent contentintent = pendingintent.getactivity(this, 0,                         new intent(this, introactivity.class), 0);                 notificationcompat.builder mbuilder = new notificationcompat.builder(this)                         .setcontenttitle("new message!");                 mbuilder.setcontentintent(contentintent);                 mnotificationmanager.notify(globalvars.notification_id, mbuilder.build());             }         }gcmbroadcastreceiver.completewakefulintent(mintent);         mintent = null;     }      @override     public void onservicedisconnected(componentname componentname) {     } } 

the tutorial followed has things had error, instead of "sinchservice", i'm using "sinchclient", has functions. sinch doesn't have github example particular tutorial :( first time posting question:) again!

update: receiver somehow works now, gcmintentservice not responding function startwakefulservice(context, (intent.setcomponent(comp)))


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -