【问题标题】:phone gap - navigator.app.exitApp() is not working on windows phone电话差距 - navigator.app.exitApp() 在 Windows Phone 上不起作用
【发布时间】:2014-05-15 01:39:16
【问题描述】:

我是 phonegap 的新手。我正在开发一个 Windows 应用程序。在那个应用程序中,我尝试使用navigator.app.exitApp()。但它不起作用,我一直在尝试在我的项目中添加一个自定义插件。所以我下载了cordova-plugin-exitapp-master.zip

在具有以下文件的 zip 文件中

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();
    }
  }
}

所以,请任何人告诉我。我必须在我的项目中的哪个地方添加上述插件?

【问题讨论】:

标签: cordova windows-phone-8


【解决方案1】:

// 在要退出应用程序的函数中只写下面的语句没有任何插件或除此之外的任何东西都不需要退出应用程序

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-27
    • 2013-01-31
    • 1970-01-01
    相关资源
    最近更新 更多