I have set mView.setPreserveEGLContextOnPause(true); and this works in most situations, but I recently noticed that if I lock the phone it kills the GL Context. The rest of the app seems to stay intact. I'm able to quit to the home screen and play another game, and go into the multitasker and still have my game waiting for me how I left it.
I have also found that if I go to the home screen and then lock the phone, the context is still intact. There is only a problem when I lock when inside the app.
Any help would be greatly appreciated.
Related
I ported my Cocos2dx game from iOS to Android. Everything works fine, but there is something strange on lock screen on android. The application doesn't lock the screen after inactivity.
I try to change SCREEN_OFF_TIMEOUT programmatically from my app. It changes, but not to my application.
I found on stackoverflow tips on calculating idle time, and then lock the screen programmatically. Is the only way? Is the screen should not be blocked automatically?
Hi try to call method setKeepScreenOn(false) in your cocos2d-x activity, which call method in Cocos2dxActivity.java This will allow game to sleep. After some time, if you have screen lock set in your phone settings will lock the screen.
setKeepScreenOn(true) function that prevent phone to sleep, useful for some
games
I have a problem that I don't really know how to solve and also the threads here at SO haven't fully helped me.
Here's the issue: I want to have an android app that I can start whenever I want, and then, when I click on a button, I want the app to be somewhat "locked". By that I mean: after this button was pressed, the user is not able to close(see edit below) the app. Also, the app should immediately start after rebooting the device.
This lock can then be revoked by, say, entering a passcode, which makes the app run normally again.
So far I understand how to build kiosk applications. However, a kiosk application needs a particular manifest which will make it always a kiosk app, and not "on demand".
I'd greatly appreciate any hints and tips on this topic. Thank you so much!
EDIT: by "close" I really only mean completely turning the app off, not only going back to your home screen. Such that the app is always running in the background
You can programmatically lock and unlock the App in Android 5.0 http://developer.android.com/about/versions/android-5.0.html#ScreenPinning
This might be a bit of a stupid question but my application seems to stay running even after I have stopped it. I close it by holding down the home key and dragging the application off to the left. However, I still see logcat output, it only stops if I go to settings-->Apps-->Running Apps and stop it this way. Is this a bug in my application or is this expected android behavior?
This is expected . Android behaviour
Unlike many other Operating Systems, Android does by default not have a dedicated button to close an application manually. This is because Android is designed to manage the running applications itself and close them as needed.
By design, Android handles the memory and time assigned to applications. This ensures that applications that are left opened do not cause the smartphone to slow down or run out of memory.
When pressing Home button, your app will go to the background and Android O/S will close it when low on memory. If not and you open the application again, it resumed where you left off.
Unless you specifically create a method in your application that closes (finishes) your app.
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.
On an android App I made, whenever the user turns the app to the side, the app turns sideways and restarts (this was on the droid). I don't want to this to happen. I want the app to not restart when the device is turned sideways.
Also I would prefer the app to be locked in the vertical position.
How would I go about this two thing?
Thanks in advance.
This has been covered numerous times Android, how to not destroy the activity when I rotate the device?