Shaifali Pundir Shaifali Pundir - 9 months ago 101
Android Question

How to open MIUI system component programmatically

enter image description here

Is it possible to open the above page programmatically in Android?

Answer Source

As far as i know there is no implicit Intent to open this Activity.

To figure out how to do this explicitly, take a look at the Logcat when opening it on your device to see what is going on. The flow should be handled by the ActivityManager at some point, so you can filter for it.

Should look something like this in the log:

I/ActivityManager: START u0 {cmp=com.miui.powerkeeper/.ui.PowerHideModeActivity} from uid 1000 on display 0

After acquiring this information, you just have to create an appropriate Intent to start the Activity:

try {
    Intent intent = new Intent();

} catch (ActivityNotFoundException anfe) {
    // this is not an MIUI device, or the component got moved/renamed

On a side note, you shouldn't open OS components explicitly. Whenever they change the class name or package of this component, your code will break.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download