How do I tell if I'm resuming from a phone call on mobile

Get help using Construct 2

Post » Mon Jul 18, 2016 8:40 am

Hi all,

Does anyone know of a way to tell where my app is resuming from, when on a mobile device.

I need to be able to tell whether its resuming from a phone call or somewhere else. Can anyone think of a way to do this? I'm currently exporting with cordova and building in phonegap.

I'm having a bit of a problem with audio after resuming from a phone call (the audio crashes). So if I can tell when the app is resuming from a phone call, I think I can set up my events to handle that situation in a different way.

Thanks for your advice :)
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Mon Jul 18, 2016 3:45 pm

I don't know the answer to your specific question.... But any reason you don't apply your workaround to all situations of the app resuming?
Mistakes were made.
B
52
S
26
G
109
Posts: 1,616
Reputation: 61,653

Post » Mon Jul 18, 2016 6:12 pm

Hi @oosyrag,

I'm using the cordova media plugin for audio. When the app suspends for things like alert boxes, the audio resumes correctly when the app resumes. But when the app resumes after a phone call, the audio crashes.

I'm hoping that by recognising where the app is resuming from, I will be able to treat phone call resumes differently from alert box resumes.

:)
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Mon Jul 18, 2016 6:26 pm

Well what I meant was if you have a solution to handle the audio crashing when returning from calls, why not do so for everything?
Mistakes were made.
B
52
S
26
G
109
Posts: 1,616
Reputation: 61,653

Post » Mon Jul 18, 2016 8:09 pm

@oosyrag,

To reset the audio after a crash takes some time. I plan to implement a "resuming" page to deal with this pause in the app.

But if the app is suspended for a simple alert box, it can resume without any problem. So it would not require such a lengthy and intrusive reset process.
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Tue Jul 19, 2016 2:36 am

When resuming from a phone call does it act the same as when the app is completely closed then re-opened? I would think an alert would be like an interruption that only pauses, not closes.
ImageImageImage
B
40
S
23
G
11
Posts: 498
Reputation: 10,062

Post » Tue Jul 19, 2016 8:04 am

Hey @badmoodtaylor,

Thanks for your reply.

When the device receives a phone call, the app doesn't close, it just pauses. So when returning from the call the app is resuming, not re-opening.
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Tue Jul 19, 2016 8:32 am

You have the browser "On suspended"/"On resumed" conditions that could do the trick.
As far as I'm aware, alert dialog are not suspending the application, as they are actually part of the OS/browser (Browser alert), so using the before mentioned conditions should only apply when you are actually "suspending" the execution of the application, going to do something else (checking another application, receiving a phone call, etc...) and so should be the best way to go about things.

Otherwise, I don't believe there are internal flags or messages that allows you to check "where you are resuming from".
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,295
Reputation: 70,795

Post » Tue Jul 19, 2016 9:06 am

Thanks for your reply @Kyatric.

We do use the "On suspended" & "On resumed" conditions in the app. When suspending the app in other ways (for example using the devices power button) the audio resumes as normal. But when returning from a phone call the audio crashes. That's why I was looking for a way to distinguish between different types. Oh well, guess I need to look for a different solution.

But I didn't realise that alert boxes don't actually suspend the app though, so that's useful to know :)
B
18
S
4
G
2
Posts: 77
Reputation: 1,588


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 34 guests