[英]Unable to receive Pushy push notifications on Android
我正在使用Pushy將推送通知發送到在Android設備上運行的應用程序。
收到PN,並在Android Studio控制台上收到此消息。
D/Pushy: Received push for package com.abc.def
但是,未調用在AndroidManifest.xml中配置的廣播接收器。 我完全按照下面的Pushy文檔中的步驟進行操作。
https://pushy.me/docs/android/modify-androidmanifest
試圖調試android.app.ContextImpl代碼,但迷路了。
我想念什么?
編輯#1
根據要求發布AndroidManifest.xml。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.def" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="28" />
<!-- Pushy Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- End Pushy Permissions -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- Pushy Declarations -->
<!-- Pushy Notification Receiver -->
<!-- Incoming push notifications will invoke the following BroadcastReceiver -->
<receiver android:name=".PushReceiver" android:exported="false">
<intent-filter>
<!-- Do not modify this -->
<action android:name="pushy.me" />
</intent-filter>
</receiver>
<!-- Pushy Update Receiver -->
<!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
<receiver android:name="me.pushy.sdk.receivers.PushyUpdateReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
<!-- Pushy Boot Receiver -->
<!-- Do not modify - internal BroadcastReceiver that restarts the listener service -->
<receiver android:name="me.pushy.sdk.receivers.PushyBootReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<!-- Pushy Socket Service -->
<!-- Do not modify - internal socket service -->
<service android:name="me.pushy.sdk.services.PushySocketService"/>
<!-- End Pushy Declarations -->
<activity
android:name="com.abc.def.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
廣播接收器:
我在onReceive方法中設置了一個斷點。 會引起任何問題嗎?
package com.abc.def;
import android.content.Intent;
import android.content.Context;
import android.content.BroadcastReceiver;
public class PushReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent)
{
//TODO
}
}
發現我已阻止了一些重要的線程,因此無法收到通知。
消除了對該線程的等待,現在正在接收通知。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.