ios - How to make gamekit connection without needing both peers to press the same button -
i'm trying develop app send details of contact device. can connect 2 devices if same button on both devices pressed.
my question is: can use gamekit make app listen devices in background listening device doesn't have press button allow searching device find it. basically:
searching device(x): presses button -> finds other device
listening device(y): device x connect you. (without needing press button make visible)
well, i'm not sure i'm understanding question completely, can make app visible setting 'available' property of gksession object true.
gksession *session = [[gksession alloc] initwithsessionid:@"myapp" displayname:@"name" sessionmode:gksessionmodepeer]; session.delegate = self; [session setdatareceivehandler:self withcontext:null]; session.available = yes;
or maybe you're using gkpicker set connections, , referring modal window says "xx wants connect"?
it possible silently auto-accept incoming connections. take @ gksessiondelegate protocol.
basically, do:
- (void)session:(gksession *)session didreceiveconnectionrequestfrompeer:(nsstring *)peerid { nserror *err; if (![session acceptconnectionfrompeer:peerid error:&err]) //deal error }
Comments
Post a Comment