无法在Android上接收Pushy Push通知

时间:2018-07-12 05:21:41

标签: android push-notification pushy

我正在使用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代码,但迷路了。

我想念什么?

EDIT#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
    }
}

1 个答案:

答案 0 :(得分:1)

发现我已阻止了一些重要线程,因此无法收到通知。

消除了对线程的等待,现在正在接收通知。