I have a app on my android device that runs as a system_process
.
我的Android设备上有一个应用程序作为system_process运行。
It's doing USB
communication in JNI layer
, with a full screen UI
to show images.
它在JNI层进行USB通信,使用全屏UI显示图像。
The problem is, the activity becomes invisible not long after start up. I can see from logcat
that the onStop()
was called.
问题是,活动在启动后不久就变得不可见了。我可以从logcat看到onStop()被调用。
And when I click the app icon the make it foreground, it would disappear again later.
当我点击应用程序图标使其成为前景时,它将在以后再次消失。
I looked into the logcat
to find that when this happens, there is a message like:
我查看了logcat,发现当发生这种情况时,会出现如下消息:
ActivityManager: Start Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME]}
I don't know whether this means the home key is pressed.
我不知道这是否意味着按下了主页键。
Actually I was not pressing that. But this indeed makes my app goes background and the home page was showed.
其实我并没有按下那个。但这确实使我的应用程序成为背景并显示主页。
I try to add "android.intent.category.HOME"
in my AndroidManifest.xml
. It does not work.
我尝试在AndroidManifest.xml中添加“android.intent.category.HOME”。这是行不通的。
My question is, what triggers ActivityManager
to "Start Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME]}"
?
我的问题是,什么触发ActivityManager“Start Intent {act = android.intent.action.MAIN cat = [android.intent.category.HOME]}”?
It seems the event is raise at random time.
看来这个事件是随机提升的。
Can I capture & ignore this event to prevent my app from becoming invisible ?
我可以捕获并忽略此事件以防止我的应用程序变得不可见吗?
By the way, my device has android 4.1.2
version.
顺便说一下,我的设备有android 4.1.2版本。
1 个解决方案
#1
All right. Seems there is something wrong with my device. When I run the app on other device, I did not encounter this problem.
行。好像我的设备有问题。当我在其他设备上运行应用程序时,我没有遇到此问题。
#1
All right. Seems there is something wrong with my device. When I run the app on other device, I did not encounter this problem.
行。好像我的设备有问题。当我在其他设备上运行应用程序时,我没有遇到此问题。