据我所知,并没有隐式Intent
地打开它Activity
。
要弄清楚如何明确执行此操作,请在打开设备上的此菜单时查看Logcat输出,以了解发生了什么情况。流程应ActivityManager
在某个时候由处理,因此您可以对其进行过滤。
您应该在日志中查找以下内容:
I / ActivityManager:从显示屏上的uid 1000开始u0 {cmp = com.miui.powerkeeper / .ui.PowerHideModeActivity}
获取此信息后,您只需要创建一个适当的Intent
内容即可Activity
自己开始:
try {
Intent intent = new Intent();
intent.setClassName("com.miui.powerkeeper",
"com.miui.powerkeeper.ui.PowerHideModeActivity");
startActivity(intent);
} catch (ActivityNotFoundException anfe) {
// this is not an MIUI device, or the component got moved/renamed
}
附带说明一下,您不应以这种明确的方式打开OS组件。每当他们更改此组件的类名称或程序包时,您的代码就会中断。
如果我想打开oppo设备活动怎么办?
@ShaifaliPundir基本上与这里相同。
Activity
在Oppo设备上打开并检查Logcat输出。从日志中,您应该能够找出系统打开了哪个组件。然后Intent
为相同的组件创建一个显式的(如上所示)。