ToniKorin / cordova-plugin-autostart

This Cordova plugin will start automatically your app after the every boot or the auto-update of your application. You can enable or disable the autostart function in your app.
https://github.com/ToniKorin/cordova-plugin-autostart
Apache License 2.0
106 stars 77 forks source link

Plugins no funciona Ionic 4 #37

Open anRoswell opened 4 years ago

anRoswell commented 4 years ago

Buenas a todos,

Les cuento q estoy intentando hacer funcionar en plugins en Ionic 4 pero no logro hacer q se auto ejecute al arrancar android, lo estoy probando en Android v6.

No aparece ningun tipo de error, siemplemente el app no se auto ejecuta.

De antemano, gracias.

MInesGomes commented 4 years ago

Buenas a todos,

Les cuento q estoy intentando hacer funcionar en plugins en Ionic 4 pero no logro hacer q se auto ejecute al arrancar android, lo estoy probando en Android v6.

No aparece ningun tipo de error, siemplemente el app no se auto ejecuta.

De antemano, gracias.

Encontraste solución? Tengo lo mismo problema Did you find a solution? I have the same problem?

anRoswell commented 4 years ago

La verdad es q para esa versión de Android no lo volví a probar... porq' es difícil conseguir un dispositivo q la tenga, si llego a probar te estaré avisando...

MInesGomes commented 4 years ago

@anRoswell Gracias. Estoy intentando 7,8 e 9. Li ago sobre dar permisiones para autostart. I am trying 7,8,9. with this https://github.com/saty932/cordova-plugin-autostart-permission

anRoswell commented 4 years ago

A mi en las versiones 7 en adelante si me funciona perfectamente...

MInesGomes commented 3 years ago

Thanks for sharing @alixti.

I am using Ionic and changed your example to:

document.addEventListener('deviceready', onDeviceReady, false);

cordova.plugins.intentShim.getIntent((intent) => {
  const decodeIntent = JSON.parse(JSON.stringify(intent));
  if (typeof decodeIntent.extras !== 'undefined') {
    if (decodeIntent.extras.StartedOnBoot === '1') {
      cordova.plugins.backgroundMode.moveToBackground(); // Switch to background mode
    }
  }
}, (intent) => {
  console.log('Error Intent', intent);
});

// Cordova is now initialized. Have fun!
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
document.getElementById('deviceready').classList.add('ready');

Where do I find onDeviceReady ?

Kind Regards,

Ines Gomes https://www.linkedin.com/in/minesgomes/

On 28 Oct 2020, at 17:21, alixti notifications@github.com wrote:

Hice este pequeño ejemplo aquí https://gist.github.com/alixti/2c4a336e0745ddcbe4fab9a5a38cc97a (con otro plugin), espero les sirva!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ToniKorin/cordova-plugin-autostart/issues/37#issuecomment-718047451, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYZAHWTYLX5HXGUBWOKGQTSNBAILANCNFSM4IXFZSTQ.

alixti commented 3 years ago

Thanks for sharing @alixti. I am using Ionic and changed your example to: document.addEventListener('deviceready', onDeviceReady, false); cordova.plugins.intentShim.getIntent((intent) => { const decodeIntent = JSON.parse(JSON.stringify(intent)); if (typeof decodeIntent.extras !== 'undefined') { if (decodeIntent.extras.StartedOnBoot === '1') { cordova.plugins.backgroundMode.moveToBackground(); // Switch to background mode } } }, (intent) => { console.log('Error Intent', intent); }); // Cordova is now initialized. Have fun! console.log('Running cordova-' + cordova.platformId + '@' + cordova.version); document.getElementById('deviceready').classList.add('ready'); Where do I find onDeviceReady ? Kind Regards, Ines Gomes https://www.linkedin.com/in/minesgomes/ On 28 Oct 2020, at 17:21, alixti @.***> wrote: Hice este pequeño ejemplo aquí https://gist.github.com/alixti/2c4a336e0745ddcbe4fab9a5a38cc97a (con otro plugin), espero les sirva! — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#37 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYZAHWTYLX5HXGUBWOKGQTSNBAILANCNFSM4IXFZSTQ.

https://cordova.apache.org/docs/en/latest/cordova/events/events.html#deviceready

Remember, I am using other start on boot plugin in that example since this one is not working and no longer maintenance.