How to show up a modal on phone when the user is not viewing the app?

I am writing an small messaging app for my employees. This app works with Node.js server. Everything is ok, except this feature:

I want to turn the screen on and show up the message inside a modal when an employee receives it, even when he/she is not viewing the app, even when his/her phone is locked? Does Ionic Popup/Modal service do it for me? This feature I want to implement is like Android’s Messaging app or Viber.

I didn’t find anything over the net.

Any help is appreciated

1 Like

Modal can be only displayed within app… what you might be looking for is a notification…
have a look at push notification and Google Cloud messagein

You can test my plugin (fork of :
It must solve a lot of your problems.

@harshitgoel96 my app has push notifications, I want a box show up in the users’ screen, showing the preview of the message, a text box to reply and some buttons to close the box or view the message in app. I don’t know how to bring it up.

Thanks, this plugin helps me to turn the screen on, but I didn’t find any way to show up the message box on the screen, yet.

i just checked the plugin… if the alert box is shown without the app being active, then in the same place load a custom modal…

  sucAlert = function() {

//place model here
    errAlert = function() {
    powerManagement.acquire(sucAlert, errAlert); // awake the smartphone
    powerManagement.release(sucAlert, errAlert); // allowed to sleep again

Uses callBack function, like this:

  sucFunction = function () {
          //Modal call
  errAlert = function () {
  sucAlert = function () {
         toForeground('StarterApp', 'com.ionicframework.starter', sucFunction, errAlert);
  powerManagement.acquire(sucAlert, errAlert);
  powerManagement.release(sucFunction, errAlert);
1 Like

just a query… would your plugin be working when the app is closed ??

EDIT and what does toForeground does ??? where can i look for it ?

No, the application must be in background or in foreground

A plugin for codova, which will allow the app to bring itself, or other app activites, to the foreground.

Fork this plugin:

@jimibi tell me please if it is possible with your plugin on Android to keep an application (cordova/phonegap) in memory and active? I’ve noticed that even if I use wake lock (not from your plugin), my app is getting less and less active and finally it is stopped by the system. The app is supposed to do a task each minute. At the beginning it works correctly and then the period between calling the timer is getting longer and finally the app is stopped. If I connect external power source it works correctly, but on battery Android is lulling it and I cannot do anything to prevent this. Is anything (without external service) possible to achieve this functionality of keeping an app active and do some task each minute forever?

No, for this use: