I have an iPhone 4s and an iPad 2 which should be able to establish a connection via bluetooth.
Bluetooth is activated on both devices, and both are scanning for other devices, but none of them shows up on the other one.
If i turn on the personal hotspot on the iPhone, both devices find each other.
Sadly, this is not a solution for me, because I´m writing an app which should establish the connection (using GameKit), so the user must not be forced to activate the personal hotspot before using the app.
So my question is: Is there anything I am missing, to make both iOS devices see each other without using the personal hotspot function?
Any help is appreciated!
iPad 2 is NOT supporting BLE 4.0 and it has different hardware module for bluetooth. Maybe that's the main problem.
Make sure the session id in both is the same, or they will not find each other.
- (GKSession *)peerPickerController:(GKPeerPickerController *)picker sessionForConnectionType: (GKPeerPickerConnectionType)type{
GKSession* session = [[GKSession alloc] initWithSessionID:#"com.cilk.id" displayName:nil sessionMode:GKSessionModePeer];
return [session autorelease];
}
Related
In my iOS app, I want to detect all available wifi networks and then choose one network form the list and connect to it. The goal is to not open the Settings built in app to connect to a wifi, but to do it all in my app.
First, is this possible? If possible, please point me to what framework(s) and methods to use.
I have looked at the Reachability example, but that doesn't work for me because, I think, all it does is monitor the network state of the device.
I also looked at the Captive Network Support framework, and used the CNCopySupportedInterfaces function:
CFArrayRef allWifiNetworks = CNCopySupportedInterfaces();
NSLog(#"%#", allWifiNetworks);
but all I am seeing is the current wifi network that the device is connected to.
Thanks
I'm pretty sure you can't do this, at least not if you want to be able to publish on the App Store.
I'm trying to implement GameKit connection without using GKPeerPickerController. What i need is to establish WiFi connection, not bluetooth.
This is how i do that
self.gameSession = [[GKSession alloc] initWithSessionID:#"test" displayName:nil sessionMode:GKSessionModePeer];
self.gameSession.available = YES;
self.gameSession.delegate = self;
self.gameSession.disconnectTimeout = 0;
[self.gameSession setDataReceiveHandler:self withContext:nil];
My problem is that devices always try to connect over Bluetooth. At least i think so cause the following always appears in the console
BTM: attaching to BTServer
Even if i turn bluetooth off it always tries to deal with bluetooth, not wifi. Moreover - if bluetooth is on - devices never see each other if i don't use GKPeerPickerController.
Also, simulator never tries to look for bluetooth and is always able to establish wifi connection and find any device easily. How do i make GKSession choose WiFi connection?
May be your issue arising with Jailbroken Device,
GKSession and GKSessionDelegate implementations works for both bluetooth and WiFi.
these two class checks wifi and bluetooth, and choose an appropriate transmission medium.
If your iPhone is Jailbroken, then there might be some issues with BlueTooth or wifi while connecting over those transmission medium, and possibly that is prevent to Work with gamekit Properly.
And also try to use
picker.connectionTypesMask = GKPeerPickerConnectionTypeOnline
check with Condition in Delegate methods
if (type == GKPeerPickerConnectionTypeOnline) {
}
Update :
Refer this sample code of Apple..
https://developer.apple.com/library/ios/#samplecode/GKTapper/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010283
How could I set the ios devices' (iphone & ipad) bluetooth visible for other ios devices when turn the bluetooth on?
I just want to get and show all the ios devices' name (MFI devices include) nearby in my app when all devices' bluetooth on, and I also want to get devices' deviceID.
I have succed using GameKit.framework to connect two ios devices by using bluetooth, but this requires the two devices run that app together.
Could some one provide me suggest on how to implement it? Thank you very much!
i my self have not worked on it, i know its not good to give link here.But hope these links will get u to start on your-self:
http://www.touchthatfruit.com/ios-bluetooth-development-tutorial-using-game
http://vivianaranha.com/apple-gamekit-bluetooth-integration-tutorial/
http://www.devx.com/wireless/Article/43502/0/page/1
http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html
happy to help
I'm not exactly sure what you are asking. Setting a device's bluetooth on is not enough. A device needs to be advertising for peers to detected it. I think this might be related to what you are trying to do: http://www.ralfebert.de/tutorials/ios-swift-multipeer-connectivity/.
I tried this tutorial and it was very helpful. It uses Multipeer Connectivity to advertise and browse for peers around. It also displays the deviceID of devices around you.
I'm working on test automation for an app. I'm looking for a way to automate connectivity tests. For that I need to be able to toggle 3G and wifi. I've been going through the private api headers but I haven't found a method that would scream 'I do that!'.
Can anyone point me in the right direction, please?
I can't see this being possible. The iPhone 4 has a setting for 3g on or off in iOS 5, but the iPhone 4s doesn't. If it was possible to turn off 3g in the iPhone 4s I think Apple would have retained that ability in iOS 5.
I assume you've seen the reachability sample code
Thinking about this laterally, iOS connects to known WiFi hotspots when available - so you don't necessarily have to run this on the phone. You could just toggle your WiFi hotspot which you're connecting to on/off, and iOS should automatically switch (as long as any other known WiFi access points aren't in range) to 3G and WiFi respectively.
I'm trying to develop an iPhone application which uses the geolocation libraries. Is this feasible for the iphone simulator to simulate the GPS functionality without the use of my PC's Wi-Fi infrastructure? Does anyone know if the iphone simulator can spot your location using your IP-address only (so only the Ethernet cable connection is required)?
Thanks in advance.
You should test that functionality on an actual device. I believe the simulator will always show Cupertino, CA as the location.
No it won't work using ethernet. Core location appears to only work with WIFI even though at the end is the same router.
CoreLocation doesn't work in the simulator, but there are options
http://github.com/futuretap/FTLocationSimulator
Simulator doesn't have this functionality, but iSimulate has (it's not mine :-( ). It connects the device and simulator per WiFi and sends location events to the application within simulator: real GPS events and a few predefined locations around the world. Pretty cool!