On my Samsung galaxy tablet, when the app goes to background (by pressing the home screen), it completely disappears from the back stack (where you can see all the open apps). Yet when I open the app with the icon manually again the state is clearly restored.
Is this a manifest settings or similar? I cant figure it out
This happens when you have android:excludeFromRecents="true" in your manifest launcher activity. Try set it to false:android:excludeFromRecents="false"
Related
I have developed a custom launcher/homescreen and it has been working perfectly on all android version for nearly two years. So far this launcher has been used in various Samsung devices.
Currently I am testing it in new huawei lua-u22 device. My launcher runs, can be set as default and shows up other apps on top of launcher too. But if I run another app (for example Gmail), screen lock(Swipe only) for 20-30 second, unlock device then press back button then instead of bringing it back to my launcher it goes back to default huawei homescreen. I checked by going to the settings-> home and there my launcher was still set as default. It only brings back my launcher home screen when I press home button again.
Is this problem of huawei device that is always redrawing default huwaei home as homescreen? Is there anyway I can track default selected home change at any time?
I found out the reason. In huawei after screen is tuned off my app was getting killed.
Huawei has a feature Protected Apps which allows application that is enabled in the list to keep running when screen is turned off. After I allowed my app in Protected apps it was not getting killed after screen turned off and everything now working properly.
To enable this feature go to System settings (which you can either find in the quick toggles portion of the notification shade by pulling down the status bar on the top portion of the screen). Go to All tab, Scroll down to Privacy and Security section, go to to Protected Apps and enable your app(this will control what’s allowed to run when the screen is off and what isn’t)
In stackoverflow there are few codes available to run this screen pro-grammatically which I do not find reliable enough as it may change in any new version of device.
When downloading and installing my app from the Play Store, I have the following issue:
After I start the app for the first time I get into my LoginActivity (which has intent-filters MAIN and LAUNCHER), I log in and then start my MainActivity, that has a HomeFragment with a green button. On Button press I hide the green button and show an orange button. If I now press the 'Home' Button, the Device goes to the home screen, then animates to a page where there is space for a new app icon and adds the icon of my app, animated (since it was a fresh download). If I now click on the icon to re-open my app, I get back to my MainActivity and HomeFragment, however the UI seems to be the way as if the Fragment was just created (green button is visible, orange is hidden). If I then press the back button, the Screen seems to close, behind it appears my "old state" MainActivity/HomeFragment, but then the UI quickly changes back to the green button, if I then press the back button again, I leave the app as expected. If I kill the app and restart, this issue no longer occurs, instead the the behaviour is as expected (when pressing home button and reopening the app, the UI is exactly how i left it).
This issue does occurs on my Nexus 5, Android 6.0.1. When going through the same steps described above on a Genymotion Virtual device (Galaxy S3, Android 4.4.1 with play services installed) I do not have the issue, the app is behaving correctly.
This issue never occurs, when I deploy from Android Studio.
Any ideas? what the issue could be?
I have added android:launchMode="singleTop" to my MainActivity in manifest, without success.
Obviously the is also hard to debug, since it does not occur when I deploy from Android Studio (even if I uninstall the app first), so I have to submit an update to Play Store first to see results of changes.
When clicking on the app-shortcut, I am opening an Activity with a Dialog theme. It seems that the app-shortcuts are not closed if I use that theme on the Activity. If I delete the Dialog theme, the app-shortcuts are closed after clicking on one of them.
Any idea? Thanks!
I was able to reproduce your problem, at least with the Pixel Launcher.
The rendering and behavior of app shortcuts is up to the app that is showing the shortcuts. Perhaps the Pixel Launcher is only collapsing the app shortcuts panel in onStop(). When a shortcut launches a full-screen activity, the launcher activity is called with onStop(), and so the app shortcuts panel goes away. But, when a shortcut launches a dialog-themed activity, the launcher activity is not called with onStop() (since it is still visible), and so the app shortcuts panel remains.
Regardless, this behavior will vary by home screen (or other user of app shortcuts), and there is nothing much that you can really do about it.
I am making one lock application and for that I need to disable home button. I already tried all the common solutions available and it works for other android versions but for this device which is running on Android 4.2.2 it fails always.
You can't disable the home button as it can cause security issues promoting malicious apps etc.
What you can do is add an overlay to your app instead that will cover over other apps.
See this link for more info:How to disable Home and other system buttons in Android?
Make application as launcher.
First time when home button is pressed, device ask for choose launcher, select your applicaiton with always options.
From the next time when application is opened and you press the home button app never go in background.
On my droid phone, I get what I consider a proper pause/stop/resume/restart sequence when the home button is pressed and I then select my application. However, I'm testing on a new Samsung Galaxy tablet and when I select my application after having pressed the home button, a new activity is being launched. I do not understand why the behavior is different on the Galaxy. Any ideas? I have removed orientation config changes in the manifest, so it's not that.