vara
vara

Reputation: 836

phone gap - navigator.app.exitApp() is not working on windows phone

I am newbie for phonegap.I am developing a windows app. In that app, I am trying to use navigator.app.exitApp(). But it's not working so, I have been trying to add a custom plugin in my project. So I have downloaded the cordova-plugin-exitapp-master.zip.

In that zip file having follwing files

cordova-plugin-exitapp-master/plugin.xml
cordova-plugin-exitapp-master/www/ExitApp.js
cordova-plugin-exitapp-master/src/wp/ExitApp.cs

cordova-plugin-exitapp-master/plugin.xml

<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
       id="se.sanitarium.cordova.exitapp"
       version="1.0.0">

<name>ExitApp</name>
<description>Implements navigator.app.exitApp on WP8</description>
<license>Apache 2.0</license>
<keywords>cordova,terminate</keywords>

<js-module src="www/ExitApp.js" name="exitApp">
<merges target="navigator.app" />
</js-module>

<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
  <feature name="ExitApp">
    <param name="wp-package" value="ExitApp" />
  </feature>
</config-file>

<source-file src="src/wp/ExitApp.cs" />
</platform>
</plugin>

cordova-plugin-exitapp-master/www/ExitApp.js

var exec = require('cordova/exec');

module.exports = {
/**
 * Exits the PhoneGap application with no questions asked.
 */
 exitApp: function() {
 exec(null, null, 'ExitApp', 'exitApp', []);
}
};

cordova-plugin-exitapp-master/src/wp/ExitApp.cs

using System;
using System.Windows;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;

namespace WPCordovaClassLib.Cordova.Commands
{
   public class ExitApp : BaseCommand
  {
    public void exitApp(string options)
    {
        Application.Current.Terminate();
    }
  }
}

So, Please any body can you tell me. In which place I have to add above plugins in my project?

Upvotes: 1

Views: 3142

Answers (1)

user3852962
user3852962

Reputation: 21

// inside the function in which you want to exit the app write this below statements only no any plugin or anything other than this is not required to quit the app

    function abc[you have to write the name instead of abc]{  
   IsolatedStorageSettings.ApplicationSettings.Save();//you may skip this line   
      Application.Current.Terminate();                          
}

Upvotes: 1

Related Questions