I have an IOS app that needs to track duration of free usage per day. Once it crosses a threshold, the user would have to purchase the app or wait for the next day to unlock his free-usage minutes for that day.
Is there a native way to detect if the user has set his clock back? Assume there is no Internet connection to sync with a time server
UIApplicationDelegate can get the following method called on significant time changes:
- (void)applicationSignificantTimeChange:(UIApplication *)application
You can try that one. From my point of view, I'd recommend to check current date on every application launch or willBecomeActive and store those dates as list somewhere securely. If current date is different from the last date, add it to your list. If list has more than 30 items (or how many you need) disable trial functionality.
Related
I am facing an issue of frequent location tracking reminders even user has chosen "Changes to Always Allow" option from second permission dialogue which generally appears after some time when App tries to retrieve location in the background.
As per my understanding, this is a periodic reminder to the user that App is using location in background and they still want to keep change and degrade the permission.
Ideally, it comes in the frequency of 3, 7, 14 days like so. this is my observation for other apps which monitor location in the background with "Always Allow" permission
But in my case, This tracking reminders come 4-5 times in a day on 3rd Day.
I am using multiple CLLocationManager in code and this should not be an issue.
Also, I am calling requestAlwaysAuthorization() method with a pre check that if the user has not granted "Always Allow". As per documentation if **authorizationStatus != kCLAuthorizationStatusNotDetermined**, then this method will do nothing. So calling this method multiple time should not be an issue.
pausesLocationUpdatesAutomatically is false and allowsBackgroundLocationUpdates is true in code.
So what could be a reason of it? Or is it depends on iOS and no control of the developer?
With Microsoft Band and Windows Phone app I want to get from the MSBand the steps taken in the current day. Today, when I subscribe to the pedometer, the totalsteps attribute returns the steps taken overall. For example, my MSBand is returning 1M 444K steps. Does anyone knows how to get only the total daily steps?
The Band SDK does not expose the number of steps (by its internal count) taken by the wearer in the current day. The closest approximation to your goal would be to register a time-triggered background task that retrieves a pedometer sensor reading every n-number of minutes/hours and then calculates the number of steps taken on the current day based on a delta between successive readings. Obviously this implies a certain margin of error, based on how often (and when) that background task executes.
(On Windows Phone (8.1), for example, a background task can execute at most every ~30 minutes and isn't necessarily aligned to any given minute of the hour, which means steps could be attributed to one day or the next based on which side of the "midnight" hour the task happens to run.)
If you are accessing microsoft health cloud API. You can get the step counts(Per day) from the Summary URL Cloud API. refer my post https://stackoverflow.com/questions/32221481/android-get-active-minutes-for-the-step-counts-in-microsoft-band Else if you want it from the band SDK alone, Its good to go with Phil's above suggestion. Hope this may help who use health cloud API.
I am using HP Project and Portfolio Management(PPM) tool and I am adding a custom field in my request type which has date as value. Now my requirement is to send the email notifications to the users once the date mentioned in the custom field crosses the system date.
I had tried to set the notification for field level from Notification tab but not getting the custom fields in the list. All the fields, which is available, are pre-configured fields.
So, can anyone suggest me how to implement this requirement? And also where the changes need to be done If any required to implement this?
Please answer in detail and also reply soon.
Thanks in advance!!
PPM notifications can be configured on pre-defined events, like a certain transition, or timeout etc...
One possible solution for this scenario is to have timeouts on your decision step. Time out goes to an execution step, which checks for the date condition. If the condition is met it fires the notification. Else it just returns to the original decision step.
The downside of this work around is that there will be transaction details added once daily. Also the last update date of the request keeps updating daily, which is not ideal if you want to track what was the last time an end user update the request.
It is a workaround cause of the restrictions around notification events.
And if you have a large workflow, I would not recommend this work around.
In my app, user can play several different games,
However, unless a user purchases premium version, he will be able to play only few games a day.
I would like to make some sort of counter.
So, each time you play a game, i call counter++ and check if the counter value is 4. If it is, I would put another value to false, and disable the start game buttons and display a message "Buy premium account in order to play unlimited games..."
When a user starts a game tomorrow, he should have another 4 attempts to play a game.
Can anyone point me out on how would I check if the day passed?
Any suggestions are welcome, since I don't have a clear idea how exacty to do this.
Thanks in advance
Each time you play a game you need to store date and increment count.
You should use low level mach functions to get time, to avoid iOS date/time correction by players.
Also it is better not to store the number explicitly.
If you want to store info in User Defaults you should hash or encrypt the data you store.
I'm looking for an example where + autoupdatingCurrentCalendar would be used instead of + currentCalendar. More specifically where the values based on the calendar are automatically changed when the calendar changes. Do I need bindings for this or something like that?
The docs state:
Note that if you cache values based on
the calendar or related information
those caches will of course not be
automatically updated by the updating
of the calendar object.
Thanks in advance
currentCalendar returns cached version of current system calendar, while autoupdatingCurrentCalendar always returns most recent version of system calendar.
That is important, when you are presenting data based on the various parameters of a calendar like number of days in a month, number of a weeks in year or number of hours in a day.
To be honest, I don't know why Apple gives you an opportunity to get outdated value by using currentCalendar.
It looks like they have internal API that allows you to manipulate caches of NSCalendar, so you can achieve better performance. But since it is not public, there is no reason to use currentCalendar.
That is, always use autoupdatingCurrentCalendar.
Well, on OS X you can be running multiple processes simultaneous. One could be your process that uses the autoupdatingCurrentCalendar. The other could be System Preferences.
System Preferences allows you to customize your calendar settings. You can choose the first day of the week to be something other than the default (Sunday). Or you can choose a whole different calendar altogether. If you use the autoupdatingCurrentCalendar, these changes will be picked up automatically. If you don't use it, they won't.
I guess that it is only usefull if you store the calendar in memory for further use. Doing that way, if the calendar settings change, your stored calendar will take account of those changes if you used autoupdatingCurrentCalendar. If you only used currentCalendar, it wil stay at the state it was at your first call.