When ever I export Android App(using a generated key store from eclipse) application state is not saved when running it. Say I am in 3rd screen, then if I go back to home and click on App drawer and launch it, it starts all over again. But if the app was installed from eclipse itself (through USB debugging) app behaves normally and state is saved.
Weird issue ! What might be causing this ? I checked developer options and activities are not getting killed as well on exit.
Related
I have a Xamarin forms Android app that seems to be restarted when the app is brought back to the foreground. (i.e. launch app, tap home button, tap app icon or select app from the recent apps menu.)
This only happens on devices running Oreo and possibly only with the November 2018 patches. I have set the Activity launch mode to LaunchMode.SingleTask and LaunchMode.SingleTop to no avail.
My users authenticate when they launch the app. This is causing them to have to re-authenticate each and every time they navigate away from the app which is not ideal.
Found the answer to this issue on another forum. I had "Do not keep activities" enabled on the device I was using to test. The setting is located under developer options. I had no idea that setting existed.
I have built an android and ios application using phonegap.
I need a user to navigate to another application on the phone and copy a token (string) and return to my app and paste it.
This works perfectly fine on android devices, but on IOS (both devices I've tested on are iphone 5 with ios7) when the user navigates away from my application and then returns, it is restarting my app. It loads on the first page of my app & of course the context & the form they needed to paste the string into are gone.
Is there some way to keep the application from closing just for 30 seconds while a user navigates to another app and then returns?
(I've searched for information on this, but all I can find is information on creating a service. I don't need the application to run in the background continuing to perform tasks. It just needs to not close while a user navigates away to copy a string from another app)
I resolved this by disabling debugging and hydration and rebuilding my app with "Phonegap Build". I guess hydration was forcing a restart of the app when it would lose and regain focus.
What am I missing here?
Problem is, I launch my app onCreate is called. I press the home button to leave it, press the app icon again and onCreate is called yet again. The activity is being killed, right? Well, if I press home to leave the app, hold down home, then pick the app from the running apps it resumes where I left off. So hitting home within the app is not killing the activity. Press the button to open the app is killing the activity.
I use Eclipse. I just downloaded the latest Eclipse and re-downloaded ADT and updated the Android SDK. Everything is up-to-date. I even uninstalled all java and downloaded and re-installed the latest jdk and runtime on my computer. Then re-signed the app.
Using Eclipse I added the skeleton sample project. Signed in debug mode and it resumes every single time, just like my real app. Signed for release and it has the problem: press home to leave the app, press the icon to launch the app and onCreate is called again. Literally every single time. Shouldn't it be resuming?
The problem is it's not just me (I have a BIONIC). It happens on other peoples phones and it happens on the emulator, but it only happens when signed for release. Signed for debug and it's perfectly fine.
Any ideas on this?
According to this previous question you need to set the FLAG_ACTIVITY_REORDER_TO_FRONT flag using setFlags(). This would cause your running activity to be reused instead of recreated every time an application starts it. When you press the icon on the home button, the activity is started. The home screen doesn't know if the application is running or not, so it just starts it. When you long press home, it actually switches to the activity as it knows it's running.
Another option seems to be setting android:launchMode to singleTop.
I think I've gotten myself seriously confused. Up until recently my app was working great. I hadn't changed anything except updated java and android tools. I'm not sure if that caused my problem or what, that's all I can remember changing related to it.
Here's the problem I'm running into, which just started.
Debug mode (installed app on phone through Eclipse):
Tap app icon to open app, onCreate is called
Hit home button, state is saved
Tap app icon to open app, it resumes, onCreate is not called
That worked, my app is happy.
Now I export the signed and zip aligned app, remove the app on my phone, install the new one, and repeat these steps:
Tap app icon to open app, onCreate is called
Hit home button, state is saved
Tap app icon to open app, onCreate is called again
Ugg, onCreate is called again? Bundle is null, my variables reset. This happens on the emulator too and for other users of the app. I can hold the home button down and switch to it and it continue where it left off but if I tap the icon it calls onCreate every single time.
Why is this happening? My app is a single activity.
I have the problem that the state of my activity gets only restored (after killing or put to background) if I launch the App via the Eclipse Run menu.
If I export the App and put it manually on the (same) device, the state gets not restored when I kill and restart the App.
I assume I overlook something. Can anyone tell me what? Thanks!
May be an old thread, but this may help others.
This is a known defect
http://code.google.com/p/android/issues/detail?id=18338
Installing and launching app from eclipse, or launching from apps menu will restore the state, but if we are installing the app manually (by copying to SD card etc.) and launch directly will not restore the sate.
The android system automatically remembers the state when you close the app. You specifically have to kill it from Settings -> Applications -> Your app -> Kill