如何使用 cordova 在启动设备中启动我的应用程序?

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

我想在启动时启动应用程序,我该怎么做?

我了解 https://github.com/olaferlandsen/cordova-plugin-autostart 但效果不佳

谢谢

您可以使用 cordova-plugin-autostart 来自动启动您的应用程序。

一步一步:

从 CLI 安装最新版本的插件:

cordova plugin add cordova-plugin-autostart@latest

或来自master分支:

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

启用自动启动:

cordova.plugins.autoStart.enable();

Ionic2 示例:

文件: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();