Is it possible to programmatically enable hotspot mode in iPhone? - iphone

I want to develop an application that programmatically creates a Personal Hotspot with a predefined name on an iPhone.
Is it possible?

You can't create a HotSpot in code talking via an API or via a Configuration Profile
Have you looked at GameKit which does a great job of easing connecting devices transparently via Bluetooth or WiFi? Don't let the "Game" name fool you - it's a great and easy to use library.

If you're willing to put the time and work in to build it, sure.
However, you can only do it for jailbroken phones, and you would need to interface the private API:s. If you still want to do it, a starting point could be to go through the private API:s documented here: https://github.com/nst/iOS-Runtime-Headers

Related

Communication between two iOS devices

I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?
Thanks for the help.
You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.
You communicate by creating an ad-hoc bluetooth or local wireless network.
lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.
See the link or download the sample application from developer.apple
The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.
If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity
If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.
Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp
, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

Make use of external hardware Music controls in my custom App

I'm looking for a way to detect the buttons pressed of external music control buttons, I have integrated in my car via bluetooth. Is it possible to make use of them in my App for something else that playing and stoping music?
Thanks a lot!
Markus
Those controls are probably talking to your iPhone using the remote control lingo, part of iAP (iPod Accessory Protocol). For documentation on this, you need to join Apple's MFi program, which is a separate account to a normal developer account and quite a bit more difficult to get approved for.
I'm not certain whether it's possible to get your application to talk to those devices, as you need to specifically enable application communication on the device itself and there's an authentication scheme you need to handle.

Is there a way to toggle wifi on and off programmatically in iOS?

I done it for Bluetooth using the code on this link:
Is there a way to toggle bluetooth and/or wifi on and off programmatically in iOS?
But I couldn't figure out how to do the same for Wifi. How do you switch the Wifi on/off? Is it possible?
It's definitely not possible to turn WiFi off or on with any public (documented) API.
It might be possible to achieve this even on a non-jailbroken device using private functions.
See Apple80211Functions - there is a private function called Apple80211SetPower which is a good candidate for this job. But using it would be also interfering with automatic TX power settings - could result in either increased battery usage or decreased WiFi link quality (or both).
Of course your app would most definitely not pass App Store approval using this.
You can see how Apple80211 functions can be used if you download Stumbler source.
Stumbler SVN checkout is done by:
svn checkout http://iphone-wireless.googlecode.com/svn/trunk/ iphone-wireless-read-only
There are also two other projects that might help you start with low-level WiFi functions:
web-login-helper
BECHA
I'm fairly certain that the SDK does not allow access to turning Wifi on or off using the public framework, sorry. You could use a private framework but then you won't get your app past Apple, I suspect.
In iOs 2.x you can use some private API to do this, however it does not work in iOS4.x, 5.x. Hope that Apple will public the API for manage Wifi, now it is only used by Setting apple app.

How to create a Mac/PC server app that interacts with iPhone/iPad App?

Can someone please point me in the right direction to create a Mac/PC server app that runs in the background and connects to an iPad app over the local WiFi network?
No matter how I phrase a search on Google it just brings up various apps like Remote Mouse and whatnot and no tutorials or even a hint of where to start.
I just need to send simple commands from iPad to computer over local wifi. A point in the right direction and I can likely fill in the blanks.
Thank you.
Thomas
EDIT: I am using web languages for the iPad version that I will build as a native app using open source tools.
OK, then. It actually depends on what you really need. I made the assumption you need real-time and perhaps binary data transfer.
Your best bet is to write your server application using standard C or C++ so it compiles on both as simply as possible.
If you want to avoid all the burden of writing a protocol for service discovery or asking users to enter the ip address of your server you will use a mDNS implementation for your server and your iPhone app.
If I were you I would try bonjour: http://www.apple.com/support/bonjour/
on iPhone You could start here: http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html
Once you have your sockets you will have to implement a networking protocol between your server application and your iPhone app.
You will have to be careful about byte ordering and little subtle problems with latency, disconnections and other problems inherent to networking and WiFi.
In windows you will want to register your application as a service and in Mac OS X/UNIX you'll probably want to deamonize it.
Good luck!

setting up iPhone P2P only over bluetooth and without GKPeerPickerController

I want to use a custom interface to connect with other iDevices in a p2p game. I know I can either use GKSession and GKSessionDelegate or use the lower level Bonjour browsing. But both of them will search for devices both over bluetooth AND wifi.
I want to list only bluetooth devices. I know this was answered in the past as impossible, but the Flight Control app seems to be able to do it.
I thought I would answer to let you know that YOU ARE NOT ALONE, I am trying to do the same thing and it is kicking my butt! This link might help you:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/40710-gamekit-api.html
I am trying to setup a server/client relationship and that requires me to use my own custom interface too.