Notification with Onesignal

Asked

Viewed 218 times

0

I am using Onesignal to notify my Android users. Only that notifications only appear to those who on the day have already opened the application.
Have some service that can be put into the app to always leave it active and receive notifications?

1 answer

1


Yes. I always use this service.

By the Cordova platform, phonegap and Intel XDK etc...

window.plugins.OneSignal
    .startInit("coloque aqui seu app_id ")
    .inFocusDisplaying(window.plugins.OneSignal.OSInFocusDisplayOption.None)
    .handleNotificationReceived(function(jsonMessage){
        // Coloque aqui as funçoes de retorno da notificação
    })
    .handleNotificationOpened(function(){           
       // Coloque aqui as funçoes de retorno para click da notificação
    })
    .endInit();         
    window.plugins.OneSignal.getIds(function(ids) {
        // Pegando e registrando id do usuario de cada aparelho
        // Chave de autenticação de envio e retorno
        windows.localStorage.setItem('idsAutoPush', ids.userId);
    });
  • Thank you. I am Designer and I program for being self-taught.

  • Did this answer solve the problem @Albertobezerra? If so, could you mark it as an accepted answer using the button?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.