Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Android location based App with XE7 restarts after some time



Permlink Replies: 3 - Last Post: Sep 29, 2014 7:26 PM Last Post By: Dave Bhatia
Dave Bhatia

Posts: 11
Registered: 9/26/99
Android location based App with XE7 restarts after some time
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 29, 2014 11:32 AM
I have an Android app designed using XE7 and deployed on Nexus 7 and LG G3, the app works fine for a few hours however when the App is minimized or put in background, it seems to stop working and restarts itself; no errors are shown on the screen; this happens on both the physical Android devices.

The app collects location data in the background so I need it to be alive. If I go to running apps and bring the App to the foreground it seems to be working since the thumbnail image still shows the last screen used on the app however when you click to bring it to the foreground it restarts the App. I am trying to keep running by putting timer and refreshing the screen but nothing seems to work; the app dies after four hours or so.

Is their an Android memory/task management coming in the way? I have no Apps installed, both devices are running Android KitKat. Do I need to run something if the App goes in the background?

thanks,

-Dave
Chris Dunn

Posts: 160
Registered: 8/22/11
Re: Android location based App with XE7 restarts after some time
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 29, 2014 11:51 AM   in response to: Dave Bhatia in response to: Dave Bhatia
I think you need more of a service than an app.
http://developer.android.com/guide/components/services.html
Eduardo Elias

Posts: 319
Registered: 9/20/12
Re: Android location based App with XE7 restarts after some time
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 29, 2014 12:04 PM   in response to: Dave Bhatia in response to: Dave Bhatia
There is no background task running on android.. it is different.

When application goes to background it could be even removed from memory
if android thinks it is needed.

You have to write a service application. The service can be installed and
running on the background and turn to live by a timer (not delphi timer,
but android timer) when you need, even if the phone is in deep sleep.

Be aware that there is different levels of sleeping on android, and according
the level some services does not execute, but can comes back by a timer.
And you can kill the battery of the user if your service keeps all the time
coming.... so be careful


I have an Android app designed using XE7 and deployed on Nexus 7 and
LG G3, the app works fine for a few hours however when the App is
minimized or put in background, it seems to stop working and restarts
itself; no errors are shown on the screen; this happens on both the
physical Android devices.

The app collects location data in the background so I need it to be
alive. If I go to running apps and bring the App to the foreground it
seems to be working since the thumbnail image still shows the last
screen used on the app however when you click to bring it to the
foreground it restarts the App. I am trying to keep running by putting
timer and refreshing the screen but nothing seems to work; the app
dies after four hours or so.

Is their an Android memory/task management coming in the way? I have
no Apps installed, both devices are running Android KitKat. Do I need
to run something if the App goes in the background?

thanks,

-Dave
Dave Bhatia

Posts: 11
Registered: 9/26/99
Re: Android location based App with XE7 restarts after some time
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 29, 2014 7:26 PM   in response to: Eduardo Elias in response to: Eduardo Elias
Thanks guys, this really helps a lot and sheds some light on it.

So I guess Brian Long's method is the way to go for a Service App, i have it installed and have the source loaded too.

thanks again... and thanks Brian.

-Dave

Eduardo Elias wrote:
There is no background task running on android.. it is different.

When application goes to background it could be even removed from memory
if android thinks it is needed.

You have to write a service application. The service can be installed and
running on the background and turn to live by a timer (not delphi timer,
but android timer) when you need, even if the phone is in deep sleep.

Be aware that there is different levels of sleeping on android, and according
the level some services does not execute, but can comes back by a timer.
And you can kill the battery of the user if your service keeps all the time
coming.... so be careful


I have an Android app designed using XE7 and deployed on Nexus 7 and
LG G3, the app works fine for a few hours however when the App is
minimized or put in background, it seems to stop working and restarts
itself; no errors are shown on the screen; this happens on both the
physical Android devices.

The app collects location data in the background so I need it to be
alive. If I go to running apps and bring the App to the foreground it
seems to be working since the thumbnail image still shows the last
screen used on the app however when you click to bring it to the
foreground it restarts the App. I am trying to keep running by putting
timer and refreshing the screen but nothing seems to work; the app
dies after four hours or so.

Is their an Android memory/task management coming in the way? I have
no Apps installed, both devices are running Android KitKat. Do I need
to run something if the App goes in the background?

thanks,

-Dave
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02