Search code examples
androidcordovaionic-frameworkionic2startup

How I can launch my app in startup device with cordova?


I want launch the app on startup, how I can it?

I learn about https://github.com/olaferlandsen/cordova-plugin-autostart but it don't work well

Thanks


Solution

  • You can use cordova-plugin-autostart to auto start you application.

    Step by step:

    Install the latest version of the plugin from CLI:

    cordova plugin add cordova-plugin-autostart@latest
    

    Or from master branch:

    cordova plugin add https://github.com/ToniKorin/cordova-plugin-autostart.git 
    

    Enable autoStart:

    cordova.plugins.autoStart.enable();
    

    Example Ionic2:

    FILE: app.component.ts

    declare let cordova : any;
    export class MyApp {
        rootPage:any = HomePage;
        constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
            platform.ready().then(() => {
                cordova.plugins.autoStart.enable();