I’m not sure how you ended up with two apps instead of one
but in any case, even if you do own the app, you do not want to force close it by another app
first, it is not how it works on Android
there is an Activity Lifecycle for apps
you can not apply the same logic that you have with desktop apps
not only it is considered bad practice but it could also get your app banned from the store
second, one way you could tell the other app to stop (without getting your app banned from the store)
would be to send a message to the other app via Socket, RTFMP, etc.
but you can’t do that because in fact the app is frozen somehow
third, you’re trying to solve the wrong problem
you do not have a problem of closing another app
but you do have a problem of having a 2nd app running in parallel of the 1st app
and that 1st app freeze
even better, the 2nd app is here to monitor the 1st app, so in the end
you really need only 1 app that does not freeze
Now on the technical side, since Android 2.2 you can only close the background process of another app, not the app itself search for
but that also why you have a problem, if you have a 2nd app monitoring a 1st app
the monitoring app should be a background process
but that is the 1st app that is freezing (and so is not a background process)
I don’t know what the hell you are doing but you are doing it wrong
and what you are looking for “closing another app” is just one more step in the wrong direction
Even if both your app were not freezing, you do not want to have 2 apps running in parallel
- the user can see only one app screen at time
- the back and forth between the two apps force both those apps
in their own activity lifecycle to onResume() / onPause() at every switch
- it will be simply much simpler to have 1 app
My guess is this, one app by itself run probably fine but it is the switching with another app that make it breaks because this app does not handle well the onResume() / onPause() cycle.
I would advise to ditch the other app, fix your app that is freezing and build/use only 1 app.
Simply put you have a debug and/or fixing bug problem,
you went all the way to create a 2nd app that monitor the 1st app with the idea that
“hey ho that 2nd app can probably force restart that 1st app when it crashes”
instead of simply fixing the damn app that is crashing.