使用Parse.com进行Android JSON推送通知

时间:2015-02-22 22:02:46

标签: android json parse-platform push-notification broadcastreceiver

我正在尝试使用Parse.com实施我的第一个JSON推送通知,我已经实施了常规推送通知并且它正常工作。我在这里失踪的是,我无法找到完整的指南,如何才能实现目标。我试图通过Parse.com控制台发送JSON通知,其中包含一个在点击推送时需要打开的URL。

下面是我定期推送的清单:

         <uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.dubs.gamingmaster.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.VIBRATE" />

<permission
    android:name="com.xxx.xxx.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

    <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.USER_PRESENT" />
            <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
            <action android:name="android.net.wifi.STATE_CHANGE" />
        </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="com.xxx.xxx" />
        </intent-filter>
    </receiver>

以下是Application类:

 import com.parse.Parse;
 import com.parse.ParseInstallation;
 import com.parse.ParseUser;
 import com.parse.PushService;

 public class Application extends android.app.Application {

   public Application() {
   }

    @Override
    public void onCreate() {
    super.onCreate();

// Initialize the Parse SDK.
Parse.initialize(this, "xxxxxxxxxxxxxxxxxxxxxxxx",
        "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx");


// Specify an Activity to handle all pushes by default.
       PushService.setDefaultPushCallback(this, MainActivity.class);



    }
   }

0 个答案:

没有答案