Recieving popup when app is in background?

is it possible to recieve popup when app was in background or app runnig background

what do you mean with receiving popup?

do you mean receiving push notifications?

i need to recieve popup when bluetooth device in my range u just see the whatsapp it show popup when gt new texts like that

whats app is using push notifications to inform you about new messages.

I think that will not work to put your app in foreground if another device is in bluetooth range.

For this it’s possible to us: in combinaison with
the first plugin put the application in foreground and the second wake up the phone if it’s in sleeping mode.

toForeground(mainClassName, packageName, successFunction, errorFunction);

here it take arguments wich class or name we want to define??

window.plugins.toForeground(mainClassName, packageName, successFunction, errorFunction);

is it rite???

Ordinary cordova plugins are on $window.cordova.plugins.
($window is the correct angular “window” object)

But this one - you could see it here:

Puts the function directly on the window object.
Try $window.toForeground or only toForeground.

mainClass should be the name of the main android java class of your app.
And packageName is the package where it belongs to … something like…

because the plugin need to execute the correct android app.

Exemple of utilisation of ToForeground plugin with ionicframework starter app:
toForeground(‘StarterApp’, ‘com.ionicframework.starter’, sucFunction, errAlert);

without succes and error function it could be works rite???

I think it’s better with.

its not working i put all the method to check one after another
toForeground(‘StarterApp’, ‘com.ionicframework.starter’, sucFunction, errAlert);
window.plugins.toForeground(‘StarterApp’, ‘com.ionicframework.starter’, sucFunction, errAlert);
$window.toForeground(‘StarterApp’, ‘com.ionicframework.starter’, sucFunction, errAlert);
cordova.plugins.toForeground(‘StarterApp’, ‘com.ionicframework.starter’, sucFunction, errAlert);

after closing my app nothin and none of the service wil not run

Are you sure of your class Name and your package name. Can you send me your androidmanifest?

$window.toForeground(‘voucherPoint’, ‘com.ionicframework.voucherPoint2901’, sucFunction, errAlert);

I need this to happen in my app.

I am using ionic and onesignal for push notification and i want my app to throw a popup on receiving push notifications when app is in background.

Can you suggest something.