Android Question Power Button??

ilan

Expert
Licensed User
Longtime User
hi

i just noticed that when i am in my app and i click the Power Button then the Activity_Pause event will be raised and after a short time the Activity_Create (+ activity_Resume) events will be raised.

why is it like that?

clicking on the HOME button will only call Activity_Pause.

thanx, ilan
 
Last edited:

ilan

Expert
Licensed User
Longtime User
Does it happen with a new project with: #SupportedOrientations set to landscape ?

yes!

I wasn't able to reproduce it here on a device running Android 7.

here is a simple example that always do the same on my samsung s5 (android 6.0.1)

* open app = [activity_create > activity_resume]
* close app via home button = [activity_pause]
* open app again [activity_resume]
* close app via Power button [activity_pause > activity_create > activity_resume]

EDIT: i am using b4a 6.31
 

Attachments

  • test1.zip
    1.9 KB · Views: 440
Upvote 0

ilan

Expert
Licensed User
Longtime User
btw adding this line:

B4X:
SetActivityAttribute(Main, android:configChanges, "orientation|keyboardHidden|screenSize")

will solve the problem. i understand why you said it is incorrect solution because like this no orientation change event will called whenever it will change but in my case it doesnot matter since i am using only landscape mode in my game.
 
Upvote 0
Top