Android - restart when hitting the power button

Hi.

I’m running out of ideas for this one:

The app is restarting automatically when I hit the power button on my S3
(this does not happen on my other devices).

V/SDL (25874): onPause()
V/SDL (25874): nativePause()
D/SensorManager(25874): unregisterListener:: Listener=
org.libsdl.app.SDLSurface at 42913af0
V/SDL (25874): onDestroy()
D/dalvikvm(27512): Trying to load lib
/data/data/org.caveexpress/lib/libSDL2.so 0x428fabe8
D/dalvikvm(27512): Added shared lib
/data/data/org.caveexpress/lib/libSDL2.so 0x428fabe8
D/dalvikvm(27512): Trying to load lib
/data/data/org.caveexpress/lib/libSDL2_image.so 0x428fabe8
D/dalvikvm(27512): Added shared lib
/data/data/org.caveexpress/lib/libSDL2_image.so 0x428fabe8
D/dalvikvm(27512): No JNI_OnLoad found in
/data/data/org.caveexpress/lib/libSDL2_image.so 0x428fabe8, skipping init
D/dalvikvm(27512): Trying to load lib
/data/data/org.caveexpress/lib/libSDL2_mixer.so 0x428fabe8
D/dalvikvm(27512): Added shared lib
/data/data/org.caveexpress/lib/libSDL2_mixer.so 0x428fabe8
D/dalvikvm(27512): No JNI_OnLoad found in
/data/data/org.caveexpress/lib/libSDL2_mixer.so 0x428fabe8, skipping init
D/dalvikvm(27512): Trying to load lib
/data/data/org.caveexpress/lib/libSDL2_net.so 0x428fabe8
D/dalvikvm(27512): Added shared lib
/data/data/org.caveexpress/lib/libSDL2_net.so 0x428fabe8
D/dalvikvm(27512): No JNI_OnLoad found in
/data/data/org.caveexpress/lib/libSDL2_net.so 0x428fabe8, skipping init
V/SDL (27512): onResume()
V/SDL (27512): onPause()
V/SDL (27512): surfaceCreated()
V/SDL (27512): surfaceChanged()

This strange behaviour leads to a lock and black screen on my phone
while the SDL mainloop is running.

Notice that onPause is triggered by hitting the power button and no
other action is done in between the logs you see there.

Any idea why this happens? Anyone with the same problems? And maybe even
better - anyone with a suggestion how to solve this issue?

Regards
Martin–

http://www.caveproductions.org
http://www.ufoai.org

2014/1/10 Martin Gerhardy <martin.gerhardy at gmail.com>

Hi.

I’m running out of ideas for this one:

The app is restarting automatically when I hit the power button on my S3
(this does not happen on my other devices).

V/SDL (25874): onPause()
V/SDL (25874): nativePause()
D/SensorManager(25874): unregisterListener:: Listener=
org.libsdl.app.SDLSurface at 42913af0
V/SDL (25874): onDestroy()
D/dalvikvm(27512): Trying to load lib /data/data/org.caveexpress/lib/libSDL2.so
0x428fabe8
D/dalvikvm(27512): Added shared lib /data/data/org.caveexpress/lib/libSDL2.so
0x428fabe8
D/dalvikvm(27512): Trying to load lib /data/data/org.caveexpress/lib/libSDL2_image.so
0x428fabe8
D/dalvikvm(27512): Added shared lib /data/data/org.caveexpress/lib/libSDL2_image.so
0x428fabe8
D/dalvikvm(27512): No JNI_OnLoad found in /data/data/org.caveexpress/lib/libSDL2_image.so
0x428fabe8, skipping init
D/dalvikvm(27512): Trying to load lib /data/data/org.caveexpress/lib/libSDL2_mixer.so
0x428fabe8
D/dalvikvm(27512): Added shared lib /data/data/org.caveexpress/lib/libSDL2_mixer.so
0x428fabe8
D/dalvikvm(27512): No JNI_OnLoad found in /data/data/org.caveexpress/lib/libSDL2_mixer.so
0x428fabe8, skipping init
D/dalvikvm(27512): Trying to load lib /data/data/org.caveexpress/lib/libSDL2_net.so
0x428fabe8
D/dalvikvm(27512): Added shared lib /data/data/org.caveexpress/lib/libSDL2_net.so
0x428fabe8
D/dalvikvm(27512): No JNI_OnLoad found in /data/data/org.caveexpress/lib/libSDL2_net.so
0x428fabe8, skipping init
V/SDL (27512): onResume()
V/SDL (27512): onPause()
V/SDL (27512): surfaceCreated()
V/SDL (27512): surfaceChanged()

This strange behaviour leads to a lock and black screen on my phone while
the SDL mainloop is running.

Notice that onPause is triggered by hitting the power button and no other
action is done in between the logs you see there.

Any idea why this happens? Anyone with the same problems? And maybe even
better - anyone with a suggestion how to solve this issue?

If you get sent a onDestroy message when you press the power button, it’s
most likely something missing in the AndroidManifest.xml, specifically in
the android:configChanges property. Are you using the default SDL project,
any customizations?–
Gabriel.

If you get sent a onDestroy message when you press the power button,
it’s most likely something missing in the AndroidManifest.xml,
specifically in the android:configChanges property. Are you using the
default SDL project, any customizations?

Hi

I’m using a modified manifest. I will check for diffs - thanks for the
hint (would have never guessed that)

Regards
Martin–

http://www.caveproductions.org/


https://twitter.com/MartinGerhardy

In my oppinion my manifest looks fine

here it is:

<?xml version="1.0" encoding="utf-8"?>

 <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="13" />

 <!-- OpenGL ES 2.0 -->
 <uses-feature android:glEsVersion="0x00020000" />

 <uses-permission android:name="com.android.vending.BILLING" />

 <!-- Allow writing to external storage -->
 <uses-permission 

android:name=“android.permission.WRITE_EXTERNAL_STORAGE” />

 <!-- Network and ads -->
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission 

android:name=“android.permission.ACCESS_NETWORK_STATE” />

 <application
     android:label="@string/app_name"
     android:icon="@drawable/icon"
     android:allowBackup="true"
     android:name="CaveExpressApp"
     android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
     android:hardwareAccelerated="true">
     <activity
         android:name="CaveExpress"
         android:label="@string/app_name"
         android:screenOrientation="sensorLandscape"
         android:configChanges="keyboardHidden|orientation">
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category 

android:name=“android.intent.category.LAUNCHER” />




 <meta-data android:value="true" 

android:name=“ADMOB_ALLOW_LOCATION_FOR_ADS” />

http://www.caveproductions.org/


https://twitter.com/MartinGerhardy