I am developing an application on two iOS clients. But both two iOS clients may not able to connect to the Internet, that's make query the same network time difficult. If I send one time stamp to another via wireless or bluebooth or something else, it may have a time delay, like this:
Device A, get the timestamp from the Device A.
Device A send the information to Device B.
Device B mark the timestamp.
Device B receive the timestamp information from Device A.
Device B create a new timestamp, and add back the timestamp different between transferring data.
I am afraid that the create timestamp, and object creation will use some time that cannot be logged. And the application is very time critical. Is there any ways to improve that? Thanks.
I think the right way is
Device A sends information to Device B (without timestamp)
Device B responses to Device A timestamp of reception.
Device A receives the timestamp of data delivery.
In this case both Device A and Device B will receive same timestamp of data sharing.
Related
Hello I am working on an ios app and I need to have a reliable source of truth other than the phone date time settings (witch the user can change by himself).
It is for a situation where I do not have internet and need to timestamp an event.
I so far I tried getting timestamp from CoreLocation object -> It does takes the timeStamp of the phone.
and look in CallKit or CoreTelephony if I could get any information about the time of the cellular provider network (in case we do not have internent but are still connected to cellular networl).
Is it me or I will be forced to timestamp with whatever date I do have at the time of the event and then when internet comes back, computes the offset from my backoffice time ?
thanks
Closing the discution. It seems that the anwser is No, there is no way to get cellular time or gps time, we do need to compute the delay based on a NTP server (or backoffice server) when we get internet back
I am developing an app where i need to sync data between several devices with the main datastore being a central server.
So one instance of app on a device will get new data, send it to server, i then need to send this data to the other devices.
Issue i have is, how best or what is the standard way to trigger the data download?
1) Have each device poll the server every x time to make sure its data is up to date?
2) Have a separate thread constantly waiting for new data and when the server receives new data it pushes it out to the devices?
3) When the server receives new data it sends out push notifications which when the devices receives this, it causes the app to sync with the new data?
4) Something i ain't thought about
I know all three will potentially 'work' but i wondered if there is a standard architecture / method to doing what i want to achieve.
::Edit::
The data needs to be fairly 'instant' if i poll it then i'll have to poll it every 30 seconds max to achieve the sync rate i ideally want.
I can send the data to my server no problem at all, i can even download the data once i have the trigger to, its just the mechanism that triggers the download I'm unsure off.
I imagine that new data will be sent to the sever properly on an hourly basis.
Thanks
I am developing an iOS app which needs to receive regular data from the server at specific period of time (every 5 seconds).
Apple gives developers some choices for background working.
I convinced that Background Fetch is the proper method for my problem.
But when I tested it I got confused.
Background Fetch has many issues with my requirements:
It does not fetch data at period you defined when declared it:
application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum)
I tried this and this:
application.setMinimumBackgroundFetchInterval(5). But no guarantee
that your app will fetch data at this interval.
When the screen is off, your app will not make any fetch until the
phone is unlocked again.
I wonder if there is a way that let my app receives real time data (or at least every 5 seconds).
Note: I read about remote notifications and I do not guarantee that I can execute it now, So I am searching for other solutions.
Thanks
There is no solution to this problem until writing this answer.
If I need a real time notification then I must use Push Notification.
There is no way to check for server data every period of time from the app only, I can send a Remote Notification when new data available on server to wake up the app and let it connect to the server.
We're looking to build a small device connected to a sensor that transmits data to an iPhone, which subsequently takes the data, stores it and graphs it. However we want the iPhone to be able to change the polling data on the device by sending small amounts of data. I've been doing some reading and it seems like bluetooth LE does not allow for this type of streaming connection. Is this correct? Would switching to an Android platform be better? What would you all suggest?
With Bluetooth LE, you have complete control over the flow, even on iOS.
That said, there are a couple of things to know:
BTLE devices only have read-only "characteristics" (but can be dynamic)
There is no way to "push" data, only notify a change to the listening devices
So instead of saying - "Hey, 'streaming_type' should change from 'wind' to 'temperature'", you would say - "Hey, 'streaming_type' has changed, come read it".
It is not specific to iOS, it is the way BTLE works. So if you want an iPhone to be able to control your device, your application simply needs to setup a BTLE "streaming_type" characteristic, and then update it when the user wants to change the type of data being streamed.
Your BTLE device would then look for this specific "streaming_type" characteristic, and go read it when it receives a update notification.
It's generally a common question.
I wonder how do mail apps implement functionality of email-receiving?
I need to implement a simple sync between two devices(for example) using my web service.
Imagine a to do list app.
Is it possible to implement such a functionality: device1 makes an entry,then sends a message to webservice, webservice informs device2 that changes took place and device2 adjusts its data and displays that entry?
On iOS what you want could easily be implement with push notifications.
As soon as the server detects changes that device2 needs to be aware of the server will send a push notification to that device.
After the user views the notification the app should update it self, it would also be a good idea to let the app update it self when coming to the foreground.
The reason for doing it with Push Notification and not polling is that if your app is in the background you can only continue to run a process for 10 min max. You might get around this by adding the background mode to your app, like VOIP, Audio or location. But if you app does not fall in those categories apple might reject your app.
With Push notification the device will receive the notification even if your app isn't running or in background.
Basically there are 2 ways:
polling, each device asks the webserver for changes every N minutes: new todo, delete a todo, change a todo, ... and then each device will adjust. The frequency of the poll depends of the level of real time you are looking for. It can be 1 call every second or every 12 hours or much more.
implement a kind of BOSH protocol: the device opens a connection to the server. The server keeps it open until there something new to send to the device or the connection times out. In that case, the device reopens it.
Option 1 is better for your todo app because you don't need real-time accuracy. The option 2 is better for a chat application where you don't want to wait for the message.