Sync iOS devices through app over network in Adobe AIR - ios

I would like to take my programming skills to the next level and see if this project is possible with adobe AIR.
I would like to create an app that a teacher can use to administer an exam. The students would be on their own iOS device. The teacher would be able to start the exam from his/her device, and the students will see it start on their device. Also, any information that the students take, like scores and names, would get sent back to get stored on the parent device. Is this possible to code for adobe AIR if all synced devices are on the same network?
I was hoping someone could point me in the right direction and let me know what I have to learn or read up on. I don't know where to start.
Thank you!!
Josh

I think of a few ways to do it:
using bluetooth to connect the devices
pros:
it will work with almost no delay
requires only client-side knowledge
cons:
it will work in close range
it's harder to setup - the 'host' should always create active sessions and connection is somehow unstable
using socket server
pros:
reliable
fast
stable as there is always active session and everyone can connect/disconnect from it
cons:
harder to create (requires backend knowledge)
requires specific server that supports sockets
using http requests
pros:
easy to implement
stable
cons:
huge traffic
requires backend knowledge
In all cases you will need some kind of users level management - which is the host (teacher) and who is a student.
There might be other ways, but these are the most common used. Unfortunately, I must say it's not that easy task to do and I will suggest you to find some backend guy and enjoy the project together.
Good luck!

Related

Best way to broadcast information to Wi-Fi enabled devices?

I live in a building where the laundry machine is a bit far away from my suite. There is only one machine there so only one person can use it at a time. Quite often I take my laundry there just to realize that the machine is in use so I have to go back defeated and try again later. I want to build a doodad that can detect when the machine is in use and broadcast that information throughout the building so that I know that the machine will be available before I go there.
This question is not about how to build the detector. I am planning on using a raspberry pi somehow. This question is about what do I do when I detect that the machine is in use. How do I broadcast that information mainly to myself or potentially to anyone in the building?
I need a cheap solution (< $100). It has to be wireless. The signal has to travel approximately 30 meters in one direction. The broadcast should be readable on any laptop or cell phone (not a requirement but nice to have).
I was considering making an android app using WiFi direct. I'm sure others in the building would be interested in this app and I can use them as peers to extend the range of the broadcast. But I don't like this solution because I know that wifi direct doesn't work with iOS devices. Also this solution will require others to side-load an apk which they might not know how to do.
Please let me know if you can come up with something a bit less reliant on p2p and more platform independent.

iOS to iOS device connection through streams (over IP-Address)

As a final school-graduation project I try to develop a kind of spying-car. Which means there is an iPhone placed on a little LEGO-car and an iPad used as a "steering wheel" for the car. Also it is planned to transmit Audio and Video from the iPhone's microphone/camera to the iPad (more than the steering data vice versa).
In the first place the connection from iOS to iOS should be established over a local WiFi network and later - if possible - over 3G (by using the iOS devices network-IP and a DNS server to deal with frequently changing addresses).
My question is: which technology do you recommend using? I read about GameKit, peer-to-peer and so on, but I think these technologies are too abstract for later being able to communicate over 3G. I guess I need to go a little deeper into the low levels of the communication progress. Any suggestion that could bring me a step forward is highly appreciated! (also regarding other parts of my project)
One more thing: Some user suggested using a third party service and to route the sent (video) data over an external server. If possible, I'd rather not use any "middle man". It should just be a basic server-client communication where the iPad is the server and the iPhone the client.
It is kind of an open ended question, but interesting.
First of all, GameKit do have 3g p2p support, see here:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Matchmaking/Matchmaking.html
It will handle the peer-to-peer addressing and establisment of the socket. It can also handle voice chat, but I personally never tried this feature so I can't say if it is feasible in your case.
One idea is to leverage existing video-chat services. This will give you a low-latency audio/video channel with peer-to-peer addressing (well, likely using a central server).
Apple's FaceTime is such a service, but there is no public API to it (AFAIK). Same goes for Skype and Google.
There are some paid services that look like they have nice iOS APIs:
http://tokbox.com/platform
http://docs.weemo.com/sdk/ios/
You have to figure out a way to transmit control commands to the peer iPhone, I did not see if the services above had any possibility of sending text messages/arbitrary data.
Tokbox has a free trial so you could try it out and see if it works for you.
I would go for GameKit if this is a hobby project on a budget and there is time for hacking, and probably look into a more high-level API if there is a deadline...
sorry for writing this as an answer, but i don't have enough rep to comment...
i'm working on a similar project and i currently don't have any advice regrading video-streaming, however, from what i read (extensively) i came to the conclusion that i need to use p2p connection between devices for better performance and use socket programming in order to achieve this (although not the most easy to implement choice).
I considered using GameKit which i think will probably answer most of your needs as Krumelur pointed out. but in my case, eventually the app will be cross platform so i had to use low level network programming. you can check out my question here to see the sources i used to try and make the connection between 2 peers, hopefully you'll have better luck than me...

How Does Spaceteam Work?

For those not in the know, Spaceteam is a very popular and very fun multiplayer game for iOS.
It allows for real time gameplay among multiple devices on an ad-hoc Wifi network - how does it do this?
Are there published libraries describing how to build protocols on top of ad-hoc networking libraries? Is it iOS specific, or would it be possible to build a variety of applications across different platforms?
Quickly, answer before we hit the asteroid!
Specifically which aspect are you interested in? There's nothing particularly special about mobile devices or ad hoc Wi-Fi networks (except in an ad hoc network, not all devices may be able to communicate with each other, so some mesh networking can help but unnecessarily complicates matters for the normal case).
I'll answer the broader question first, because it's more interesting. In my experience, there are a handful of major considerations:
Server/client or peer-to-peer? By this I mean whether there's a "master" deciding the true state of the world and communicating this to all clients. Avara is the only game I know of that is "peer-to-peer" in this sense (peers sent commands to all other peers; this proved bandwidth-heavy for modem users on 6-player games). I am not aware of games using more sophisticated network topologies to communicate game state (e.g. only sending data to one client on each LAN).
What do you do about latency? Avara is the only game I know of which lags everyone locally by the "latency tolerance" in order to get a consistent state of the world, which was terrible if someone was on a modem (turning off compression helped a lot). There are various ways to do "latency compensation" (e.g. in Half-Life/CS), some of which could also work on peer-to-peer games.
Time sync? For client-server games, you at least need to worry about a changing RTT. For peer-to-peer games, I think you also want to agree on timing that minimizes the effective maximum latency.
What if clients disagree about the state of the world? Avara just lets peers decide on their own state of the world (and displays "reality fragmentation detected" if it senses a mismatch, which might happen due to dropped packets or a too-low "latency tolerance").
What if a player leaves? For a P2P game, you might have to agree on a consistent game state (e.g. if the player was disconnected after sending commands to a subset of other peers). For a client-server game, you might have to elect a new master.
And now, after watching the Spaceteam trailer:
I have no idea how it works, since I haven't reverse-engineered the protocol. However, it's pretty simple to make something that works well enough:
Use some sort of P2P discovery to find players (e.g. Bonjour; there should be plenty of docs and samples out there).
Communicate with peers. I've done this with GameKit circa iOS 3/4 (I'm not sure if it still works over Wi-Fi).
Elect a master. This can be as simple as whoever presses "ready" last attempts to be the master. In some edge cases you might have to handle failure.
Let the master decide everything. Spaceteam is not latency-sensitive; Wi-Fi latency tends to be at most a handful of milliseconds, and nobody's really going to notice if one device is slower by 100 ms (as long as the UI responds fast enough).
There is a library made by Spaceteam that does this for Unity games.
https://github.com/hengineer/CaptainsMess
The creator of Spaceteam also wrote an old blog post about Networking in Spaceteam
http://spaceteamadmirals.club/blog/the-spaceteam-networking-post/
There is an iOS only library that will connect nearby devices easily called MultipeerConnectivity https://developer.apple.com/documentation/multipeerconnectivity
If you want something that will work cross-platform I have an example app here: https://github.com/brendaninnis/LocalNetworkingApp, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

Getting started - creating an iPhone app that controls another (non-iOS) device via bluetooth commands

All,
Apologies in advance - this question might be too open-ended for SO.
Anyway... A friend of mine (an engineer and entrepreneur) is in the process of building a high-tech piece of lab equipment. He's asked me about the feasibility of building an iPhone/iPad/iPod application that would allow users to control the device via Bluetooth, so I'm helping him gather some information. I'm hoping to get a few pointers on how to get started. Specifically:
Would this require a native app, or could this be accomplished with HTML5 (with or without something like PhoneGap?)
Can you point me to a good primer on bluetooth networking? Everything I've found assumed a VERY high level of pre-existing knowledge.
What are the basics on how something like this is accomplished? Is there a single, established protocol for how one device "controls" another, or is bluetooth more like SSL - just a pipe that allows you to convey any type of message?
I realize this question is incredibly broad and detailed - so I'm not really looking for specifics. But obvious Google searches don't turn up much, and I'm otherwise having a hard time finding a good starting point.
Thanks in advance.
You can communicate via bluetooth in two ways: One is using the Low Energy Bluetooth capabilities of iOS 5 and newer iPhone/ipads.
https://developer.apple.com/library/ios/#documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/_index.html#//apple_ref/doc/uid/TP40011295
Unfortunately the documentation is sparse and will require some hacking away. If you choose this route I would consider starting here and learning as much as you can about how the protocols work before hacking into the framework:
http://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
The limitations of this route are that it might not be best for sending a lot of data. I have only built stuff that sent simple commands which it does work great for.
The other option is the external accessory framework. This will require you to get an mfi license from apple (not fun). You will also need to pay royalties. But it will do what you want. You won't need to concern yourself much with underlying protocols if you use this, the framework provides a friendly api for processing streams.
http://developer.apple.com/library/ios/#documentation/ExternalAccessory/Reference/ExternalAccessoryFrameworkReference/_index.html

How to write a software to sync files to ipad

I have this idea of writing an application to automatically sync files to a specific place for an ipad every time the ipad is plugged in the computer.
The problem is I've never developed a software like this before. Right now I have these two big questions:
- How to detect when an ipad is plugged in the computer?
- How to connect to and copy files over the ipad?
To make things clear, the application I want to develop should have similar functions like iTools (not iTunes).
Does anyone here have experiences in developing this kind of application? Would you please share with me how to start with this project, because I'm clueless :(
There is a rather simple option; use a internet based service to accomplish this task - just as DropBox, iCloud and similar services do it already. Maybe you can get a lot closer to your goals by simply connecting to the API of DropBox, SugarSync or alike.
Using a direct (USB-) connection to the device will be rather tough to implement and, to my knowledge, will prevent you from selling the resulting software through Apple's channels. I am not saying that it was impossible (see iExplorer) but I am saying that such endeavor will involve a lot of reverse engineering of undocumented functions to a degree that might be considered illegal in certain countries. Additionally, maintaining such software will be very demanding as Apple frequently introduces changes within their communication protocol/s.

Resources