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 );