ertank 27 Posted October 5, 2019 Hello, I am using Delphi 10.3.2. There is a project where I am communicating with another app (I will call it "other app"). Communication with other app is over clipboard. Other app is developed on Android Studio and is using some embedded device specific SDK. Other app is not a service app. It is a regular app without user interface (completely runs in the background). If that other app is not running, my app runs it. Waits until it settles completely. Starts communication. I am now asked to close that other app when my app closes. Even if I could run it using an intent, I did not find any Delphi FMX example to close it. Embedded device is running Android 5.1.1. That is unlikely to change in a near future. I believe there maybe no problem of "dangerous permissions" or similar at that Android version. Any help is appreciated. Thanks & regards, Ertan Share this post Link to post
Dave Nottage 557 Posted October 6, 2019 As long as it's just the background processes of the application you're interested in, you could use: https://developer.android.com/reference/android/app/ActivityManager#killBackgroundProcesses(java.lang.String) Since Android 2.2, you cannot close the entire application. You would probably do something like this (untested): uses Androidapi.JNI.JavaTypes, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.App, Androidapi.Helpers; procedure Kill; var LService: JObject; begin LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.ACTIVITY_SERVICE); if LService <> nil then TJActivityManager.Wrap(JObjectToID(LService)).killBackgroundProcesses(StringToJString('com.whateverpackagename.itis')); end; Share this post Link to post
ertank 27 Posted October 7, 2019 That works nicely after adding "Kill backgound processes" permission. Thanks. Share this post Link to post