У меня есть уведомление о разборе в моем приложении. Если я открою свое приложение. то он получит уведомление. Если я перезагружу свой телефон. Уведомление не будет получено, пока я не открою приложение.Проблемы с выпуском Android Parse
Мой вопрос:
Как я могу начать/бежать, мой ParsePushBroadcastReceiver когда был перезапущен телефон. или как я могу заставить этот приемник всегда работать, даже если пользователь закрывает приложение/убивает приложение?
Я, хотя добавив android.intent.action.BOOT_COMPLETED, будет работать. но это не
Вот мой манифест:
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<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="com.my.app.core.MyParseReceiver"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<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="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.RECEIVE_BOOT_COMPLETED" />
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.my.app" />
</intent-filter>
</receiver>
<meta-data
android:name="com.parse.push.notification_icon"
android:resource="@drawable/ic_launcher" />
Мой класс
....
public class MyParseReceiver extends ParsePushBroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
Log.i(TAG, "onReceive Called");
if (intent == null) {
Log.e(TAG, "Receiver intent null");
}
else {
// Parse push message and handle accordingly
Log.d(TAG, "Receiver intent data => " + intent.toString());
}
}//end onReceive
@Override
public void onPushOpen(Context context, Intent intent) {
...
как насчет Wakelock? –