相关疑难解决方法(0)

Android Parse Push通知设备只在一台设备上注册一次

每个人都在我的应用程序中使用解析服务进行推送通知.但是当我在一台设备上重新安装应用程序时,它会一直注册.然后问题是,一台设备会在每台设备上收到多个通知.我已经完成了一些注册代码,如下所示.请帮助我,提前谢谢.

Parse.initialize(this, PARSE_APP_ID, PARSE_CLIENT_KEY);
ParseACL defaultACL = new ParseACL();
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
PushService.setDefaultPushCallback(this, MainActivity.class);
ParseInstallation.getCurrentInstallation().getInstallationId();
ParseInstallation.getCurrentInstallation().saveInBackground();
Run Code Online (Sandbox Code Playgroud)

并订阅:

PushService.subscribe(this, userName, Detail.class);
Run Code Online (Sandbox Code Playgroud)

在清单中

以上

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

  <uses-permission android:name="com.example.app.permission.C2D_MESSAGE" />
Run Code Online (Sandbox Code Playgroud)

在应用标签中:

    <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="act" />
        </intent-filter>
    </receiver>

    <receiver android:name="com.app.example.PushReceiver" >

        <intent-filter>
            <action android:name="act" />
            </action>
        </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" />
            <action android:name="act" />
            <category android:name="com.example.app" />
        </intent-filter>
    </receiver>
Run Code Online (Sandbox Code Playgroud)

每次我安装时,都显示错误,如下所示.

03-10 12:18:48.555: E/ParseCommandCache(12709): Failed to …
Run Code Online (Sandbox Code Playgroud)

android push-notification devicetoken parse-platform google-cloud-messaging

15
推荐指数
3
解决办法
2万
查看次数

Android:错误com.parse.ParseException:必须在此操作中指定至少一个ID字段(installationId,deviceToken)

我在我们的应用程序中使用解析推送通知但在设备注册时出现一些问题,错误如下所示.当我们向设备发送推送通知时,还有一个问题,即设备收到多个通知.虽然我们也将解析库升级到Parse 1.4.1.请帮助我,提前谢谢.

首次安装应用时会显示错误:

04-14 14:00:40.004: E/LOG(26045): Socket event: onConnect 
04-14 14:00:41.874: E/ParseCommandCache(26045): Failed to run command.
04-14 14:00:41.874: E/ParseCommandCache(26045): com.parse.ParseException: at least one ID field (installationId,deviceToken) must be specified in this operation
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.ParseCommand$2.then(ParseCommand.java:348)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$10.run(Task.java:452)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$1.execute(Task.java:68)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.completeImmediately(Task.java:448)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.continueWith(Task.java:322)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task.continueWith(Task.java:333)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$8.then(Task.java:385)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$8.then(Task.java:377)
04-14 14:00:41.874: E/ParseCommandCache(26045):     at com.parse.Task$11.run(Task.java:485)
04-14 …
Run Code Online (Sandbox Code Playgroud)

android device push-notification parse-platform

14
推荐指数
2
解决办法
4519
查看次数