Recent

Author Topic: force close app programmatically  (Read 11732 times)

polypress

  • Jr. Member
  • **
  • Posts: 91
force close app programmatically
« on: September 29, 2013, 05:55:05 pm »
How do you close an android app from Lazarus programmatically? Using halt stops it on the screen but it still runs in the background. You can remove it in the apps screen but I prefer to do it automatically.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: force close app programmatically
« Reply #1 on: September 29, 2013, 08:32:24 pm »
application.exit, or simple closing the main form of the application should do it.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: force close app programmatically
« Reply #2 on: September 30, 2013, 07:07:35 am »
I couldn't find application.exit, but I tried application.terminate, application.destroy, form1.close, halt and none would remove the app from the list of open apps. They paused the app, but they didn't kill it.

Regards

Mujie

  • Jr. Member
  • **
  • Posts: 64
Re: force close app programmatically
« Reply #3 on: September 30, 2013, 07:12:49 am »
Application.Free ?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: force close app programmatically
« Reply #4 on: September 30, 2013, 07:17:33 am »
I'm going to let some one else with more experience on Android to answer this but if application.free or mainform.close does not remove the application from the memory then I can think of 2 thinks
1) it needs some time to clean up its memory.
2) there is a bug that needs to be addressed.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

polypress

  • Jr. Member
  • **
  • Posts: 91
Re: force close app programmatically
« Reply #5 on: September 30, 2013, 10:26:55 am »
Problem solved.
It wasn't a lazarus issue; it was an android issue.
The app had closed OK but it was listed in the recent apps. I misinterpreted that screen.
You just need to add to manifest excludeFromRecents= "true"

Thanks for your all your help.

Regards

 

TinyPortal © 2005-2018