In my Phonegap 3.4 application I have to check the Network Connection before enter in to the application and in the conformation box I have to call the Android system's Wireless & Network setting page. Is there any custom plugin to do this task? Your response will be appreciated. Thanks in advance. I have tried this answer Best way to call activity Method with Phonegap 3.0 from js but not working in Phonegap 3.4.
Asked
Active
Viewed 407 times
1 Answers
0
first u will call function that body in android activity class.Than on button click you can check that your internet connectivity is true or false.
This is html code sample:
<html> <head> <script language="javascript"> function js1() {
document.loginform.method="post"; document.loginform.action = "https://example.com/chechlogin.asp";
}
</script> </head> <body> <form name="loginform">
<input type="text" name="empcode" value="58686" /><br/>
<input type="password" name="emppassNTL" />
<input type="submit" name="submit" id="submit_id" onclick="login.performclick();" />
browser.addJavascriptInterface(new Object()
{
here is sample java class or android activity
@JavascriptInterface
public void performClick()
{
ConnectivityManager cm = (ConnectivityManager)
getSystemService(this.CONNECTIVITY_SERVICE);
NetworkInfo ni = cn.getActiveNetworkInfo();
if (null == ni)
return false;
return ni.isConnectedOrConnecting();
}
}, "login");

Faisal Ashraf
- 1,456
- 1
- 12
- 11