Android-activation of the application details page
In the settings function provided by the Android system, after entering the Application List, click the List entry to go to the application details page. Can we write our own application to activate the details interface of the application? This can be achieved. Let's take a look at how to implement this function. Let's just move on to the topic.
I. Principles
Because versions earlier than 2.2 and later versions have different methods to activate the details interface of the application, we must first obtain the SDK version number of the current Android system. If the SDK version number is greater than 8, use the Activation Method of Versions later than 2.2. If the SDK version is earlier than or equal to 8, use the call method of versions earlier than 2.2.
II. Implementation
The implementation is very simple. I will not post all the code here. I only provide the core method code. You only need to use these methods directly in your project.
1. Obtain the SDK version number of the current Android system
// Obtain the sdk version of the current system. private int getSDKVersion () {return android. OS. Build. VERSION. SDK_INT ;}
2. Activate the application details page
// Activate the details page of the activation application // The input parameter is the package name of the application to be activated public void policyappdetailview (String packageName) {int version = getSDKVersion (); intent intent = new Intent (); // call the application details page later than 2.3 if (version> 8) {// activate the system component intent. setAction (android. settings. APPLICATION_DETAILS_SETTINGS); intent. setData (Uri. parse (package: + packageName);} else {// call the application details interface intent in versions earlier than 2.2. setAction (Intent. ACTION_VIEW); intent. addCategory (android. intent. category. VOICE_LAUNCH); intent. putExtra (pkg, packageName);} startActivity (intent );}
Iii. Running Effect