0 Favourites

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

  • 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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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?

  • 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.

  • 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?

  • 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.

  • 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.

  • 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.

  • 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".

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)