java - my app don't receive a parse notifications -
i can see push notification in table on parse.com. devices cannot receive notifications. permissions manifest
<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.vibrate" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <permission android:protectionlevel="signature" android:name="com.james.fappsilya.fappsapp.permission.c2d_message" /> <uses-permission android:name="com.james.fappsilya.fappsapp.permission.c2d_message" />
receivers , services
<service android:name="com.parse.pushservice" /> <receiver android:name="com.parse.parsebroadcastreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> <action android:name="android.intent.action.receive_boot_completed" /> <action android:name="android.intent.action.user_present" /> </intent-filter> </receiver> <receiver android:name="com.james.fappsilya.fappsapp.receiver" android:exported="false"> <intent-filter> <action android:name="com.parse.push.intent.receive" /> <action android:name="com.parse.push.intent.delete" /> <action android:name="com.parse.push.intent.open" /> /> </intent-filter> </receiver> <receiver android:name="com.parse.gcmbroadcastreceiver" 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" /> <!-- important: change "com.parse.starter" match app's package name. --> <category android:name="com.james.fappsilya.fappsapp" /> </intent-filter> </receiver>
myapplication
package com.james.fappsilya.fappsapp; @override public void oncreate() { super.oncreate(); parse.initialize(this, "my code", "my code"); parseinstallation.getcurrentinstallation().saveinbackground(); parsepush.subscribeinbackground("global", new savecallback() { @override public void done(parseexception e) { if (e == null) { log.d("com.parse.push", "successfully subscribed broadcast channel."); } else { log.e("com.parse.push", "failed subscribe push", e); } } }); }
and receiver
package com.james.fappsilya.fappsapp; import android.content.context; import android.content.intent; import com.james.fappsilya.fappsapp.activity.mainactivity; import com.parse.parsepushbroadcastreceiver; /** * created fappsilya on 01.04.15. */ public class receiver extends parsepushbroadcastreceiver { @override public void onpushopen(context context, intent intent) { intent = new intent(context, mainactivity.class); i.putextras(intent.getextras()); i.setflags(intent.flag_activity_new_task); context.startactivity(i); } }
try using parse push via mobile network, solved error university wi-fi blocking reason.
Comments
Post a Comment