原因5秒的延迟,以显示在pressing home键的活动? [英] Reason for 5 sec delay to show an activity on pressing the home button?

查看:531
本文介绍了原因5秒的延迟,以显示在pressing home键的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在面临5秒延迟显示pressing HOME键后一个活动。我已通过一些后消失了,发现$ P $后pssing HOME键,机器人prevents服务和广播接收器与调用startActivity 5秒。

I am facing delay of 5 sec to show an Activity after pressing the HOME key. I had gone through some post and found that after pressing the HOME button, android prevents services and broadcast-receivers from calling startActivity for 5 seconds.

Q1。任何人都可以请让我知道,之所以发生这种延迟?

Q1. Can anyone please let me know the reason to happening this delay ?

Q2。当我修改了ActivityManagerService :: checkAppSwitchAllowedLocked()总是返回true,则避免了检查锁,因此活动得到没有任何延迟显示。难道是一个很好的解决方案,以避免延误,也可能导致其他方面的任何错误影响?

Q2. When I modified the ActivityManagerService::checkAppSwitchAllowedLocked() to always return true, it avoids checking lock and hence Activity gets shown without any delay. Would it be a good solution to avoid delay or it may cause any wrong effect in other ways ?

推荐答案

我知道,它可能为时已晚(半年过去了)。然而,这里就是答案

I know, it's probably too late (half year passed). However, here is the answer


  • 您将无法获得不植根手机上此权限,除非你的应用程序与相同的密钥系统签名。 Android有这样的一些权限。

  • You won't be able to get this permission on not rooted phone, unless your application is signed with the same keys as system. Android has some permissions like that.

此外,您还可能有兴趣来检查这个问题。 <一href=\"http://stackoverflow.com/questions/5600084/starting-an-activity-from-a-service-after-home-button-$p$pssed-without-the-5-seco\">Starting从服务无延时5秒pssed

Also, you may be interested to check this question. Starting an activity from a service after HOME button pressed without the 5 seconds delay

这篇关于原因5秒的延迟,以显示在pressing home键的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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