In Android app development, you will often encounter the need to jump to the System settings page. But when you use the following code:
Such as
Intent Intent = new Intent (settings.action_wifi_settings);
StartActivity (Intent);
Instead of opening the system's WiFi settings page right now, you'll see
This belongs to intent being hijacked by other applications, because you are using an implicit invocation of intent, and all activity that has registered the same action will be opened. If you want to only open the system's WiFi Settings page, the first reaction is to display the call, directly to the system WiFi settings class file, you can try, in addition to system applications, third-party applications do not directly obtain the System application class file. Permission-based.
Is there no way to directly open the system's WiFi settings page?
You can try it with the following code:
ComponentName ("com.android.settings","com.android.settings.wifi.WifiSettings"); It.setcomponent (CN); startactivity (it);
Directly successfully opened the system's WiFi Settings page, componentname This API is to complete the opening of other applications, including system applications. With this API, you can also extrapolate open a variety of other pages you need to specify. Hope to help everyone!
How to directly open the WiFi settings page of the Android system to prevent intent hijacking