暂停一个Android应用程序与PhoneGap的 [英] Pause an Android App with Phonegap

查看:105
本文介绍了暂停一个Android应用程序与PhoneGap的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程暂停在PhoneGap的Andr​​oid应用程序?我想模仿,当你打的HOME键会出现的行为。我已经使用过覆盖后退按钮处理程序,而在大多数情况下,我想要它做我的动作,当在特定的状态下,用户期望的应用程序,以最大限度地减少了,我想复制这种行为。

Is there any way to programmatically pause an Android app in Phonegap? I would like to mimic the behavior that occurs when you hit the HOME button. I've already had to overwrite the back button handler using this, and while in most cases I want it to do my action, when in a particular state the user would expect the app to minimize, and I want to replicate this behavior.

请记住,在Android上,这是不一样的关闭程序。这是很容易做到 device.exitApp(); ,但我想它记住它的状态,并在后台继续运行。特别是,如果仍然有异步工作正在做后台。

Keep in mind, on Android this is not the same as closing the app. That is quite easy to do with device.exitApp(); but I would like it to remember its state and keep running in the background. Especially if there's still an asynchronous job being done in the background.

有没有在PhoneGap的一个功能来实现这一目标?

Is there a feature in Phonegap to achieve this?

的<一个可能的复制href="http://stackoverflow.com/questions/10549472/manually-pause-an-application-in-android-phonegap">Manually停留在Android的PhoneGap的的应用程序,但我无法找到一些工具的OP提到的有,例如<​​code>导航,所以我忐忑不安到完全编辑和重写他们的帖子

Possible duplicate of Manually pause an application in Android Phonegap, but I couldn't find some of the tools the OP mentioned there such as navigator, so I was nervious to totally edit and rewrite their post

推荐答案

简单的答案似乎是:没有

The simple answer appears to be: no.

不过,对于其他任何人谈到了这条路,它不是不可能的。这只是没有的PhoneGap的功能,为你做。

However, for anyone else that comes down this path, its not impossible. It's just that there isn't a feature of Phonegap to do it for you.

睡一个应用程序,其实只是打开另一个意图的Andr​​oid的等价物。具体来说,开通了家的意图会睡运行的应用程序,并为您带来回到主屏幕。但据我可以告诉,要求各地和作用域的文档,PhoneGap的不具有开口意图的直接方式。

The Android equivalent of "sleeping an app" is actually just opening another intent. Specifically, opening the "Home" intent would sleep the running app and bring you back to the home screen. But as far as I can tell from asking around and scoping the docs, Phonegap doesn't have a direct way of opening intents.

什么你(据说)可以做的是两件事之一:

What you (supposedly) can do is one of two things:

调用Java code,做它自己的<一href="http://stackoverflow.com/questions/2727763/communication-between-android-java-and-phonegap-javascript">using这里描述的手段

Call the Java code that does it yourself using the means described here

你要知道,截至目前我已经决定不会再往前走这一点,所以我不作任何承诺,这些手段既左右,有没有尝试他们自己。

Mind you, as of right now I've decided to not go any further with this, so I make no promises about either of those means, having not attempted them myself.

我邀请其他人谁决定这进一步追求在这里更新他们的经验。

I invite anyone else who decides to pursue this further to update their experience here.

这篇关于暂停一个Android应用程序与PhoneGap的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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