启动第三方应用程序并在用户离开它的状态下恢复它 [英] Launch 3rd party app and resume it on the state where the user has left it

查看:68
本文介绍了启动第三方应用程序并在用户离开它的状态下恢复它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android开发领域的新手。在我的应用程序中,我想通过其包名启动一个应用程序,我可以通过使用此代码成功实现这一点



Hi, I am new to android development field.In my app I want to launch an app by its package name and I can successfully do that by using this code

Intent intent=getPackageManager().getLaunchIntentForPackage("com.android.mms");
            startActivity(intent);





它成功启动应用程序,但即使我的应用程序从主启动器重启应用程序正在后台运行。我希望以某种方式启动某个应用程序,以便从用户离开的地方恢复它。

提前谢谢



我尝试了什么:



我尝试使用意图设置标志方法,但它总是重启应用程序开始..



It launches the app successfully but it restart the app from its main launcher even if my app is running in the background .I want to launch that certain app in such a way that it should be resumed from where the user has left it..
Thanks in advance

What I have tried:

I tried set flags method with intent but it always restarted the app from beginning..

推荐答案

应用程序可以在您的请求中保存其内部状态,并启动状态恢复。你需要找到相关的文档。

否则,我担心它实际上是不可能的。

从外部保存状态涉及保存整个过程,包括正在使用的OS资源。重新启动恢复意味着精确的过程恢复,包括操作系统资源,这可能非常复杂,几乎不可能。
Either the app can save its internal state on your request, and launch with state restoration. You need to find related documentation.
Otherwise, I fear it is practically impossible.
Saving the state from outside involve saving the whole process including OS resources in use. And relaunch with restoration means exact process restoration, including OS resources, which can be pretty complicated and almost impossible.


这篇关于启动第三方应用程序并在用户离开它的状态下恢复它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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