I'm trying to make a kiosk app for work and thought I was about done but an initial trial has showed that whilst running for an extended period of time (approx 10 -15mins) the program grinds to a halt with a message box to kill the app or wait.
The app is basically a timer that counts down from a preset time, and if movement is detected or the screen is pressed then the time is reset and continues to count down. If for some reason the time counts all the way down to zero then an automated message is sent out to all the contacts that were selected when the timer was started. This is basically to cover for periods of lone working at my place of work (we could have bought a system but I suggested that I could tailor make one instead :signOops.
Having spent some time this evening I've decided that the problem is two fold, firstly I am starting and stopping a service incorrectly, which was intended to ensure that my app was always kept at the foreground (i.e. kiosk app), and so I've disabled this for the time being.
My idea was that when the activity is paused it starts the service which then calls the activity and when the activity resumes it stops the service. This sometimes works but more often than not it loops continuously round starting and stoppping the service. I can only think that activity_pause is being fired more than once on starting up?
Anyway, with this disabled I still have another problem and that is that I'm using the phone's accelerometer to check for movements (as set out in the shake example). However when I tell the phone to "StopListening" I continue to recieve shake events.
I've attached my code as I have no intention of trying to sell this on to the wider world :sign0089:
And whilst I'm asking questions, does anyone know the answer to these...
I'll obviously continue to try and answer my own questions but in the meantime thought it more productive to ask the more experienced of you out there.
All comments are as always gratefully recieved. Sorry that I won't be able to respond back immediately but I now have a two hour drive to take my kids back to their mother. :sign0137:
Kind regards,
RandomCoder
The app is basically a timer that counts down from a preset time, and if movement is detected or the screen is pressed then the time is reset and continues to count down. If for some reason the time counts all the way down to zero then an automated message is sent out to all the contacts that were selected when the timer was started. This is basically to cover for periods of lone working at my place of work (we could have bought a system but I suggested that I could tailor make one instead :signOops.
Having spent some time this evening I've decided that the problem is two fold, firstly I am starting and stopping a service incorrectly, which was intended to ensure that my app was always kept at the foreground (i.e. kiosk app), and so I've disabled this for the time being.
My idea was that when the activity is paused it starts the service which then calls the activity and when the activity resumes it stops the service. This sometimes works but more often than not it loops continuously round starting and stoppping the service. I can only think that activity_pause is being fired more than once on starting up?
Anyway, with this disabled I still have another problem and that is that I'm using the phone's accelerometer to check for movements (as set out in the shake example). However when I tell the phone to "StopListening" I continue to recieve shake events.
I've attached my code as I have no intention of trying to sell this on to the wider world :sign0089:
And whilst I'm asking questions, does anyone know the answer to these...
>Is there a better way of doing this? The aim should be to preserve battery power. I already turn off the backlight and only listen for shake events once the time is less than 30s (which I now doubt is working correctly). I only enable the backlight once the time is running dangerously low.
>Text messages aren't always immediatly recieved on land lines, therefore is it possible to send a verbal message? I know that its possible to instigate a phone call but can I send a pre-recorded message?
I'll obviously continue to try and answer my own questions but in the meantime thought it more productive to ask the more experienced of you out there.
All comments are as always gratefully recieved. Sorry that I won't be able to respond back immediately but I now have a two hour drive to take my kids back to their mother. :sign0137:
Kind regards,
RandomCoder
Attachments
Last edited: