如何恢复在科尔多瓦的应用程序时,点击应用程序图标启动程序? [英] how to resume the application when click app icon launcher in cordova?

查看:118
本文介绍了如何恢复在科尔多瓦的应用程序时,点击应用程序图标启动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展与科尔多瓦 PhoneGap的移动应用程序。我现在在Android平台上测试它后来在iOS。我的问题是,当我有应用程序在后台运行,我点击这个应用程序是重新初始化的发射器。我想是刚刚打开从启动器图标的应用程序,并继续从那里跑。
我试图 keepRuning config.xml中的属性设置为真正,但没有奏效。

I am developing mobile application with cordova phonegap. I am testing it on android platform right now later on ios . My problem is when I have the app running in background, and I click the launcher of this application it is re-initialized. What I want is to just open the application from the launcher icon and continue running from where it is . I tried to set the attribute keepRuning in config.xml to true but it did not work.

   <preference name="keepRunning" value="true" />

这是config.xml文件:

This is the config.xml :

     <?xml version="1.0" encoding="utf-8" standalone="no"?>
     <widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="com.coolappz.HTML5Application1" version="1.0.0">
        <name>HTML5Application1</name>
        <description>Cordova Application</description>
        <author email="info@com.coolappz" href="http://www.coolappz.com">user</author>
        <access origin="*"/>
        <preference name="fullscreen" value="true"/>
        <preference name="webviewbounce" value="true"/>
        <preference name="keepRunning" value="true" />

    </widget>

编辑:
有关详细信息:

For more details:

我从并增加1每秒启动计数器。计数器继续在后台如果我preSS家递增。问题是,当我preSS从零计数器复位,因为应用程序重新创建应用程序的图标启动程序。

I have a counter that starts from zero and increments by 1 every second . The counter resumes to increment in background if I press home. The problem is when I press the icon launcher of the application the counter resets from zero because the application is recreated.

我希望这是该视图更清晰。

I hope this makes the view more clear.

我的问题:

这能由科尔多瓦配置或处理,我需要一个插件来这样做。结果
这是可能的,如何?
谢谢

Can this be handled by cordova configuration or I need a plugin to do so.
Is that possible and how ? Thanks

推荐答案

我试过这个解决方案,它为我工作

I tried this solution and it worked for me

添加

     android:launchMode="singleInstance"

有关在AndroidManifest.xml活动标签,你可以发现它在项目名称/平台/安卓/ AndroidManifest.xml中

for activity tag in the AndroidManifest.xml , you can find it in projectName/platforms/android/AndroidManifest.xml.

这就是它。

这篇关于如何恢复在科尔多瓦的应用程序时,点击应用程序图标启动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆