Skip to content

Can't download file with http domain url in android 9 pie #351

@ganesh98a

Description

@ganesh98a

Hi ! i am using rnfetchblob to download the file using get method through HTTP domain url. it's not working in android 9 pie version only. also i have tried and cross check with android behavior changes of version update

here my code

const { config, fs } = RNFetchBlob;
 let options = {
        
        addAndroidDownloads: {
          fileCache: true,
          path: PictureDir + '/RFIs' + Math.floor(date.getTime() + date.getSeconds() / 2) + '.pdf',
          useDownloadManager: true,
          notification: true,
          mediaScannable: true,
          path: PictureDir + '/RFIs' + Math.floor(date.getTime() + date.getSeconds() / 2) + '.pdf',
          description: 'Downloading.',
          mime: 'application/pdf'
        }
      };
pdfData='http://...';
config(options).fetch('GET', pdfData).then((res) => {
});

Behavior changes are applied
Manifest file *****

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.fulcrum">
 <application 
        xmlns:tools="http://schemas.android.com/tools"
        android:name=".MainApplication"
        android:allowBackup="true"
         android:usesCleartextTraffic="true"
        android:networkSecurityConfig="@xml/network_security_config"
        >
        <uses-library android:name="org.apache.http.legacy" android:required="false"/>
</application>
</manifest>

network_security_config.xml*****

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config>
</network-security-config>

React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz
Memory: 1.39 GB / 7.84 GB
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
React-native version
"react": "16.8.3",
"react-native": "0.59.5"
"rn-fetch-blob": "^0.10.13"

Note: it's working with HTTPS domain url with above code & environment setup

Will you pls get me out to solve this.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions