Pause an Android App with Phonegap

后端 未结 1 1510
轮回少年
轮回少年 2020-12-16 01:53

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 over

相关标签:
1条回答
  • 2020-12-16 02:03

    The simple answer appears to be: no.

    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.

    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:

    • This plugin is supposed to be promising

    • 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.

    0 讨论(0)
提交回复
热议问题