Android4.4 get the SMS application package name that meets the default SMS Application Requirements

Source: Internet
Author: User

Android 4.4 has an update, and the text message mechanism change is a major event in the update.

How can I make the text message application apply to a blog on the official website of 4.4 that has been translated and reprinted N times? I will post a link to it. 4.4 text message application changes


Here I am not going to explain how to set up the text message application. The following is a small demand, it is how to switch the default text message application to another application in your own application (or let the user select the default text message application in your own app, you don't have to go to "more than" in the settings to find the things and choose again)


The idea of setting the default SMS application is to get the information of the application that meets the requirements -- get the package name of these applications -- set the default SMS application according to the package name


The first two steps are the key, and the third step can refer to the above 4.4 SMS application changes


This method is not perfect. You can perform further screening based on the features of 4.4 default SMS.


The Code is as follows:

/*** Get the default SMS application package name array * @ return */private String [] getSmsApps () {PackageManager pm = this. getPackageManager (); Intent intent = new Intent (); intent. setAction ("android. provider. telephony. SMS_DELIVER "); List
 
  
Receivers = pm. queryBroadcastReceivers (intent, PackageManager. GET_INTENT_FILTERS); String [] result = new String [receivers. size ()]; for (int I = 0; I <receivers. size (); I ++) {result [I] = receivers. get (I ). activityInfo. packageName;} return result ;}
 




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.