I am looking at device to device communications and need some direction.
I have a series of applications that will need to update each other with information, or simply tell each other there is a new dataset that is ready to be read and updated on the local machine.
I was thinking about using something out of the gamekit, but I want to know if this is the best approach.
Currently, I have a few iPads in a doctors office, everything is working OK, but the doctors are not seeing updates between devices when a user makes an update to the same patient, I need the other devices that are looking at the same patient to be updated/notified there are changes, and I can reload the data from the database.
Each device belongs to a practice, and I have the MAC addresses of each device.
Yes, Game Kit is the way to go. Game Kit will handle almost everything for you.
Related
I'm writing an iPhone and Watch app. I'm planning on supporting the ability to pair multiple watches to the phone.
The iPhone and Watch app will both read and write to a Core Data datastore, and I'll use WatchConnectivity to keep them in sync (using transferUserInfo:). The user will write/dictate something on one device, and it will appear on the other.
I'm struggling to figure out how to support multiple watches. Given the following scenario:
User is using Phone/WatchA
Over the course of the day, user adds 10 items
End of the day, they switch to WatchB
How will WatchB get in sync with the Phone/WatchA?
Will WKSession automatically replay the transferUserInfo calls that were made when WatchA was paired?
Do I need to somehow keep track of everything WatchB needs and replay everything myself?
Do I just send the entire sqlite database using the transferFile API (that seems a bit much)?
Will WKSession automatically replay the transferUserInfo calls that were made when WatchA was paired?
No it won't. The data only gets transferred to the paired watch.
When you switch back to the other watch, you'd have to specifically arrange to update its store.
Do I need to somehow keep track of everything WatchB needs and replay everything myself?
In short, yes, if that's the approach that you take.
One edge case would be if the user replaces an old/broken watch with a new/replacement watch, yet didn't unpair the old one. You wouldn't want to keep track of a growing number of changes for a watch that won't ever be paired again.
You'd also have to handle the case where the user upgrades their phone, and pairs the existing watches with the new phone. Your device tracking and syncing should continue to work across a different device pair.
Do I just send the entire sqlite database using the fileTransfer API (that seems a bit much)?
It really depends on the size of the database, versus the complexity of journaling and syncing data between three or more stores.
What new features would help me keep my watch up to date?
If you must maintain multiple stores, you should definitely take advantage of the background refresh task feature in watchOS 3 to keep your watch(es) up-to-date before the user launches the app, so the user won't have to wait for anything to sync.
This answer might be helpful, even if you aren't using complications.
What are my other options?
Apple recommends that you design everything around the different ways of interacting with the devices. A user might just want to glance at the watch for a couple of seconds to review some items, but rely on the phone for more complex tasks.
In that case, you could maintain a single store on the iPhone, and transfer any needed data from the iPhone to be displayed on the watch. If anything changes, push the updated data back to the phone.
A "Handoff" approach works best, where the phone and the watch know what the most recent items were, and the user can switch between the phone and the watch during the day.
Of course, this is contingent on whether the watch must operate independently or not while out-of-range of the phone.
This comes close to an opinion question, but I hope that someone can give a definitive answer.
I have written a game app and I save game data locally. But I also will want it to be cloud capable and I am currently writing the code but I keep hitting a mental barrier. In several places in the iCloud and Game Center documentation it says if I change Apple ID, I need to delete the local save game data/file cache. This is contrary to how my app currently works, which is OK if I can figure out the right way to do it. In the ICloud documentation it says to either user the cloud or don't use the cloud and only ask once, but there is a button in the settings to turn the iCloud Drive on and off.
The core of my dilemma seems to be that an IOS device is not tightly linked to one Apple ID. I understand that multiple devices can be associated with one Apple ID, but not why it should be true the other way around.
This can be seen as either added capability or enough rope to hang oneself. As a user I can, using my Apple ID, get on to another device not associated with my Apple ID and:
download an App/Song
log into Game Center and play a game we both own.
etc.
I know Apple deals with this and now I have to do the same.
As App Developer I see a world of questions about what this might mean, like "Well I'll do this or that but what do I do the first time this other thing happens?", etc.
For example, initially I thought I could consider "local" store the same as a very long airplane mode, and when the cloud became available I could sync the delta to the cloud and across devices, but this does not address changing Apple ID. Do I blow away the local data, keep the new user from playing the game, only allow local or cloud but not both?
Now Apple is adding Multitasking, and a login to iPad's used in schools, the problems become even worse.
I keep trying to find some profundity that will steer me to the correct answer but I am at a loss on how to deal with Apple ID changes.
I'm using GameKit peer-to-peer connection in my app and I'm experiencing the following issue: when using GKPeerPickerController sometimes it takes too long time to deliver an invitation to connect from one device to another. Sometimes devices just don't see each other. What can i do about that? Is it better not to use GKPeerPickerController at all and present custom interface?
Depending on the type of app you are trying to make, it may be more beneficial for you to have one device act as a Server and another as a Client. I've noticed from personal experience that having both devices act as Peers can take considerably longer, or just flat out not work.
The only disadvantage with the Server / Client perspective is that your users will have to specifically choose one or the other, and you will have to create your own user interface. But if you can work with that then you'll probably get better results. Good luck!
Building a multi player iOS game where players compete one against the other. Nature of the game is synchronous. Basically, players either invite each other through facebook, email, etc and then start playing.
We debate what is the best strategy for facilitating the real time communication between players (sending events, etc). Coming from web development, we used comet and long polling which worked great. However, it's not clear what's the best way to achieve that on iOS.
Seems like APN (Apple Push Notifications) is not suitable in our case for two reasons: the delay can be pretty significant, up to few seconds, as far as we understand. Also, using APN requires the user to authorize notifications. If the user doesn't authorize this then it won't be possible to play the game.
Also, we understand Apple's Game Kit (Game Center) can be of value in our case however it's not clear how it interacts with invites through facebook etc. Also, not clear if we need to get into bed with Apple's Game Center and how it'll affect the user experience.
Any guidance on this matter as well as other options that you might think of would be greatly appreciated.
Thanks for your help.
Before you read the rest, a disclaimer: I work for Realtime.co but I do believe I can help here so I'm not trying to "pitch a sale".
If you need to have real time updates, you can check out Realtime (www.realtime.co). It's basically a set of tools for developers to use real time technologies on their projects. It uses websockets but does fallback to whatever the user's browser supports (such as long polling, for example) if you are using a browser (which is not your case, but it's always good to know).
Behind Realtime you have a one-to-one/one-to-many/many-to-many messaging system that will transport your messages to and from your users.
There's a iOS API too which you can use in your project. You can download it here: http://www.xrtml.org/downloads_62.html#ios and check the documentation here: http://docs.xrtml.org/getting_started/hello_message.html#ios.
There's also a plus which is the fact that the Realtime framework is actually cross-platform. This means that you can even have your iOS players to communicate with players using Android, Windows Phone, HTML5, Flash, etc. if you decide on expanding your game to other platforms.
I hope that helps!
I'll just provide some insights on the question.
APN should never be used for synchro communication as for iOS at least, you'll never have both way communication (basically the Apple APN servers are pushing an information to the device).
You should probably play with C sockets in order to open a tunnel (depends if your game is real time or not).
Using the Apple Framework GameKit is great! But might take some time to understand all the functionnalities.
Check out Gree
https://developer.gree.net/en/
Parse:
https://www.parse.com/
Sparrow:
http://gamua.com/sparrow/
There are a few things that your talking about, there is the joining/starting of a game, and then the communication between the players. They are not necessarily related.
You can use game-center and at the same time another framework for facebook, they are not mutually exclusive (but it would be more work.)
I want to get to know how I can transfer data easily between 2 iPhones, over wifi. I would like to know if I could do that without having a server or database, but within an app (so without using email).
Game Kit has support for Peer-to-Peer-Connectivity and is, despite the name, not only usable for games:
The GKSession class allows your application to create and manage an
ad-hoc Bluetooth or local wireless network, as shown in Figure 1.
Copies of your application running on multiple devices can discover
each other and exchange information, providing a simple and powerful
way to create multiplayer games on iOS. Further, sessions offer all
applications an exciting mechanism to allow users to collaborate with
each other.
You can also check out Bonjour API from Apple. I am not sure if you need a static IP for it to work or it can just work over wifi. Just trying to give a pointer.
Based on your exact usecase, it can work well.
Check it out here, Game center is also there.
http://developer.apple.com/technologies/ios/networking.html