Skip to main content
Known Participant
May 15, 2018
Question

I can not set the iOS MicroPhone permission with AIR SDK 24 or higher.

  • May 15, 2018
  • 3 replies
  • 4446 views

I can not set the iOS MicroPhone permission with AIR SDK 24 or higher.

I am using AIR 23 and are working on solutions in relation to the following two articles.

Adobe Air SDK 29 is not accepted by Apple

Adobe Air SDK 29 is not accepted by Apple

The application was rejected from the APP store yesterday.

Unable to set iOS camera permissions with AIR SDK 24

Unable to set iOS camera permissions with AIR SDK 24

Camera permissions could be solved in the following way.

12/13/2016 - Release - AIR 24 Runtime and SDK

cam.requestPermission();

However, setting microphone permissions tried up to AIR 24-29, but it does not work.

mic.requestPermission();

I also tested AIR 30 Beta, but it was useless.

The iOS application terminates abnormally with this description.

It seems to be supported by third party ANE, but is there a function with AIR standard ?

https://www.myflashlabs.com/product/native-access-permission-check-settings-menu-air-native-extension/

This topic has been closed for replies.

3 replies

Participating Frequently
April 1, 2019

My problem (with seeing the Microphone permission alert) was solved. I had misplaced my addition of NSMicrophoneUsageDescription in info.plist as part of another embedded dictionary (NSAppTransportSecurity) instead of being part of the top-level list of keys/values.

Participating Frequently
March 28, 2019

I have an app that is calling Microphone.requestPermission, and the alert is never shown.

The permission status callback handler is called and the status is "denied".

We also define this key in our info.plist:

key>NSMicrophoneUsageDescription</key>

<string>iRead requires microphone access to record students reading.</string>

Must I use the ANE above?

I am currently using AIR 31.

natural_criticB837
Legend
March 29, 2019

I don't know how that works with microphones, but for notifications on iOS, if the user rejects to give the permission the first time he was asked, you can not show the popup again. The only way to enable notifications is then to tell the user to go to system settings and give the permission there. Apple will only show the popup once, not the second or third time you ask the user. Maybe it is similar with the microphone permission?

Participating Frequently
March 29, 2019

In my case, the alert has *never* been shown.

I'm trying to determine how to get it to be shown ever.

Apparently, it should be shown the first time we get requestPermission().

pravishtis
Adobe Employee
Adobe Employee
May 15, 2018

Hi,

Can you please make sure you're using cocoa key NSMicrophoneUsageDescription with AIR 30 in you application descriptor as:

Let us know if you still face issues.

Thanks!

Pravishti | Adobe AIR Engineering

Known Participant
May 15, 2018

Hi 

>Can you please make sure you're using cocoa key NSMicrophoneUsageDescription with AIR 30 in you application descriptor

I tried it.

The microphone request Permission dialog is not displayed and cannot be attached.

I am testing it with simple sample code.(Animate CC 2015 Air 30+iPad OS 10.0.2 or iphone6 11.3.1)

Animate emulator will work without problems.

When you publish an application to the test device, the microphone does not recognize it.
Disabling "microphone" will work.
--------------------------------------------------------------------------------------

import flash.display.Sprite;

import flash.display.StageAlign;

import flash.display.StageScaleMode;

import flash.events.PermissionEvent;

import flash.media.Camera;

import flash.media.Microphone;

import flash.media.Video;

import flash.permissions.PermissionStatus;

var video:Video;

var cam:Camera;

var microphone:Microphone;

var nc:NetConnection = null;

var nsPublish:NetStream = null;          

             

if (Camera.isSupported)

            {

                cam = Camera.getCamera();

                if (Camera.permissionStatus != PermissionStatus.GRANTED)

                {

                    cam.addEventListener(PermissionEvent.PERMISSION_STATUS, function(e:PermissionEvent):void {

                        if (e.status == PermissionStatus.GRANTED)

                        {

                            connectCamera();

                        }

                        else

                        {

                            // permission denied

                        }

                    });

                    try {

                        cam.requestPermission();

                    } catch(e:Error)

                    {

                        // another request is in progress

                    }

                }

                else

                {

                    connectCamera();

                }

            }

function connectCamera():void

{

nc = new NetConnection();

nc.connect("rtmp://Streaming_Server_name:1935/liveapplication_name");

nc.addEventListener(NetStatusEvent.NET_STATUS, ncOnStatus);

}

function ncOnStatus(infoObject:NetStatusEvent)

{

trace("nc: "+infoObject.info.code+" ("+infoObject.info.description+")");

if (infoObject.info.code == "NetConnection.Connect.Success"){

nsPublish = new NetStream(nc);

cam.setMode(640,360, 30);

cam.setQuality(0, 70);

video = new Video(640, 360);

video.attachCamera(cam);

addChild(video);

microphone = Microphone.getMicrophone();

trace("microphone="+Microphone.names);

microphone.codec=SoundCodec.NELLYMOSER;

microphone.rate=44;

microphone.gain=60;

microphone.setSilenceLevel(0);

nsPublish.attachCamera(cam);

nsPublish.attachAudio(microphone);

nsPublish.publish("myStream");

trace("TEST LIVE");

}

}

pravishtis
Adobe Employee
Adobe Employee
May 15, 2018

Hi,

From the code you've attached, mic.requestPermission() is missing. Add this line to your code and let us know if you still face issues.

Thanks!

Pravishti | Adobe AIR Engineering