Network requests blocked on real device

plugins

#1

While building one of my first applications with NativeScript, it is found that authentication and network requests are not triggered on the tap events for my login page. A socket request is made, but the outbound request never makes it to the server.

plugin dependencies:

┌──────────────────────────┬─────────┐
│ Plugin │ Version │
│ nativescript-socketio │ ^2.4.0 │
│ nativescript-theme-core │ ~1.0.4 │
│ nativescript-ui-listview │ ^3.5.1 │
│ tns-core-modules │ ~3.4.0 │
└──────────────────────────┴─────────┘
Dev Dependencies:
┌─────────────────────────────┬─────────┐
│ Plugin │ Version │
│ babel-traverse │ 6.4.5 │
│ babel-types │ 6.4.5 │
│ babylon │ 6.4.5 │
│ css-loader │ ~0.28.7 │
│ lazy │ 1.0.11 │
│ nativescript-dev-typescript │ ^0.6.0 │
│ nativescript-worker-loader │ ~0.8.1 │
│ raw-loader │ ~0.5.1 │
│ resolve-url-loader │ ~2.2.1 │
│ typescript │ ^2.7.2 │
└─────────────────────────────┴─────────┘

manifest permissions:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

code-behind landing page example:

var socketService = require("…/…/shared/view-models/socketio-service");
var socket = new socketService([]);

exports.loaded = function(args) {
page = args.object;
page.bindingContext = UserViewModel;
var view = page.getViewById(“logo”);
view.opacity = 0;
view.animate({
opacity: 1,
duration: 1500
});
console.log(“login page loaded…”);
socket.socketio.connect();
};

Everything runs fine in the simulator.

Thanks in advance!!!


#2

Is it specific to platform, if then it is iOS or Android where you face this issue?

Do you think this happens only with socket io, did you give a try for usual http calls?


#3

Thanks for your response manoj. It was found that the test device was on wrong private wi-fi and test server wasn’t reachable.