Hi! It is my first time developing an Android application, I have a problem that happens when pressing the home button or switching between apps, when I return to the app it becomes frozen/unresponsive and I have to use “Force Stop” on the app settings to launch it and be able to use it again.
In my case I don’t need to do any task on the background or resume an activity, what can I do? I already tried to use the “Close Application” and “Move Task to Back” blocks in the “On App Pause” and “On App Stop” callbacks without results.
Show us how you are handling blocks
What blocks do you need to see? What I’m doing inside the callbacks?
Yes i mean your code
This is what I’m doing in these blocks. The rest of the code is very long, I can upload the .aia file if you need it.


The close application block shouldn’t be used there, why?
If you navigate to another screen the app will be closed yet you’re aiming to enter another screen. Does your app have 2 screens only? Screen 1 as default and the main screen?
I recommend that you should remove those blocks and use when pressed back. Then close the app

I did that to try to kill or destroy (I don’t know what exactly Close Application does) the activity to prevent the app to get frozen when pressing the home button and returning, from what I understand the activity goes on pause when doing this. So instead of keeping the activity on pause I tried to kill it, that way I intended that the app has to be re-launched every time you exit it.
The close application block kill the whole app, but not working as you intended
When app pause, (every android app) keep things moving, some app for few minutes eg in android 11+ if the app is not running in background.
So when app pause it listen that it should be in active while you switched to another screen or another app, so when returning from your activity the app try to respond where you left but found to be Pause+Closed
I think this causes the issue, so to avoid that let the app work normally as every app, when pausing and coming back let the app decide whether to reload or continue where user left,
Maybe you should try this block

Thanks! I understand now, I tried this metod but it did not work. I figured out that one of the problems is the app immediately stops after pause. And the On App Resume callback is only executed when starting the app but not when I return to the app.
this triggers the OnPause event, which then (close appication block) tries to close the app, which triggers again the OnPause event etc, in other words you created an endless loop
Taifun
Hi Taifun thanks for responding, oh I see now, my approach was wrong. But the problem still persists even without the On App Resume and On App Stop blocks.
Without you providing more relevant blocks I now only can suggest to use logcat to find out what is going on
Taifun
Thanks, I will try to get any relevant information and update.
Well I should have started using proper debug tools before. I was getting this error:
FATAL EXCEPTION: main
java.lang.VerifyError: Verifier rejected class com.onesignal.NotificationRest
I don’t use the Push Notifications component anyways and I read that it is deprecated, so after deleting it the problem is solved.
Thank you Ibrahim and Taifun for your time!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
