iOS get phone status IDFA IDFV network type resolution get carrier

Source: Internet
Author: User

Idfa

[[[Asidentifiermanager Sharedmanager] advertisingidentifier] uuidstring];


Idfv

[[[Uidevice Currentdevice] Identifierforvendor] uuidstring];




Network type

-(NSString *) getnet

{

UIApplication *application = [UIApplication sharedapplication];

Nsarray *subviews = [[[Application Valueforkey:@ "StatusBar"] valueforkey:@ "Foregroundview"]subviews];

NSNumber *datanetworkitemview = nil;

For (ID subView in subviews) {

if ([SubView iskindofclass:[nsclassfromstring (@ "Uistatusbardatanetworkitemview") class]) {

Datanetworkitemview = SubView;

Break

}

}

switch ([[Datanetworkitemview valueforkey:@ "Datanetworktype"] integervalue]) {

Case 0:

NSLog (@ "No WiFi or cellular");

return @ "NULL";

Break

Case 1:

NSLog (@ "2G");

return @ "2G";

Break

Case 2:

NSLog (@ "3G");

return @ "3G";

Break

Default

NSLog (@ "Wifi");

return @ "Wifi";

Break

}

return @ "NULL";

}


Resolution

-(NSString *) GETFBL

{

Screen size

CGRect rect = [[UIScreen mainscreen] bounds];

Cgsize size = rect.size;

CGFloat width = size.width;

CGFloat height = size.height;

NSLog (@ "Print%f,%f", width, height);

Resolution

CGFloat scale_screen = [UIScreen mainscreen].scale;


return [NSString stringwithformat:@ "%d*%d", (int) (width * scale_screen), (int) (height * scale_screen)];


}


Get Carrier

-(NSString *) getop

{

NSString * ret = @ "";

Cttelephonynetworkinfo *info = [[Cttelephonynetworkinfo alloc] init];

Ctcarrier *carrier = [info subscribercellularprovider];

if (carrier = = nil)

{

[Info release];

return @ "NULL1";

}

NSString *code = [Carrier Mobilenetworkcode];

if (code = = nil)

{

[Info release];

return @ "Null2";

}

if ([code isequaltostring:@ "00"] | | [Code isequaltostring:@ "02"] | | [Code isequaltostring:@ "07"])

{

ret = @ "China Mobile";

}

if ([Code isequaltostring:@ "01"] | | [Code isequaltostring:@ "06"])

{

ret = @ "China Unicom";

}

if ([Code isequaltostring:@ "03"] | | [Code isequaltostring:@ "05"])

{

ret = @ "China Telecom";

}

if ([Code isequaltostring:@ "20"])

{

ret = @ "China Tietong";

}

[Info release];

return ret;

}


This article is from the "accompany you through the Long Years" blog, please be sure to keep this source http://4774721.blog.51cto.com/4764721/1792324

iOS get phone status IDFA IDFV network type resolution get carrier

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.