【问题标题】:Android receiving duplicate push notification from parseAndroid从解析接收重复的推送通知
【发布时间】:2015-07-07 15:35:04
【问题描述】:

我正在使用解析推送plugin,而我的用户正在接收重复的推送通知。

我检查了解析推送仪表板,它说发送一个,我的手机收到两个。

我创建了一个频道并订阅了该频道,推送通知在该频道中显示为重复。

我的 application.java 文件是

package com.ionicframework.xxx;

import android.app.Application;
import org.apache.cordova.*;
import com.parse.Parse;
import com.parse.ParseInstallation;

public class MainApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Parse.initialize(this, "xxx", "xxx");
        ParseInstallation.getCurrentInstallation().saveInBackground();
    }
}

我的应用程序清单文件是

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="20000" android:versionName="2.0.0" package="com.ionicframework.xxx" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:name="com.ionicframework.xxx.MainApplication" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <data android:scheme="leadership" />
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
        </activity>
        <receiver android:exported="false" android:name="com.parse.ParsePushBroadcastReceiver">
            <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>
        <service android:name="com.parse.PushService" />
        <receiver android:exported="false" android:name="com.phonegap.plugins.ParsePushPluginReceiver">
            <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="com.ionicframework.xxx" />
            </intent-filter>
        </receiver>
        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </intent-filter>
        </receiver>
    </application>
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <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" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <permission android:name="com.ionicframework.xxx.permission.C2D_MESSAGE" android:protectionLevel="signature" />
    <uses-permission android:name="com.ionicframework.xxx.permission.C2D_MESSAGE" />
</manifest>

然后我的 app.js 离子

app1.run(function($ionicPlatform, $location, $rootScope) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
      ParsePushPlugin.register({eventKey:"myEventKey"}, //will trigger receivePN[pnObj.myEventKey]
          function() {
              console.log("registered devise")
          }, function(e) {
              console.log('error registring devise')
          });

      ParsePushPlugin.subscribe('TestChanel', function(msg) {
          console.log("Subscribed")
      }, function(e) {
          console.log("error subscribing")
      });

  });
})

【问题讨论】:

    标签: android parse-platform ionic


    【解决方案1】:

    这是在 7 月 1 日修复的。请在此处查看更新日志their download page

    【讨论】:

    • 链接现已过期。
    • 链接没问题 - 确保您向下滚动
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多