App grinding to a halt.

RandomCoder

Well-Known Member
Licensed User
Longtime User
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...
>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

  • Lone Worker.zip
    10.5 KB · Views: 173
Last edited:

Cableguy

Expert
Licensed User
Longtime User
Hi RandomCoder...Haven't eard from you in a while...

I see what you are targeting...

I don't know how to solve your problem, but another way of doing things came to mind...
There's been a discussion on how to detect microphone level, so I thought, why not use it with SpeachRecon?

Say you set a service (and service only), in wich you "listen" for the enviroment...If the "noise" level reaches a predefined level, then the speachRecon kicks in and "listens" for a particular word, or sequence of words... If detected, then act, like start recording, send sms, make a call, even if it is with no sound, or enabling the local sound to be passed to the call...
Also, if the device is GPS enabled, send the coordinates in sms, or save it in a wave file (or mp3)

Well, anyway...its just a thought...Nice to see you around again.
 
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
Hello my friend, it's nice to hear from you too.

I've made a boob by putting this in the wrong forum but hopefully Erel will sort that for me tomorrow :sign0013:

The sort of thing I had in mind was to send a text to all the mobile numbers and then start to call each land line number in turn (i.e. numbers starting 01), allow it to ring a few seconds and if no answer move onto the next number. An even better system would be if I could make the call and send a voice message such as "Emergency assistance required in Test Lab X. Press 1 if able to respond, 2 if unable to respond." That way I could try calling numbers on the list until someone was able to respond. This would be a much better system as only one person would take the responsibility rather than sending a great load of people.

Regards,
RandomCoder
 
Last edited:
Upvote 0
Top