How to send data to apple tv app from my iphone - ios

I'd like to know if there is a way to send some data from my iphone to my apple tv.I'll explain:I want to make an app for my apple tv and extend this app to my iphone.Using the extension in running on the iphone you should send some data to my app in running on my apple tv.Sending data it should not be through wi-fi but using for example the bluethoot.How should I do to build this comunication?Can you explain to me how to do or link me some resources?Thanks to all!
Ps. sorry for my english!

The MultipeerConnectivity framework should allow you to do this. It's available in the SDK and supported by both tvOS and iOS.
The advantage is that you don't have to chose what type of connection the devices use. It supports both WiFi and BT. But if you don't want to use WiFi because wifi is not available, it can by default create a peer to peer wifi network between devices.
https://developer.apple.com/reference/multipeerconnectivity
And also, here https://www.hackingwithswift.com/example-code/system/how-to-create-a-peer-to-peer-network-using-the-multipeer-connectivity-framework is a good tutorial.

Related

Does iOS Multipeer connectivity work with non-smartphone devices?

Our guys in the field use equipment that have wifi and Bluetooth connectivity. One of our users has been using a non-iPhone (I guess Android) to transfer files between his phone and the equipment through Bluetooth. However, in switching our users to iPhones to use other enterprise apps we have discovered what some of you already know: iOS's Bluetooth connectivity is severely limited (i.e. no SPP protocol).
The equipment also communicates via wifi, so I was wondering if it's possible to create an app using iOS Multipeer connectivity to solve the Bluetooth problem. All I am finding about this, though, doesn't show anything but phone-to-phone multipeer connections, and not phone-to-machine multipeer connections.
At this point I know nothing about how the field equipment works; that's something I'll have to learn if we decide to pursue this. But assuming that it is capable of discovering wifi networks, would it be able to see the iPhone's network without needing any special software?
Or would I be wasting my time trying to figure this out?
Thanks!
If the equipment is using Bluetooth SPP then unless it is MFi certified you can pretty much forget about connecting to it from iOS. Multipeer connectivity won't do it, that's for sure.
WiFi may be a possibility - you need to get the iPhone and the equipment on the same WiFi network - you can't do this via an app though - you would need to use the WiFi settings in iOS - You will need to learn more about the equipment to see if that is possible.
Short answer: no. Only iOS 7.0+ or MacOS Yosemite+
MultipeerConnectivity is a framework for iOS and Mac OS. To send data using it, you need both devices to have iOS or MacOS with MultipeerConnectivity. You don't have any network-related parameters like "I prefer using bluetooth or wi-fi", it was designed to "just work out of box with simple goal - discover and connect other devices with MultipeerConnectivity.
It means that you can't send data from iPhone with MC to Android or Symbian or old iPhone with iOS <7 etc.
Before iOS7 you could use GameKit, but the logic is the same: both peers need to use GameKit.
If your custom equipment does not have iOS - you need to use lower-level API, and your options include generic Bonjour (NSNetService on iOS device and something Bonjour-compatible on custom device) or CoreBluetooth (obviously bluetooth-only, no wi-fi peer-to-peer) on the lowest level, using sockets and so on.

Test Bluetooth on iOS

I'd really like to start testing my iOS apps Bluetooth capabilities, but have run into a few problems:
I have a device made with a RN-42 module, but it's not the Apple version and I don't have the Apple authentication module at the moment (I ordered it, but shipping from China can take a while). I know what the messages will look like, but can't send them to my iPhone!
I can use the module with my Macbook, but not in the iOS simulator! Apple has taken down all of the documentation related to getting the iOS < 7.0 to use a separate bluetooth dongle, and my efforts have left my 6.1 simulator endlessly spinning on the bluetooth screen.
I'm new to using Bluetooth, so this may be a dumb question...
Is there a way of getting a bluetooth client device (I have a Mac, another iPhone, and an Android tab) to act as a server module that can send (and receive) Bluetooth data to my iPhone?
Client/Server as per developer.bluetooth.org
Thanks!
Not 100% sure your meaning of "server module". But in CoreBluetooth, you can use CBPeripheralManager to broadcast data to other iOS or Mac apps.
https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBPeripheralManager_Class/Reference/CBPeripheralManager.html
If you're using standard Bluetooth (i.e. not Bluetooth LE or Bluetooth Smart or whatever you want to call it), you'll need to enroll in the MFI program or work with an MFI certified device (such as a Redpark cable) and use the External Accessories library provided by Apple. If you're using Bluetooth LE, you can use the Core Bluetooth library provided by Apple. If you fall into neither of those cases, sorry, you can't use Bluetooth on iOS.

Bluetooth connectivity using IOS device

Hi i just want to clarify few things after i went through all the details by googling whole day.
Firstly i want to know Can we list all the devices*(including Android,blackberry etc)*using bluetooth connectivity in our ios device?
If yes how do we do??Once listing out the device can we able to connect to it*(including Android,blackberry etc)* ?According to my knowledge we cant connect to any other device using bluetooth as apple wont support.But is there any way can we connect it?Just for my knowledge purpose.
Secondly i went through framework called BluetoothManager where i saw a sample code where it displays a list of devices when bluetooth is ON, but i didnt see IOS devices listing when we use Bluetooth Manager.
So can anyone tel me For what exactly Bluetooth manager is used for and can we connect with ios device to any other Devices and tranfer files using this Framework?Is it possible?
I know about Gamkekit Framework where it is used to connect between two or more IOS devices.
But i am eager to know Other than Gamekit there are any other way where we can connect to other devices using bluetooth.
Please anyone would tel me regarding would be very helpfull for me and others as well.Looking forward to for the answers.
There are three frameworks available in iOS using which you can develop the bluetooth applications:
GameKit: This is the publicly available framework . But using this you can only establish and communicate between only two iOS device. So this framework having its own limitations .
BluetoothManager: This is private framework .I used this framework to discover the non iOS devices . I have established the connection also . But cant able to do the data exchange. I think it is still under development. For the reference you can refer this link
CoreBluetooth: This is also the public framework. This can only discover BLE enabled devices . I have successfully used this to transfer the data between the BLE enabled devices.

iOS and bluetooth

I want to develop an app which will communicate with devices via bluetooth. I am not able to find any tutorial to help me with this. I don't mean bluetooth 4.0 LE but classic bluetooth. All I have found is CoreBluetooth framework but I think this is only for bluetooth LE. I have found also something like IOBluetooth and IOBluetoothUI but I am not sure if it is for Mac OS or for iOS. But still can't find any tutorial or something to help me understand whole process (discovering, establish connection, communication,...). Can you help me with this?
OK so I just found this article.
According to this article there are 5 ways how to work with Bluetooth:
Enroll MFI program - expensive and long period process
CoreBluetooth framework - works only with Bluetooth 4.0 LE devices
GameKit framework - only for iOS device (two iPhones) so you can't work with other device then with iOS
Private API - app with private API won't be approved by Apple on the Appstore
Jailbreak
It seems there isn't normal official way how to work with bluetooth.
My case: I want to communicate with not iOS device which has bluetooth 2.1 and I want to have it on the app store -> I can use only first one so I am screwed...
You can check out GameKit's bluetooth feature. A basic tutorial here
Also you can check Ray Wenderlich's tutorial which is a bit more enchanced one. Can be found here.

IPhone Bluetooth Connectivity to Non IOS Devices

I was wondering, if there is a way to use IPhone as an HID device, with some other device like PS3. I checked out the Bluetooth specification and IOS Devices do support HID Profile. So I thought it would be easy to pair my iPhone using passkey mechanism and should be able to start using my iPhone as keyboard or mouse without much hassle. But I found very soon that this assumption is naive and I need to develop custom solution.
I was initially thinking about using GameKit framework, but I think it only works between two compatible IOS Devices. If I want to extend this capability, then I have to use iPhone External Accessory API .In my analysis, I also found that iPhone will only communicate and pair with devices that are licensed by Apple. (Made for iPhone\iPod program). Does it mean that, if I want to use iPhone with another device, I need to get that device approved by Apple. ( Which will not surprise me one bit). Also if someone could point me to more detailed documentation on this, that will also be helpful.( What is an MFI developer board ??)
I do not want a solution that needs me to jailbreak an iPhone. (or any solution that will disqualify my app by Apple).
So to summarize:
1- Please validate my findings, correct them if they are wrong?
2a- How does External Accessory API Work?
b- Can I use this to connect to third party accessories ? (or is this only for accessory developers).
3- Or is there a better solution without using External Accessory API?
Please provide supportive documentation or link if you can. Thank You.
You are unlikely to get on the External accessory program from apple unless you are a big company ( you can try, but I have read this a number of places) . iPhones use a proprietary Bluetooth interface that and hardware must also implement this interface, so not much chance of getting it to connect to any other hardware directly.
Most apps like this (Remote Mouse) for example, connect to your wifi network, and have another application installed on your computer. The iphone can then talk to this application over the wi-fi network, but not bluetooth. I would suggest that the only way I can see this would be possible to to create the server app that you install on a computer on the wi-fi network that then in turn controls the 3rd party device if there is an API that you can use from the desktop app to control the 3rd party device.
This is just what I have found when I researched about this for making an app for iPhone to control a bluetooth watch. I had to jailbreak in the end to replace the bluetooth stack on the iPhone with one that could connect to any hardware device. Not limited by apple.

Resources