Recieving popup when app is in background?


#1

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


#2

what do you mean with receiving popup?

do you mean receiving push notifications?


#3

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


#4

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.


#5

For this it’s possible to us:
https://github.com/Diusrex/cordova-toforeground in combinaison with
https://github.com/jimibi/cordova-plugin-powermanagement
the first plugin put the application in foreground and the second wake up the phone if it’s in sleeping mode.


#6

toForeground(mainClassName, packageName, successFunction, errorFunction);

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


#7

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

is it rite???


#8

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 com.company.package…

because the plugin need to execute the correct android app.


#9

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


#10

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


#11

I think it’s better with.


#12

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);


#13

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


#14

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


#15

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


#16

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.