Install a description file to obtain the device's udid on the console.

Source: Internet
Author: User

Install a description file to obtain the device's udid on the console.

In my blog this explains how to get the device udid locally, but you can only get the http://www.cnblogs.com/liyy2015/p/6090204.html in the simulator

Of course, you can integrate Apple's MDM on the device to get a lot of device information. If you just want to get a udid, it is unnecessary to integrate the troublesome mdm.

Here, let your mobile phone install a description file to obtain the mobile phone's udid on the console.

First, you need to create a file with the suffix ". mobileconifg". The file is actually an XML file and can be downloaded here.

 

 

You need to modify the above two places. The first one is your background URL. When the description file is installed, a request will be sent to this URL to obtain the device information in the URL get request.

The second is the device information you requested, such as UDID and Version.

Console code. Here is the java code implementation. an XML file is output, and the device information can be obtained by parsing the file.

 

Response. setContentType ("text/html; charset = UTF-8 ");

Request. setCharacterEncoding ("UTF-8 ");

// Obtain the input stream of the HTTP request

InputStream is = request. getInputStream ();

// A BufferedReader object has been created for the input stream in the HTTP request.

BufferedReader br = new BufferedReader (new InputStreamReader (is, "UTF-8 "));

StringBuilder sb = new StringBuilder ();

// Read the HTTP request content

String buffer = null;

While (buffer = br. readLine ())! = Null ){

Sb. append (buffer );

}

String content = sb. toString (). substring (sb. toString (). indexOf ("<? Xml "), sb. toString (). indexOf (" </plist> ") + 8 );

System. out. println (content );

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.