0
我已經設置了我的應用程序的解析通知,並嚴格按照說明,但不知何故,我沒有收到任何通知。這裏有什麼問題?我的應用程序沒有收到解析推送通知
更新:我只是嘗試在Parse.com網站上發送測試推送通知。這應該沒有訂閱的頻道工作(見註釋)
我AndroidManifest.xml中(僅相關部分):
<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.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="co.bla.bla.permission.C2D_MESSAGE" />
<uses-permission android:name="co.bla.bla.permission.C2D_MESSAGE" />
<!-- Push notification setup -->
<service android:name="com.parse.PushService" />
<receiver android:name="co.bla.bla.ParsePushReceiver"
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" />
<category android:name="co.bla.bla" />
</intent-filter>
</receiver>
</application>
而且我已經延長ParsePushBroadcastReceiver
:終於
public class ParsePushReceiver extends com.parse.ParsePushBroadcastReceiver{
@Override
protected void onPushReceive(Context context, Intent intent) {
ParseAnalytics.trackAppOpenedInBackground(intent);
String s = intent.getStringExtra("alert");
Log.d("Push received", s);
// do your stuff here
if(SugarSnapApplication.INACTIVE)
super.onPushReceive(context, intent);
}
@Override
protected void onPushOpen(Context context, Intent intent) {
// TODO Auto-generated method stub
Intent i = new Intent(context, SugarActivity.class);
i.putExtras(intent.getExtras());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
@Override
protected Notification getNotification(Context context, Intent intent) {
// TODO Auto-generated method stub
return super.getNotification(context, intent);
}
@Override
protected void onPushDismiss(Context context, Intent intent) {
// TODO Auto-generated method stub
super.onPushDismiss(context, intent);
}
}
您是否訂閱了您要發送的頻道? –
@IliiazAkhmedov我只是嘗試在Parse.com網站上發送測試推送通知。 – Loolooii
我的意思是在你的應用程序的應用程序類中調用了ParsePush.subscribeInBackground(「<你的默認主通道名稱>」); –