nativescript-community / https

Secure HTTP client with SSL pinning for Nativescript - iOS/Android
https://nativescript-community.github.io/https/
Other
50 stars 42 forks source link

android.os.NetworkOnMainThreadException #25

Open alromh87 opened 6 years ago

alromh87 commented 6 years ago

Using this module on NS view-model i get NetworkOnMainThreadException, Im confused since documentation states:

Im using: https.enableSSLPinning({ host: '192.168.1.15', certificate, allowInvalidCertificates: false, validatesDomainName: false })

skhye05 commented 6 years ago

I am getting the same error. any Help?

TinusJ commented 6 years ago

+1

AresDev commented 5 years ago

+1

danielGz commented 5 years ago

+1

roblav96 commented 5 years ago

@alromh87

import * as application from 'tns-core-modules/application'
application.android.on('activityCreated', function activityCreated(args) {
    android.os.StrictMode.setThreadPolicy(new android.os.StrictMode.ThreadPolicy.Builder().permitAll().build())
})
tokiroto commented 5 years ago

I wonder, whether there should be a correct implementation of the plugin. Since why this exception happens? If it really runs in the main thread, it might create a problem later. Are there any updates on it?

Update: And yeah, it proves I was right. Now I am working with http request with heavy response, about 30-40 mb (having attachments with base64 strs) at the moment. And it freezes dead the device, and if you attempt to refresh the list it then crashes with OutOfMemory exception. Any solution yet?

a92c commented 4 years ago

@tokiroto nativescript works only on one main thread. For longer requests there will be a freeze or crash of the device.

Any solution for this problem thanks?

jnorkus commented 3 years ago

This issue makes the plugin unusable.

vallemar commented 2 years ago

+1

farfromrefug commented 2 years ago

@vallemar could you explain a bit more what s happening for you?