If the user wasn't scheduled to work this day he won't start the app at all and we will wait until his next schedule day which might be 1 week later.Google doesn't allow "constantly running" background apps, but you should have no problem scheduling a service to run at a specific time each day (just like alarm app works - using StartServiceAt call)
For the situation with the worker not getting paid for last weeks work because there was no internet, you should configure your app to "report in" every day even if there is no new checkin/out data to report. This way, when your backend goes to calculate the weekly payroll, if it didn't hear from your app on a particular day, it could report to the backend admin with a message like "Checkin/out data has not been received from the remote app on day xxxx, so there could be missing wage info that was not reported".
For the situation of both a background service and a user starting the app trying to report at the same time, this should not be a problem because I'm pretty sure the OS will not let two different instances of your reporting service to run, so only one can report at a time. And when the app tries to run the upload routine right after the previous background upload routine ran, it should simply exit immediately because the second call of the service should not find any unsent records to upload because the previous call did that.
What do you mean?Is the server not recognizing the timestamp of a delayed submission?
You would not have a separate program - you would simply have a service inside your app that reports the hours in the background at a set time. And since there is only one service that does the upload, then it's impossible to have two services/apps trying to do the upload at the same time.If the user wasn't scheduled to work this day he won't start the app at all and we will wait until his next schedule day which might be 1 week later.
For the situation of both a background service and a user starting the app trying to report at the same time, this should not be a problem because I'm pretty sure the OS will not let two different instances of your reporting service to run - how does the OS will know about it? The user exited from the app completely, for example by clicking clear all button or just rebooted his phone. Now on the OS start my service will start and then user will start the app a few hours later. Let's assume that Internet connection wasn't Ok and only know the Internet is Ok so how does the OS turned off the service and started my app?
How can I sent the locally stored info back to the server without Internet? And if in a few hours later Internet is Ok the app might not be started because the next schedule time for the user might be 3 days later or 1 week later and for one week the whole office won't have any idea about what's is going on until the user will start the app next time.Simply that if the data is stored locally with the correct date and timestamp, why wouldn't the server app accept that as correct and pay the person appropriately.
Why would the server app only accept real time submissions? If I am way off the mark, just ignore this.
Sounds good but it's password protected info because of Department of Health regulation. If the user exited the app - nothing won't be sent because he must to be logged in.You would not have a separate program - you would simply have a service inside your app that reports the hours in the background at a set time. And since there is only one service that does the upload, then it's impossible to have two services/apps trying to do the upload at the same time.
And you will program this service to run once a day using the StartServiceAt call. Whats cool about this function is that even if the user exits your app, when the set date/time occurs, the service will automatically run even if the user doesn't start the app.
Lets say the report time is 1pm everyday. You could program the service that when it runs at 1pm and the internet is not good, then set the report time to 2pm, etc until it connects. And when it finally connects, then set the next upload to 1pm the following day.
Sounds good but it's password protected info because of Department of Health regulation. If the user exited the app - nothing won't be sent because he must to be logged in.
We recorded user's login time and location in the app and send it to the server, not only clock in/out. So the rule is - don't start anything without user authentication.
DOH and the common sense are not always compatible - the rule is - no login time recorded - don't do anything. But yes, that I'm going to do - create a notification for a billing department that clock in / clock out wasn't sent and let them to take care about it over the phone to nudge the user if he wants to be paid.And remember, the StartServiceAt API will run your app's service in the background (at the set time) even of the employee doesn't manually start your app.
I don't see a privacy/security problem for the app to at least say "no new data to report" to the backend every hour - this way the backend will at least know there is no new checkin/out data to report.
Are you saying that once the user "checks IN", it is OK to send data to the backend, but once the user "checks OUT" that your app is prohibited from sending any data to the backend?Sounds good but it's password protected info because of Department of Health regulation. If the user exited the app - nothing won't be sent because he must to be logged in.
We recorded user's login time and location in the app and send it to the server, not only clock in/out. So the rule is - don't start anything without user authentication.
Are you saying that once the user "checks IN", it is OK to send data to the backend, but once the user "checks OUT" that your app is prohibited from sending any data to the backend?
Can you show me some examples how to use StartServiceAt ?You would not have a separate program - you would simply have a service inside your app that reports the hours in the background at a set time. And since there is only one service that does the upload, then it's impossible to have two services/apps trying to do the upload at the same time.
And you will program this service to run once a day using the StartServiceAt call. Whats cool about this function is that even if the user exits your app, when the set date/time occurs, the service will automatically run even if the user doesn't start the app.
Lets say the report time is 1pm everyday. You could program the service that when it runs at 1pm and the internet is not good, then set the report time to 2pm, etc until it connects. And when it finally connects, then set the next upload to 1pm the following day.
Do I need to callJust do a search in this forum - this was the first entry:
StartServiceAt (Service As Object, Time As Long, DuringSleep As Boolean)Schedules the given service to start at the given time.
Service - The service module. Pass Me when calling from a service module that schedules itself.
Time - The time to start the service. If this time has already past the service will be started now.
The actual delivery time might change to reduce battery usage. Use StartServiceAtExact if the exact time is important.
DuringSleep - Whether to start the service when the device is sleeping. If set to false and the device is sleeping
at the specified time, the service will be started when the device wakes up.
Setting DuringSleep to True can have a large impact on the battery usage.
StartServiceAt can be used to schedule a repeating task. You should call it under Service_Start to schedule the next task.
This call cancels previous scheduled tasks (for the same service).
Example:
StartServiceAt(SQLService, DateTime.Now + 30 * 1000, false) 'will start after 30 seconds.
StartServiceAt
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?