Open specific Settings-page programmatically

2019-07-13 16:18发布

Is there any way to, in my app, to redirect a user to a specific settings 'page'? My app works as a lock screen app, so I want to be able to redirect the user directly to the "Lock Screen" section of the Android settings. (Preferably via a button or something similar)

2条回答
何必那么认真
2楼-- · 2019-07-13 16:39

ACTION_SECURITY_SETTINGS Intent:

 Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS);
 startActivity(intent);

For complete Settings Intents

查看更多
Viruses.
3楼-- · 2019-07-13 16:56

I managed to find the correct answer in an old Stackoverflow-post from a while back. The code snippet now looks like this:

Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
startActivity(intent);
查看更多
登录 后发表回答