NativeScript / nativescript-background-http

Background Upload plugin for the NativeScript framework
Apache License 2.0
101 stars 50 forks source link

Android 9.0 not working with version 3.4.0 and {N} 5.1 #206

Closed mspusta78 closed 5 years ago

mspusta78 commented 5 years ago

On android 9.0 (Pixel 3XL)

{N} version 5.1

"nativescript-background-http": "^3.4.0"

calling session.uploadFile errors out

JS: propertyChangeData property name = status propertyValue= error JS: error = {"eventName":"error","object":{"_observers":{"progress":[{}],"error":[{}],"complete":[{}],"propertyChange":[{}]},"_session":{"_id":"image-upload"},"_id":"image-upload{1}","_description":"{ 'uploading': 'VID_1552057929892.mp4' }","_upload":0,"_totalUpload":1,"_status":"error"},"error":{},"responseCode":-1,"response":null}

I tried to to explicitly request permission to permissions.requestPermission(android.Manifest.permission.FOREGROUND_SERVICE

but that did not solve the issue.

Martin

mspusta78 commented 5 years ago

I found the issue that is impacting the

In my AndroidManifest.xml I have .... <application android:networkSecurityConfig="@xml/network_security_config"

My "@xml/network_security_config" contains the following:

127.0.0.1 localhost

Removing android:networkSecurityConfig="@xml/network_security_config" from the AndroidManifest file solved the issue

Is it possible to use: android:networkSecurityConfig="@xml/network_security_config"

If so, what values do we need to add to "@xml/network_security_config" file?

NickIliev commented 5 years ago

@mspusta78 see here about details on network_security_config. Basically, you can specify specific domains that can be accessed through this config (all other requests will be denied). You can also pass security certificates for additional security.