forked from wkh237/react-native-fetch-blob
-
Notifications
You must be signed in to change notification settings - Fork 791
Android API
wkh237 edited this page Aug 7, 2016
·
7 revisions
0.9.0
When sending an ACTION_VIEW
intent with given file path and MIME type, system will try to open an App to handle the file. For example, open Gallery app to view an image, or install APK.
Path of the file to be opened.
Basically system will open an app according to this MIME type.
For example, download and install an APK programatically
const android = RNFetchBlob.android
RNFetchBlob.config({
addAndroidDownloads : {
useDownloadManager : true,
title : 'awesome.apk',
description : 'An APK that will be installed',
mime : 'application/vnd.android.package-archive',
mediaScannable : true,
notification : true,
}
})
.fetch('GET', `http://www.example.com/awesome.apk`)
.then((res) => {
android.actionViewIntent(res.path(), 'application/vnd.android.package-archive')
})
Or show an image in image viewer
android.actionViewIntent(PATH_OF_IMG, 'image/png')