Simple plugin that lets you exit or restart an android process using android.os.Process.killProcess(android.os.Process.myPid());
. Restarts happen using PendingIntent
.
Useful where navigator.app.exitApp();
might not work. Also useful if your app needs to reset and start from the Initial Activity.
$ cordova create hello com.example.helloapp Hello
$ cd hello
$ cordova plugin add https://github.com/srivathsa-dhanraj/cordova-plugin-KillApp
Edit www/index.html
and add the following code inside <HEAD></HEAD>
<script type="text/javascript" src="KillApp.js"></script>
KillApp.killProcess(1); //Pass 1 to restart. 0 (optional) to exit.