ios - How NEHotspotHelper choose the helper? -
in apple's document hotspot, means system choose 1 app hotspot helper.
are there rule whitch app choosen ? there 2 apps named qqdoctor , myapp in device. 1 wifi ap, many times qqdoctor choosen, not myapp. has high possibility qqdoctor choosen.
qqdoctor(15 times choosen), myapp(5 times choosen).
(in concept,it may has same possibility whitch app choosen, not!)
this code:
-(void)registerhotspot{ nsinteger s_count = 0; if ([[[uidevice currentdevice] systemversion] floatvalue] >= 9.0f) { nsdictionary * option = nil; if ([sgvconfig shareinstance].hotspotdisplayname) { option = @{knehotspothelperoptiondisplayname: [sgvconfig shareinstance].hotspotdisplayname}; } // dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_high, 0); dispatch_queue_t queue = dispatch_queue_create("com.dj.sdk.hotspot", dispatch_queue_concurrent); // dispatch_queue_t queue = dispatch_get_main_queue(); bool result = [nehotspothelper registerwithoptions:option queue:queue handler:^(nehotspothelpercommand * _nonnull cmd) { switch (cmd.commandtype) { case knehotspothelpercommandtypefilterscanlist:{ [self addlocalnotification:@"scanlist list"]; nsmutablearray *networklist = [nsmutablearray arraywithcapacity:cmd.networklist.count]; (nehotspotnetwork *network in cmd.networklist) { //if(sameconditionasqqdoctor){ [network setconfidence:knehotspothelperconfidencehigh]; [networklist addobject:network]; //} } if (networklist.count > 0) { nehotspothelperresponse *response = [cmd createresponse:knehotspothelperresultsuccess]; [response setnetworklist:networklist]; [response deliver]; }else{ nehotspothelperresponse *response = [cmd createresponse:knehotspothelperresultsuccess]; [response deliver]; } } break; case knehotspothelpercommandtypeevaluate:{ [self addlocalnotification:@"evaluate app"]; nsarray *array = [nehotspothelper supportednetworkinterfaces]; nehotspotnetwork *connectednetwork = [array lastobject]; nehotspothelperresponse *response = [cmd createresponse:knehotspothelperresultsuccess]; [connectednetwork setconfidence:knehotspothelperconfidencehigh]; [response setnetwork:connectednetwork]; [response deliver]; } break; case knehotspothelpercommandtypeauthenticate:{ [self addlocalnotification:@"be choosen , auth"]; nehotspothelperresponse *response = [cmd createresponse:knehotspothelperresultsuccess]; [response deliver]; } break; case knehotspothelpercommandtypepresentui:{ } break; case knehotspothelpercommandtypemaintain:{ [self addlocalnotification:@"has choosen before"]; nehotspothelperresponse *response = [cmd createresponse:knehotspothelperresultsuccess]; [response deliver]; } break; case knehotspothelpercommandtypelogoff:{ nehotspothelperresponse *response = [cmd createresponse:knehotspothelperresultsuccess]; [response deliver]; } break; default:{ } } }]; } }
Comments
Post a Comment