I'm creating an app using flash cc. I needed storage permission. It turns out I needed to ask user the permission for using storage devices. I can ask user for permission and it is working fine. I use examples from this website: https://helpx.adobe.com/flash-player/release-note/fp_24_air_24_release_notes.html
But my problem is I wasn't able to capture the complete event for accessing the storage permission. Because of that I couldn't run codes after I get access to storage. Is it possible to capture complete event for granting any permission?
the code I used:
var file:File = File.documentsDirectory.resolvePath("somefile.txt");
trace("url_txt:" + file.url);
file.addEventListener(PermissionEvent.PERMISSION_STATUS, function permissionStatusHandler(e:PermissionEvent):void
{
file.removeEventListener(PermissionEvent.PERMISSION_STATUS, permissionStatusHandler);
if(e.status == PermissionStatus.GRANTED)
{
myTextLoader.load(new URLRequest(file.url));
myTextLoader.addEventListener(Event.COMPLETE, onLoadTextComp);
myTextLoader.addEventListener(IOErrorEvent.IO_ERROR, loadingTextError);
}
else
{
showPermissionError();
}
}
);
try
{
trace("Requesting permission");
file.requestPermission();
}
catch(error:Error)
{
trace("Request permission error");
}
UPDATE:
The above code seems to work fine. But the problem occurs when I tried to request for same permission twice at different time. I've another question. Can we add description while we request permission? A lot of app seems to be adding description why the app need that particular permission. Is it possible do achieve this from flash as3? I've looked into web but couldn't find anything. And how to request permission for READ_PHONE_STATE
?