Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Android API

wkh237 edited this page Sep 29, 2016 · 6 revisions

RNFetchBlob.android

android.actionViewIntent(path, mime):Promise

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:string

Path of the file to be opened.

mime:string

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')
Clone this wiki locally