Open file with default Android / IOS app

Good evening, I’m really needing to open local files with standard apps on Android / IOS, how do I do this?
Thank you

1 Like

Hey @programacaotwt,

Can you elaborate on what you mean by this? What is the exact behavior you want to implement?



Sorry for my english.

I need to open a PDF / DOC file by my application, I do not want to visualize inside but use Android’s own applications.

I made an application in Delphi Firemoney and use the routine to open applications:

    ExtFile: = AnsiLowerCase (StringReplace (TPath.GetExtension (Path), '.', '', []));

    mime: = TJMimeTypeMap.JavaClass.getSingleton ();

    ExtToMime: = mime.getMimeTypeFromExtension (StringToJString (ExtFile));

    Intent: = TJIntent.Create;
    Intent.setAction (TJIntent.JavaClass.ACTION_VIEW);
    Intent.setDataAndType (StrToJURI ('file:' + Path), ExtToMime);

    TAndroidHelper.Activity.startActivity (Intent);
    TAndroidHelper.Activity.finishActivity (0);

Error OpenURL : Could not open URL
file:///data/user/0/host.expo.exponent/files/ExperienceData/%2540gooddog%252itransfuse/iTransfuseAppCache/BP/RC/rc.pdf: file:///data/user/0/host.expo.exponent/files/ExperienceData/%2540gooddog%252itransfuse/iTransfuseAppCache/BP/RC/rc.pdf exposed beyond app through Intent.getData()

I do not want to view inside my application, but open the file. Thank you.

I have the same problem. On the Expo site there are some examples to download the file(, I use the FileSystem.downloadAsync function to download the file. The file is downloaded but there is no example to display/open a downloaded file.

When I use the following code to view in the default application. Intent is started but my downloaded file isn’t displayed.
var uri = “file:///data/user/0/host.expo.exponent/files/test.pdf”
IntentLauncherAndroid.startActivityAsync(“android.intent.action.VIEW”, null, uri);

What do I need to implement to get this working?

1 Like

I’m also interested in this feature.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.