i am using zo0r/react-native-push-notification
When the timezone shifts because of travel in a user's device, the local app notifications will continue to come through according to the original timezone they were set in, is there any solution for this ?
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
My iOS swift application calls
TimeZone.current
when the application comes to the foreground. If I manually change the timezone from Settings->General->Date&Time, and then bring my application to the foreground, I get the correct timezone. But if my timezone setting was set to automatic, and then I turn off the automatic, and bring back my application to the foreground, the TimeZone.current API does not reflect the new system timezone!
If I put the application to background and come back again to the foreground, this time it reflects the proper system timezone.
Is this a bug in iOS SDK? Is there a workaround for this?
Try using NSTimeZone.local, which is:
An object that tracks the current system time zone.
You can also use the NSTimeZone.system property, but you'll need to manually call NSTimeZone.resetSystemTimeZone() to clear and refresh the current cached system timezone value.
I am working on an app that uses local notifications, which are repeating in an interval chosen by the user (between 5 and 60 minutes).
I would like to enable users to also choose a certain time frame so that the app will fire notifications only during this time frame. I was thinking about using NSDate and some kind of conditional statement where the notification only fires if the current time is in the time frame which was chosen by the user.
Do you think that will work or am I overseeing something?
You can use UNCalendarNotificationTrigger for this.
Triggers a notification at the specified date and time.
See
official documentation.
Calendar triggers can also be repeating, so it should serve your purpose.
In my app I want to get the accurate date and time , Basically, in my application there is going to be a time sensitive portion that users can not start until after a certain time.
But if I go and grab the date and time from the device, the user can easily change the date and time on their device, Settings > General > Time & Date change it here.
I also tried with GPS locations time stamp but no luck, [CLLocation timeStamp] is also give device time,
I have searched all said to use ios-ntp, but it is not when user not have internet connection,
I have refer following StackOverflow questions:
Accurate time on iPhone
Network Time Protocol for iPhone
Is there any way to get the tamper-proof date and time on iPhone?
Retrieving Current Time from Carrier in iPhone
Time-based syncing for iOS app
but not getting result I want,
Is there other way to get accurate/ actual time ?
NOTE : ios have to store the currentdate some where , because when i change current system date from settings , and again set to Settings > General > Time & Date > set automatically > ON it will set the current accurate date, so can we get that date ?? or some trick ?
Example :
Suppose that In device right now time is 2014-01-01 15:04:57 +0000 ( right now set automatically is ON in Settings > General > Time & Date > set automatically > ON ),
now
user set set automatically > OFF and change current dateto 2014-03-02 11:14:32 +0000
SO when in app i write NSLog(#"cdate: %#",[NSDate date]); it will print
cdate: 2014-03-02 11:14:32 +0000 but what i want is to print the current actual
date that is 2014-01-01 15:04:57 +0000
Do you realise you are asking the impossible? If you need to get the time and you don't have network connectivity, the only place to get the time from is the device. Either you trust the device time, or you get the time from NTP. There are no other choices.
How you handle this depends on exactly why you need to get the time. If, there is functionality in your app that absolutely must not be enabled before a certain date, I would get the time from an external server and if it proves to be after the said date, set a flag in your defaults to say you have verified the date and the functionality is allowed, so you don't need to network connectivity thereafter. If the networking connectivity is not there, you don't set the flag but maybe put a message up to say that you need to connect to the Internet to enable the new functionality.
If it's just some part of a game, use device time and let them cheat if they want.
will UIApplicationSignificantTimeChangeNotification work if user set automatically setting clock in iOS's General setting, and the clock of the device changes because of the carrier time change?
Is there any other way to get notified when system clock changes while app is running.
The UIApplicationSignificantTimeChangeNotification notification is sent at midnight or anytime the device's time changes (such as daylight savings, the user changing the time, timezone changes, etc.). I don't have direct knowledge of whether changes in time from the carrier will trigger this notification but given the other events, I'd be surprised if such a change didn't trigger the notification.
Documentation says yes, it is called due to carrier time changes.
"Posted when there is a significant change in time, for example, change to a new day (midnight), carrier time update, and change to or from daylight savings time.
This notification does not contain a userInfo dictionary"