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

Notification cannot get when the app is not run background #729

Closed
jianhao1203 opened this issue Mar 21, 2016 · 9 comments
Closed

Notification cannot get when the app is not run background #729

jianhao1203 opened this issue Mar 21, 2016 · 9 comments

Comments

@jianhao1203
Copy link

Expected Behaviour

Notification can be get no matter the app is run / not run in background or foreground

Actual Behaviour

Notification cannot be get if the app is being killed at background.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

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

Android 5.0.2

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

Mi 4i

Cordova CLI version and cordova platform version

cordova --version                                     6.0.0
cordova platform version android                    android 5.1.1

Plugin version

cordova plugin version | grep phonegap-plugin-push    (phonegap-plugin-push 1.6.0)

Sample Push Data Payload

Sample Code that illustrates the problem

Logs taken while reproducing problem

@jianhao1203
Copy link
Author

I faced the problem that notification cannot be get when the app is not running background/foreground. Is there any solution to solve this issue? thanks

@macdonst
Copy link
Member

@jianhao1203 when your app is in the background do you see the notification in the notification tray? What is a sample payload you send?

@fredgalvao
Copy link
Collaborator

Notification cannot be get if the app is being killed at background.

He wants the plugin to wake up the app code if it's killed through the "alt-tab". It's a duplicate.

@jianhao1203
Copy link
Author

@macdonst , when the app still running background(not killed off), the notification still can be get.
screenshot_2016-03-22-08-29-48_com miui home
screenshot_2016-03-22-08-29-56_com miui home

However, after I end the apps, the notification will never get anymore even through after that I reopened the app.

screenshot_2016-03-22-08-30-17_com miui home

Is that anyway that I can overcome this as this denied the purpose of push notification if required the user to run the app in background in order to receive push notification, thanks lot.

@jianhao1203
Copy link
Author

@fredgalvao , is this issue duplicated? I saw the issues #93 that stated already solved but it still happen when I try it yesterday, hope u can give me some suggestions to overcome this issues, thanks.

@jianhao1203
Copy link
Author

@macdonst , here is the code i implement, is there any missed out? I using plugin version 1.6.0.

`document.addEventListener("deviceready", onDeviceReady, false);
var menuStatus;

        function onDeviceReady() {
            document.addEventListener("backbutton", onBackKeyDown, false);

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

            push.on('registration', function(data) {
            console.log(data.registrationId);
            //alert("lai");
            alert(data.registrationId);

            });

            push.on('notification', function(data) {
            console.log(data.message);
            alert(data.title+" Message: " +data.message);
            // data.title,
            // data.count,
            // data.sound,
            // data.image,
            // data.additionalData
            });

            push.on('error', function(e) {
            console.log(e.message);
            });
        }
        `

@PaoloMessina
Copy link

+1 i think that the app must receive the push when the app work in foreground, in background and when is killed.

@macdonst
Copy link
Member

@jianhao1203 alright, this is a duplicate of #707. I've tested this on multiple Android phones and cannot reproduce the issue. Please add some details to #707 like the phone you are using, Mi 4i, Android version, etc.

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants