android.os.NetworkOnMainThreadException
Using this module on NS view-model i get NetworkOnMainThreadException, Im confused since documentation states:
- Everything runs on a native background thread
Im using: https.enableSSLPinning({ host: '192.168.1.15', certificate, allowInvalidCertificates: false, validatesDomainName: false })
I am getting the same error. any Help?
+1
+1
+1
@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())
})
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?
@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?
This issue makes the plugin unusable.
+1
@vallemar could you explain a bit more what s happening for you?