java - How to test a project using wifi connection on Genymotion emulator? -
i try test project wifi connection : use genymotion emulator 4.2.2 emulator detect wifi/3g connection in project can't connect localhost
it necessary change code or configuration on emulator?
code :
public class connectiondetector { private context _context; public connectiondetector(context context){ this._context = context; } /** * checking possible internet providers * **/ public boolean isconnectingtointernet(){ connectivitymanager connectivity = (connectivitymanager) _context.getsystemservice(context.connectivity_service); if (connectivity != null) { networkinfo[] info = connectivity.getallnetworkinfo(); if (info != null) (int = 0; < info.length; i++) if (info[i].getstate() == networkinfo.state.connected) { return true; } } return false; } }
in homefragment :
connectiondetector cd; // check if internet present if (!cd.isconnectingtointernet()) { // internet connection not present alert.showalertdialog(registeractivity.this, "internet connection error", "please connect working internet connection", false); // stop executing code return return; }
genymotion's emulator works using oracle vm virtualbox, virtualbox install driver direct connection between computer internet connection , emulator's. dis try accessing webpage android webbrowser inside emulator? if can acces webpage maybe there wrong inside app but, if cant, advise on reinstallling vm virtualbox or directly asking genymotion support
Comments
Post a Comment