My android app gets killed when in background on nexus 6p - android

I had a problem running my app on Nexus 6p: My Android app is getting killed every time my app is moving to background.
I have already set this app to be 'Not Optimized' and made reboot - but still had no success. I see that my Activity's onDestroy() is called for every time..
Any idea?

I don't think there is any way or reason to run app in background. This link shows how to run tasks in background. If your use case doesn't fit in scenarios described there, please provide it in problem.

Related

App run in background and open it again make device lag

I have some problems to my app and I don't have any idea to fix that.
I open my app and use it for a while, then I let my app run in background which means I don't close it and use my phone do other things.
But when I want to use my app again, I found that my phone becomes very lag. When I click background app button to show which app is running in background, my app jumps to screen very lag, and when I want to click it or want to close it, it will very lag too, which means maybe my app make my phone become lag.
This situation only happen when I want to open my app again or I want to slide out my app to close it. When my app is running in background and I do other things, my phone will not lag.
I don't konw what happend to my app, can anyone tell me how can I check my app,
and know what happened that I can fixed it, thank you!
Check in your application code that you have not put a heavy task on onResume() method. If possible try to take that execution in appropriate life cycle method.
Put a break point on method which is call when the application got visible and try to find out that if any function is not taking much time to execution.

White screen or app launch lag on devices with Android >= Lollipop

When I start app (First launch or Launching after killing it through task stack), It takes around 5-6 seconds to come to Launcher screen and shows white screen.
When I made launcher activity translucent then still same app lag time is there.
One more thing is that if I play with application for some time like 30 min and kill it through task stack then it take much more time like 15-20 seconds to launch.
I have read all blogs and answers on stack-over flow but it did not help.
Some information regarding above scenario:
When app takes more than 10 seconds then I observed that it does verification of objects as it show in logs.
I have instance and variable in Application class to use it throughout app.
I have GCM also in app.
Thanks for the suggestions. It worked for me by disabling Instant Run.
I checked on this link Android Studio 2.0 - pause/white screen on App first run

Is android:excludeFromRecents broken for the first app that is launched on the device on Android L?

Is seems like the current way to exclude apps from the recent apps-lists in android L is broken. Our app is using android:excludeFromRecents and it works just fine. Unless our app is the FIRST app to start when the device reboots.
This is how it looks when our app is exited as the first app on the device:
And here is how it looks if we first start the camera (or any other app), then our app and exit both:
Simply put: If an app with android:excludeFromRecents is started as the first app on the device, the directive android:excludeFromRecents isn't working. If another app has been started before the android:excludeFromRecents-app, it works as expected.
Is this a really weird edge-case bug or am i'm missing something very obvious here?
We build a very privacy cautious web browser (http://inbrowserapp.com), so we cannot have any screenshots from the app showing once the app is closed. But this should also affect banking-apps, password-managers etc since sensitive information will be screenshotted if the app is the first to start after a reboot.
Maybe we can go about the route and hide the sensitive information with a blank view when the user is exiting on Android L. But its seems like something is buggy here?
I'm happy to say that this is fixed for Android 5.1. Just confirmed it on a device running 5.1.
So the correct solution, for us anyways, is to deny screenshots with getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); for Lollipop with SDK version 21, anything below or above that should be fine.
You can at least prevent the screenshot in recents by setting this flag:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
But it's still a bug that never should have made it to release..

Phonegap persistent app in background, how to?

i have a Phonegap and JQM app.
Problem is, if I switch to another app and then back to my app, App is completely reloaded and start again.
Is posible this disable?
Thanks for any advice.
This is happening because there is a lack of memory for the app to run. So as soon as u go to home the app dies and on opening again it reloads the app from the start. To confirm that this is indeed happening i would suggest that you close all running apps on your phone and then run your app. Im sure it would run properly even after switching to home screen and coming back.I don't think its possible to get around this behavior. Design your app so that it has a small startup time so that its usable even on phones with less ram where such problems would come.

Re-opening activity kills process

In my app when i press home button and open the app from menu or shortcut it returns in the same screen but the pid of the process is killed.
BUT
if i hold home button and choose my app from there it will resume normally
This problem is not happenig in all devices 2.2.1 and 2.3.5 samsung galaxy Ace
if is solved again ( i doubt i lost many hours searcing) please link the answer
Thanks in advance
EDIT
In 2.3.6 Samsung Nexus S doesn't happen.
You shouldn't worry about that. The whole Android ecosystem is built around the concept of never terminating your application yourself, and letting the OS handle that aspect of things, and it's working very well if your app is written following the good practices.
Make good use of the Activities lifecycle methods (onPause, onResume, onStop, etc.), and everything will work smoothly, whether your app has been effectively terminated or kept in the background by Android.

Categories

Resources