user3911119
user3911119

Reputation: 281

Unable to receive Pushy push notifications on Android

I am using Pushy to send push notifications to an app running on Android device.

Received the PN and got this message on Android studio console.

D/Pushy: Received push for package com.abc.def

However, the broadcast receiver configured in AndroidManifest.xml is not getting called. I followed the steps exactly as in the Pushy documentation below.

https://pushy.me/docs/android/modify-androidmanifest

Tried to debug the android.app.ContextImpl code but got lost.

What am I missing?

EDIT#1

Posting AndroidManifest.xml as requested.

<?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>

The broadcast receiver:

I had set a breakpoint in the onReceive method. Could that cause any issues?

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

Upvotes: 0

Views: 1113

Answers (1)

user3911119
user3911119

Reputation: 281

Found that I had blocked some important thread & so could not receive the notification.

Removed the wait on the thread and am now getting notifications.

Upvotes: 1

Related Questions