Giter Site home page Giter Site logo

tonikorin / cordova-plugin-autostart Goto Github PK

View Code? Open in Web Editor NEW
105.0 105.0 78.0 41 KB

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.

Home Page: https://github.com/ToniKorin/cordova-plugin-autostart

License: Apache License 2.0

Java 68.02% JavaScript 14.60% Swift 17.38%

cordova-plugin-autostart's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-autostart's Issues

Plugin not working on Ionic 4

Hi all

I can't get this plugin to work. Following the docs I import the plugin, declare autostart in the constructor, then call the enable() inside the component. No error is thrown in the console, the application just does not start after reboot.

I have noticed that if I open the remote inspector and put a breakpoint on the line where I call enable(), then autostart executes correctly.

Any help would be appreciated.

Ionic Info

Ionic:

Ionic CLI : 5.4.11
Ionic Framework : @ionic/angular 4.11.8
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.2

Capacitor:

Capacitor CLI : 1.3.0
@capacitor/core : 1.3.0

Cordova:

Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 9 other plugins)

Utility:

cordova-res : 0.8.1
native-run : 0.3.0

System:

NodeJS : v10.16.0
npm : 6.13.1
OS : Windows 10

This does not work for Ionic 3

Here ionic info

`cli packages: (/Users/wilfredonoyola/workspace/statusfy/sf-ionic-1/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.9
Cordova Platforms  : android 6.3.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2 
Node              : v6.11.3
npm               : 3.10.10 
OS                : macOS High Sierra
Xcode             : Xcode 9.3 Build version 9E145 

Environment Variables:

ANDROID_HOME : /Users/wilfredonoyola/Library/Android/sdk/

Misc:

backend : pro`

can't use window.plugins.autoStart.enable()

I installed the plugin by

cordova plugin add cordova-plugin-autostart

and i can find it in my cordova plugin list

 cordova plugin ls | grep autostart  
 cordova-plugin-autostart 2.0.1 "Autostart"

but unfortunately i can't find this in my window.plugins ,
How to deal with it.....

Detect when the app is started at boot

Would be possible to detect when the app has been started by the plugin and when by the user? By that way specific actions could be made depending on the scenario?

Thanks.

Plugins no funciona Ionic 4

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.

IOS - Plugin 'AutoStart' not found

ERROR: Plugin 'AutoStart' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.

$ cordova plugin list
cordova-plugin-autostart 2.0.1 "Autostart"

Using with Stencil + Cordova

I don't have ionic project installed, could you please tell me what should I do to sync this plugin to android project?
image

npx cap update cannot find it.

I think it is not compatible because it ins't exposed to capacitor correctly or I am wrong?

Important package versions

"@capacitor-community/electron": "^1.3.2",

"@capacitor-community/keep-awake": "^1.0.0",

"@capacitor/android": "^3.0.0-alpha.11",

"@capacitor/app": "^0.1.2",

"@capacitor/cli": "^3.0.0-alpha.11",

"@capacitor/core": "^3.0.0-alpha.9",

"@capacitor/toast": "^0.2.2",

"@ionic-native/autostart": "^5.30.0",

"@ionic/core": "^5.5.2",

"cordova-plugin-autostart": "^2.3.0",`

Example phonegap build

Hi, i don't know how to use your plugin on phonegap buidl, it would be great if you could give me an example. Thanks!

it can be in the background

good afternoon, I spent time looking for a plugin to start the app when you turn on the phone and the closest thing I look for I found this plugin but not quite, what I need is to start in the background and not release, I saw that that there is a similar question but I am new to this and the truth is not there, try some things that I said but keep launching the app, I do not know if by now there is something that does what I want or not, with background-geolocation plugin has something of "startonbot" but when you start the app stops, so look for other solutions, someone could help me.

Not working on Android 8.1

Android 8.1
Nokia 6
nodejs 8.11.1
cordova 7.1.0
cordova-android 6.3.0
onsen-ui with angularjs
<plugin name="cordova-plugin-autostart" spec="git+https://github.com/ToniKorin/cordova-plugin-autostart.git" />

ons.ready(function () {
        window.plugins.intent.getCordovaIntent(function (intent) {
            if (intent.extras
                && intent.extras.cordova_autostart) {
                console.log("App has been launched automatically after boot.");
            }
            else {
                console.log("App has been launched manually.");
            }
        });
        cordova.plugins.autoStart.enable();
        document.addEventListener('deviceready', onDeviceReady.bind(this), false);
   
    });

I have try with and without screnn pin, but my not restart.

Starting the background

I've seen this being discussed before, during January this year, but I'm wondering whether it was ever considered to support starting the app in the background. In my case the app will issue local notifications if it has something to say, so the user will be aware of that anyway, and can act on it.

Is there any other safe way to achieve that?

I'm not sure how the backbutton plugin could help.

Regards,
Anders

Blank screen after boot and Application Error

Hi,
When the device reboot, the app starts with a blank screen and got the following error :
Application Error : The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

Not switching autostart to on in the app

Not working on redmi note 4.

Is that required any additional permission like

WRITE_SECURE_SETTINGS
WRITE_SETTINGS

To allow this plugin to autostart: on

Let me know about this!

Plugin not Installed using Visual Studio 2015

Hi sir,
i am using visual studio 2015 and creating sample cordova application and i try to add your plugin via visual studio it shows "visual studio was unable to parse plugin.xml".
err

any one help?

how to enable a Service?

i try to writing a native service,then using autostart plugin to boot it. but it no work.
Would you provide a example?

Long time until start

Maybe a feature more than a bug: It takes 40 seconds after the device is ready before the app is started. Can this be controlled?

Cheers,
Anders

A small question & a big Thank you! :-D

Not really issues with the plugin as such. Mainly wanted to thank you for the plugin that is quite useful to me. It seems to be working reliably on couple of devices that I tested it with. However I have a small doubt regarding the code below, used in the AndroidManifest file

            <receiver
                android:name="com.tonikorin.cordova.plugin.autostart.PackageReplacedReceiver" android:enabled="true">>
                <intent-filter>
                    <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
                </intent-filter>
            </receiver>

Even though the plugin works I was curious - do I need to replace the MY_PACKAGE_REPLACED with my bundle id / package name or something?

And again thanks a ton for the plugin.

Cheers,
M&M

runs at startup but runs in its full glory

Hi Toni,

I installed your plugin on ionic and it does work and work as expectedly. However, I think there is one side-effect that the end users may not like.

When the phone reboots, users are greeted with my app ( as soon as they pass the lock screen ). That's because your plug in kicks in and starts running my app. The problem is now the user has to do something ( such as pressing on the home button ) si that they can see their normal home/desktop view. And this is something they have to go thru, every single time, the phone is shutdown and reboots.

Is there a way to modify the plug in so that the associated app starts running in the background at startup, rather than running it in the foreground like this?

&gt; symbol at end of receiver

>

There is a greater than symbol at end of receiver (all three receiver tags have it). Please remove it.

Nice work. Thanks much.

Why doesn't work?

VS2015 Cordova 6.0
`(function () {
"use strict";

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

function onDeviceReady() {         

    cordova.plugins.autoStart.enable();         

    document.addEventListener( 'pause', onPause.bind( this ), false );
    document.addEventListener( 'resume', onResume.bind( this ), false );         
};

})();`

LOGS:
I/ActivityManager( 1026): Start proc io.test.app for broadcast io.test.app/com.tonikorin.cordova.plugin.autostart.PackageReplacedReceiver: pid=0 uid=10023 gids={50023, 3003, 3002, 3001, 1028, 1015}
W/BroadcastQueue( 1026): Unable to launch app io.test.app/10023 for broadcast Intent { act=android.intent.action.MY_PACKAGE_REPLACED flg=0x4000010 pkg=io.test.app(has extras) }: process is bad

How to deal with it?

Error

W/System.err( 8341): remove failed: ENOENT (No such file or directory) : /data/data/teste.auto.app/shared_prefs/autostart.xml.bak

This is not working with android MI 4i

Android MI 4i have its own security app and its contained our application disable by default for autostart, so we need to enable it manually. So any solutions for that ?

plugin not working

i installed the plugin and add this code to my js:
cordova.plugins.autoStart.enable();
and after installing the app and reboot the device the app not started automatically

any help please? @ToniKorin

Java.lang.RuntimeException

Hello, trying to use your plugin, on a Tablet, Android 6.0.1

I'm getting :

07-20 16:11:36.928 6027 6027 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.tonikorin.cordova.plugin.autostart.BootCompletedReceiver: java.lang.StringIndexOutOfBoundsException: length=0; regionStart=0; regionLength=-1

my simple code :

var myTextArea='';

var app = {
initialize: function() { this.bindEvents(); },
bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); },
onDeviceReady: function() { main(); }
};

app.initialize();

function main() {
myPrint('> AST: AutoStart Test / main()');
cordova.plugins.autoStart.enable();
myPrint('<< main()');
}
function $(id){return document.getElementById(id);}
function myPrint(str){ myTextArea+=str+'\n'; $('id-textarea').innerHTML = myTextArea; }

Thanks a lot in advance.

Detect When Started by User and When by Plugin

Is it possible to know when the application was started by the user explicitly or by the autostart plugin? I'd need my application to run on startup but I don't what them to see the user interface unless they explicitly ran the application.

Is there a way that I've missed?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.