applicationSuspend event sent "too late"

I did this but… same problem.

Home button pressed then game paused when i restart the game

Power button pressed game not paused when i restart the game

I even removed pausedgame ( ) and tried something simpler but did nothing.

Placed a button in the middle of the screen.

somebutton.isVisible=false

if event.type == “applicationSuspend” then

           somebutton.isVisible = true

It looks like applicationSuspend event is not available before a forced termination and still not available on restart!

Hi @Odijack,

I’m glad that you got this working, even though it’s a “workaround” solution. Would you be willing to compile an official bug report using your previous test case, so we can investigate and fix this issue in the next public build? I’d like to see it fixed, and a test case is the best way to prioritize that it happens.

In any case, your method should be fine except if you use any “native” objects like the soft keyboard, native text input fields/boxes, or banner ads. These things are dependent on the orientation of the device, so if you use them, they’ll probably be rotated 90 degrees.

Anyway, let me know about the bug report, and I’ll instruct you on what’s required to submit it (and where to send it).

Thanks,

Brent

Hi @Brent Sure,i would like to compile an official bug report!

Hi @Odijack,

Is this happening on iOS or Android? Also, do you still have (or can you get) Build 971… the previous public build… and test on that as well? I think some very minor handling of the system events occurred around Build 1052-1053, so I’d like to see if anything varies between 971 and 1076.

Brent

Just used Build 971 and works fine.

Btw media library is a mess compared to audio library.Check the orientation - audio - power button bug too.(Works fine in Build 971 too)

Who could release a game with these 2 problems?

Can i get Build 971 without forced watermark/splash screen? :smiley:

Odijack,

I can’t reproduce this issue either.  That said, I don’t have the same devices you have to test with.  The closest equivalent that I have is a Samsung Galaxy SII, model GT-I9100 and OS version 2.3… but I’ve tested this with several other devices as well.

I tested with sample app “Media/AudioPlayer” that is included with the Corona SDK.  That sample app uses the audio library.  Pressing the power button off does indeed stop audio playback for me… and audio resumes when clearing the screen lock on the Android device.  I’ve also tried setting up the app as landscape just like you, but it still disabled audio correctly when pressing the power button.

Can you try testing with that sample app as well please?

When running the app, tap the “Loop” button and then the “Play” button to make it play audio continuously.

The point of this test is to isolate the root cause of this issue.  To see if it is device specific… or if there is something in your code that is somehow triggering this behavior.  Once we’re able to reproduce this issue on our end, then we can do something about it or possibly recommend a work-around if possible.

Brent, thanks for clarification on applicationSuspend not getting to app. I’ve been debugging a problem and see I’ve got to be more proactive about saving the game state so a power off doesn’t kill the progress made so far.

Joshua,

the sample you tested is portait oriented.The issue i described occurs in landscape!I have explained it in previous post.

Guys you are driving me crazy…

Odijack,

Yes, I know your app is landscape.  If you see my above post, I’ve already tried testing with a landscape app too and was still unable to reproduce it.  Can you try the tests in my above post please?

I understand these things can be frustrating and we honestly want to help out, but we can’t help until you help us isolate and reproduce the issue.  Odds are there is something more to this.  There are a lot of Corona made apps that are landscape-only out there, and if it was as simple as that, then we would have received a lot of feedback about this.  But so far it’s just you guys, which tells me that there may be something else about how your app is set up that is triggering this behavior.

Joshua and Brent

I appreciate your help and “driving me crazy” statement wasnt appropriate :slight_smile:

Its really frustrating because with build 971 the same code works flawless.

I will try the tests.

Joshua 

i just did the test.In portrait mode everything works fine.

Then i changed “portrait” to “landscapeRight” in build.settings and i have the same problem!The sound keep playing forever if i press power button!

To be specific.In build.settings inside AudioPlayer folder i did this:

default = “landscapeRight”,

        supported = { “landscapeRight” }

This sounds like a device specific issue then, because I’ve set up that sample app exactly like you did.

I do know some Android devices force apps into orientations that they don’t support when doing animated screen transitions.  For example, the SII and SIII are guilty of this.  Corona suppresses these events and prevents Lua listeners getting called while the app is in an orientation that it doesn’t support until the Android OS transitions it to an orientation that it does support.  This prevents launch issues where your landscape app will be initially launched as portrait, because no Corona developers (especially coming from iOS) expects to receive orientation events from a fixed orientation app, thus never re-laying out the screen.  Unfortunately, this is a common issue on Android.  I’ve just never seen this happen while leaving an app; only when transitioning to (ie: starting/resuming) the app.  In any case, that’s the long winded explanation, if in fact that’s the cause.

We’ll have to do more testing on our end to figure out how to reproduce this issue with our current devices.

In the meantime, I recommend that you just exclude support for the devices that exhibit this behavior via the Google Play’s developer console.

Everything works fine in previous build.I think this is a very important comment!Why do you ignore this?

Sound is not the only problem with power button.It’s just one of them!

In iOs same code works perfectly.

I have tested 2 devices and both had the same problem.

We have worked hard for so long for nothing.

Hi Odijack,

I know you’ve worked hard on this, but you’ll have to be patient. We’re not “ignoring” this… but clearly this is a very isolated issue on a pair of Android devices (of which there are thousands), using a specific build configuration, a specific set of APIs (audio), and occurring only on a particular user action (pressing the power-off button). I’ve never once heard of this behavior, and Joshua has only seen rare/isolated cases of it (he’s vastly more versed on Android than I am, by the way).

Also, you reportedly had the audio working before. So what is the issue now?

Brent

I used media library but its a mess.So i switched back to audio library and im waiting for a solution.

If we solve the sound problem i have more.All related to power button and the latest build!

Why does the media library not suit your needs? You stated that you had some simple sound effects and music. The media library should handle that just fine.

What are your other issues? You’ve reported the sound thing, and the potential pause issue.

I never said that i have simple sound effects and music.I have 8 different music themes and 9 sound effects.

Read my post again.I just did a simple project ,afterwards, using a simple mp3 file to check the problem.

When we solve this problem i will write about my experience with media library and the other problems.

Tomorrow i will test in galaxy s 3 and (hopefully) some other devices.

The devices are not available today.Probably tomorrow.

In galaxy s 3 game works perfectly!

Working devices so far:

Galaxy S 3 

Galaxy S 2 i9100 (2.3) Joshua test

Bad :stuck_out_tongue: devices:

Galaxy S i9000 (2.2)

Galaxy mini 2 (2.3.6)

i9100 and mini 2 have the same OS version but there is problem only with mini 2.Is it the device then?

How could i know which devices to support?Is there any chance to check what changed in latest public build and caused us so many problems?

Now what?Game supposed to be released in a few days and im diasappointed with this situation…

Hi @Odijack,

Thanks for the update (and testing). Did you say that the problems were non-existant in Build 971 on the same devices? You’re free to deploy using that… and there has never been (and likely never will be) a Corona “splash screen”, even for Starter users.

The only thing I know that changed very slightly between the two public builds (related to your issue, I mean) was a minor adjustment of how the system events are handled. I don’t believe there were any significant changes to the audio library.

Brent