Skip to content

Registration event not being triggered on Android. #344

@barbaragavalda

Description

@barbaragavalda

Bug Report

The event registration not being triggered on Android.

Expected Behaviour

Event registration being triggered on Android.

Actual Behaviour

On iOS it works fine but on Android registration is not working.

Steps to Reproduce

I've created a simple project:

cordova create test-app com.test.app Test
cd test-app/
cordova platform add ios
cordova platform add android
cordova plugin add @havesource/cordova-plugin-push
cordova plugin add cordova-plugin-androidx-adapter 

cordova info Printout

Cordova Packages:

    cli: 12.0.0
        common: 5.0.0
        create: 5.0.0
        lib: 12.0.1
            common: 5.0.0
            fetch: 4.0.0
            serve: 4.0.1

Project Installed Platforms:

    android: 13.0.0
    ios: 7.1.1

Project Installed Plugins:

    @havesource/cordova-plugin-push: 5.0.5
    cordova-plugin-androidx-adapter: 1.1.3

Environment:

    OS: macOS Sequoia 15.3 (24D60) (darwin 24.3.0) arm64
    Node: v20.17.0
    npm: 10.8.2

android Environment:

    android:
ERROR: Command failed with ENOENT: avdmanager list target
spawn avdmanager ENOENT


ios Environment:

    xcodebuild:
ERROR: Command failed with exit code 1: xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance


Project Setting Files:

    config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>App-Quds</name>
    <description>Sample Apache Cordova App</description>
    <author email="dev@cordova.apache.org" href="https://cordova.apache.org">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
</widget>

    package.json:
--- Start of Cordova JSON Snippet ---
{
  "platforms": [
    "ios",
    "android"
  ],
  "plugins": {
    "@havesource/cordova-plugin-push": {
      "ANDROIDX_CORE_VERSION": "1.6.+",
      "FCM_VERSION": "23.+",
      "IOS_FIREBASE_MESSAGING_VERSION": "10.24.0"
    },
    "cordova-plugin-androidx-adapter": {}
  }
}
--- End of Cordova JSON Snippet ---

Sample Code that illustrates the problem

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
    const push = PushNotification.init({
    	android: {
    	    senderID: ************,
    	},
    });

    push.on('registration', (data) => {
        console.log('registration');
        console.log(data.registrationId);
    });

    push.on('notification', (data) => {
        console.log(data);
    });

    push.on('error', (e) => {
        console.log(e.message);
    });
}

Logs taken while reproducing problem

2025-02-06 17:23:39.362 12623-12751 System.err              com.test.app                     W  java.lang.ClassNotFoundException: com.adobe.phonegap.push.PushPlugin
2025-02-06 17:23:39.366 12623-12751 System.err              com.test.app                     W  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.adobe.phonegap.push.PushPlugin" on path: DexPathList[[zip file "/data/app/~~A_J4MMjPzyvaXvGnJw_vNg==/com.test.app-sLcF87jfcTPboHivea9kAQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~A_J4MMjPzyvaXvGnJw_vNg==/com.test.app-sLcF87jfcTPboHivea9kAQ==/lib/arm64, /system/lib64, /system_ext/lib64]]
2025-02-06 17:23:39.366 12623-12751 System.out              com.test.app                     I  Error adding plugin com.adobe.phonegap.push.PushPlugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions