从pssed无延时5秒HOME键$ P $后服务启动一个活动 [英] Starting an activity from a service after HOME button pressed without the 5 seconds delay

查看:274
本文介绍了从pssed无延时5秒HOME键$ P $后服务启动一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的这个Android的问题描述的问题: <一href="http://$c$c.google.com/p/android/issues/detail?id=4536">http://$c$c.google.com/p/android/issues/detail?id=4536

I'm experiencing the problem described in this Android issue: http://code.google.com/p/android/issues/detail?id=4536

简而言之,$ P $与调用startActivity 5秒钟pssing HOME键,机器人prevents服务和广播接收器后。

Simply put, after pressing the HOME button, android prevents services and broadcast-receivers from calling startActivity for 5 seconds.

我也注意到了(当然,理论上),具有以下权限:

I've also noticed that (well, theoretically), having the following permission :

"android.permission.STOP_APP_SWITCHES"

允许你调用resumeAppSwitches(这是在ActivityManagerService定义)。 综观ActivityManagerService的最新版本,该code被删除。

allows you to call resumeAppSwitches (which is defined in ActivityManagerService). Looking at the latest version of ActivityManagerService, this code is removed.

问题:如何启动使用startActivity活动没有这5秒延迟

The question: How to launch an activity using startActivity without this 5 second delay?

推荐答案

我不认为有一种方法可以与当前的API做到这一点。我认为这是他们打算如何它的工作,这样当用户退出了Home键preSS的应用程序无法强迫自己往回开。你可以添加家庭/发射意图的任何活动这是您要启动过滤器。然后,用户将有选择,基本上把该应用程序,就好像它是一个主屏幕。然后,它会得到无延迟可言,每当用户presses home键启动(他们不得不从会弹出询问他们想用它来完成这个动作该应用程序列表中选择它,但他们经常检查并使用这个应用程序借此一步之遥的未来。)

I don't think there is a way to do it with the current APIs. I think that is how they intended it to work so that an app cannot force itself back open when the user exits with a home key press. You could add the home/ launcher intent to the filter for whatever activity it is you are trying to start. Then the user would have the choice to basically treat that app as though it is a homescreen. Then it would get launched with no delay at all whenever the user presses the home button(They'd have to select it from the list that will pop up asking which app they want to use to complete this action, but they could check always use this app to take this step away in the future.)

这篇关于从pssed无延时5秒HOME键$ P $后服务启动一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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