pol2095 I'm using this code:
protected function btnPdf_clickHandler():void
{
try{
OpenWithDefaultApplication.extension.addEventListener(PermissionEvent.PERMISSION_STATUS, permissionStatusHandler); //for APK file
var file:File = File.userDirectory.resolvePath("test.txt");
OpenWithDefaultApplication.open(file.url);
}catch (error:Error) {
trace(error.name + ": " + error.message);
}
}
private function permissionStatusHandler(event:PermissionEvent):void //for APK file
{
if( event.status == "trusted" )
{
OpenWithDefaultApplication.install();
}
}
And I put this on application.xml file:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.PERMISSION_NAME" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="air.com.openWithDefaultApplication.Test.openwithdefaultapplication_provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/openwithdefaultapplication_provider_paths"/>
</provider>
</application>`
Now it ask to the user which pdf reader he wants to open the pdf file but when it opens the pdf reader app (for example: adobe acrobat reader) it gives me this error: "Impossible to open the file"... Am I missing something? Bare in mind that that I'm trying to open a file that i didn't create.