Android-activation of the application details page

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.