Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

.init() not prompting the 'Allow/Deny' notification dialog #2915

Open
daveed80 opened this issue May 15, 2020 · 2 comments
Open

.init() not prompting the 'Allow/Deny' notification dialog #2915

daveed80 opened this issue May 15, 2020 · 2 comments

Comments

@daveed80
Copy link

daveed80 commented May 15, 2020

Expected Behaviour

The below code will initiate the native 'Allow/Deny' prompt/dialog that allows a user to allow or deny push notifications.

var push = PushNotification.init({
ios: {
alert: "true",
badge: "true",
sound: "true"
},
android: {
senderID: '123456'
}
});

Actual Behaviour

The native 'Allow/Deny' prompt/dialog that allows a user to allow or deny push notifications is never presented. However, when calling isEnabled returns as true when calling .hasPermission()

Reproduce Scenario (including but not limited to)

Steps to Reproduce

var push = PushNotification.init({
ios: {
alert: "true",
badge: "true",
sound: "true"
},
android: {
senderID: '123456'
}
});

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 8.1.0

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Pixel C

Cordova CLI version and cordova platform version

cordova --version                                    9.0.0
cordova platform version android                     8.0.0

Plugin version

cordova plugin version 2.3.0

Sample Push Data Payload

Sample Code that illustrates the problem

try {
var push = PushNotification.init({
ios: {
alert: "true",
badge: "true",
sound: "true"
},
android: {
senderID: '123456'
}
});

        PushNotification.hasPermission(data => {               
            if (data.isEnabled) {                   
                alert('enabled');
            } else {
                alert('not enabled');
            }

        });
    } catch (e) {
        alert(JSON.stringify(e));
    }

Logs taken while reproducing problem

@daveed80
Copy link
Author

Actually....does android not prompt/request permissions to allow or deny push notifications?

@VAdaihiep
Copy link

Only iOS show alert request permission receive notification. Android default is grant, and if user don't want to receive notification, they must set in Setting.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants