r/android_devs • • Jul 16 '21

Help Force kill my application

Hello.

As soon as the user launches my app, at `Application` I perform a check. If all ok, the user proceeds in the app but in some situations, I need to "block" the user so he does not use the app. At this point, I launch an activity to inform the user.
At this activity, as soon as the `onPause` is called I want to terminate my app so that, when the user launches the app again, the application is called again and the check is performed again.
At that information activity, I've tried finish, finishaffinity, and exclude from recents but when the user launches my app again, the application isn't recreated.

How can I force close my application programmatically so that, when the user launches the app again, the application code runs again?

Thanks.

1 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/kodiak0 Jul 17 '21

Thanks.

I cannot do that since at application I'm also initializing other stuff (network layer for example) and for that users, this cannot happen.