Skip to main content
Known Participant
November 2, 2011
Question

Android for amazon market - how to pause on call

  • November 2, 2011
  • 20 replies
  • 3915 views

Hi, I submitted my apk file to amazon and it was rejected because it does not pause when a call interrupts. I'd heard about this and tried to find the code to do this, but whatever I tried did not publish in Flash 5.5, air 2.7

Can anyone tell me the exact code to place on the first frame of my flash file? I'm not using an external class. I'm not on my computer now, but the line 'if capabilities = ARM' etc.. Always threw out an error.

I hope someone has the answer to this common problem!

Thanks,

Matt

This topic has been closed for replies.

20 replies

Colin Holgate
Inspiring
November 2, 2011

You have to import class files for the errors to not happen. You'll probably need these ones:

import flash.desktop.NativeApplication;

import flash.desktop.SystemIdleMode;

import flash.system.Capabilities;

import flash.system.System;

Then, to know when a call is coming in you would add listeners for deactivate and activate. Here's how those lines might look:

if (Capabilities.cpuArchitecture == "ARM") {

NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, handleDeactivate, false, 0, true);

}

The handelActivate and handActivate functions would deal with coming back from a call, or going to a call. That's where you would pause any animations, and stop any sounds, and then restart them when the user returns.

monkey500Author
Known Participant
November 2, 2011

Thanks Colin,

I'll get my friend to try out the code.

monkey500Author
Known Participant
November 14, 2011

Hi guys, Amazon has rejected my app again. Each update takes them a week to reply, so it's really annoying.

All I did was tick the 'READ PHONE STATE' which is supposed to pause audio when a call interrupts, but this didn't help.

I have these errors below. Issue 3 is ridiculous - I set it to 'Get Air from Android market' in Flash! I have an updated 'markets.xml' file, but this did

not seem to trigger the right link. Is it normal that the Google link is set to a blank url?

<market name="Google Android Market" url=""/>
<market name="Amazon Appstore" url="http://www.amazon.com/gp/mas/dl/android?p=com.adobe.air"/>

The app has failed the following test cases:

Issue 1: The application audio can still be heard on the Home screen if the user navigates away from the application by pressing the Home or Back key. Steps to reproduce: 1. Launch the application 2. Select either story mode but ensure sound is enabled 3. Press the Home key or Back key 4. Notice while the user is at the Home screen the audio is still generated from the background

Issue 2: If the user receives a voice call while the application is running the application audio will continue during the call. Steps to reproduce: 1. Launch the application and select 'Story with Narration' 2. Receive and end a voice call while the audio is running 3. Notice the application audio continues during the voice call

Issue 3: If the user selects to launch the application they will be notified that the application requires Adobe Air. If the user selects to install they will be taken to the Android Market. Steps to reproduce: 1. Launch the application 2. Select 'Install' on the Adobe Air notification screen 3. Notice the user is prompted to download from Android Market


My friend tried the code below on an Android phone, and it works well, but it closes down the app. I've heard Amazon will also reject this, so how would I pause the sound instead?

Surely Adobe has a quick fix for this!

Thanks,

Matt

import flash.desktop.NativeApplication;

import flash.desktop.SystemIdleMode;

import flash.system.Capabilities;

import flash.system.System;

             if(Capabilities.cpuArchitecture=="ARM")

                 {

  1. NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, handleActivate, false, 0, true);

  1. NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE , handleDeactivate, false, 0, true);

  1. NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, handleKeys, false, 0, true);

    }

    function handleActivate(event:Event):void

    {

  1. NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;

    }

    function handleDeactivate(event:Event):void

    {

NativeApplication.nativeApplication.exit();

    }

    function handleKeys(event:KeyboardEvent):void

    {

    if(event.keyCode == Keyboard.BACK) {

NativeApplication.nativeApplication.exit();

    }

    }