我从教程中复制并粘贴:
在我的应用程序中添加了以下内容:
public void onCreate() {
Parse.initialize(this, "xxxxx", "xxxxx");
ParseInstallation.getCurrentInstallation().saveInBackground();
}
有效,因为我在网上看到了已注册的设备。
我在我的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.emaborsa.cablePark.permission.C2D_MESSAGE" />
<uses-permission android:name="com.emaborsa.cablePark.permission.C2D_MESSAGE" />
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false" >
<intent-filter>
<action android:name="com.push.intent.RECEIVE" />
<action android:name="com.push.intent.DELETE" />
<action android:name="com.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.REGISTRATION" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.emaborsa.cablePark" />
</intent-filter>
</receiver>
<meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/park_logo_small"/>
但是当我从网上发送推送时,接收器永远不会被呼叫。为什么呢?