Common minor functions of android (version 2)

Source: Internet
Author: User

After a period of time, half a year has passed, and the second version of the small features have been sorted out and promised to be released. Until today, we finally met you. The second version does not have many first versions, you can also refer to the content of the first version. I hope you can enjoy it!

Directory:

1. Get the current mobile phone number

2. Check for Network Connections

3. get request network data

4. Get ctwap or ctnet?

5. Get the IMSI code of the mobile phone?

6. determine the current network connection status?

7. Convert the string into ascii code

8. Call the System Browser 9. determine the current mobile phone carrier

10. Determine the installation status of the application on the mobile phone

11. convert long type to byte array

 

1. Obtain the current mobile phone number

 

        = (TelephonyManager) =

 

 

 

2. check whether there is a network connection

 = (ConnectivityManager) = (info !=  &&                          

3. get request network data

 = = = client.execute(get);             

Obtain the signature information of a program.

=<PackageInfo> apps =<PackageInfo> iter === packageinfo.signatures[0, packageinfo.signatures[0 packageinfo.signatures[0 
The returned signature is a long string of data.

4. Get ctwap or ctnet?

      String CTWAP="ctwap"  String CTNET="ctnet"  Uri PREFERRED_APN_URI ="content://telephony/carriers/preferapn"= "nomatch"= context.getContentResolver().query(PREFERRED_APN_URI, , , = c.getString(c.getColumnIndex("apn"= =

5. Get the IMSI code of the mobile phone?

                TelephonyManager telManager="-----"+telManager.getSubscriberId());                 System.out.println("-----"+telManager.getSimSerialNumber());                 System.out.println("-----"+"-----"+"-----"+"-----"+telManager.getSimState());

6. determine the current network connection status?

              ="connectivity" (networkInfo !=  

7. convert a string to an Ascii code?

String toHexUtil (= "" 10: rt + = "A"; 11: rt + = "B"; 12: rt + = "C"; 13: rt + = "D"; 14: rt + = "E"; 15: rt + = "F "; + = String toHex (= (n/16 = 0 = toHex (n/16 nn = n % 16 = [] bs = (I = 0; I <bs. length; I ++ = "xyz" "The converted string is:" +

8. Call the System Browser

                         Intent intent= "android.intent.action.VIEW"=

9. determine the current mobile phone operator

TelephonyManager telManager ==( imsi! = (Imsi. startsWith ("46000") | imsi. startsWith ("46002" Toast. makeText (getApplicationContext (), "the current mobile number has been sent", 0 = (imsi. startsWith ("46001") {"the current Unicom number has been sent", 0 = (imsi. startsWith ("46003") {Toast. makeText (getApplicationContext (), "the current telecom number has been sent", 0 = Constants. sendNumber_JT ;}

10. determine the application installation status on the mobile phone

     <PackageInfo> pakageinfos ==  

11. Convert the long type into a byte array

* @*/      [] long2Bytes([] bytes =  [8 i = 8(= ()(l & 0xff--i] =>>= 8

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.