应用程序关闭时,无法从parse.com接收推送通知

时间:2014-07-14 01:16:04

标签: android parsing push-notification parse-platform

Parse Push Notifications工作正常,但仅在应用程序处于打开状态或后台时才有效。我在扩展应用程序的类和该类的onCreate()方法中初始化和setDefaultPushCallback。我不明白为什么它不会在后台发送。

1 个答案:

答案 0 :(得分:0)

这是清单文件.....

  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="your package name"
        android:versionCode="1"
        android:versionName="1.0" >

        <uses-sdk
            android:minSdkVersion="15"
            android:targetSdkVersion="16" />

        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
        <uses-permission android:name="android.permission.VIBRATE" />

        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name="your package name.YourActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

            <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.RECEIVE_BOOT_COMPLETED" />
                    <action android:name="android.intent.action.USER_PRESENT" />
                </intent-filter>
            </receiver>
            <receiver android:name="your package name.YourCustomReceiver" >
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                    <action android:name="android.intent.action.USER_PRESENT" />
                    <action android:name="your package name.UPDATE_STATUS" />
                </intent-filter>
            </receiver>
        </application>

    </manifest>