0

I am creating phonegap project using cordova 3.4.0. I check the network connect is enable on while start the application. I installed cordova network-information plugin. The following codes are i am using.

if(navigator.network.connection.type == Connection.NONE){
    alert("nocon");
}else{
    alert("yescon");
}

It's working fine. But i want to display conform box for no network connection. One button for settings and another one for cancel. If i click setting button, it will go to wifi-setting option. And if i click cancel button, app will exit. How can i do this. Please guide me.

benka
  • 4,732
  • 35
  • 47
  • 58
  • I don't think you can access the native network settings tab cross platform without writing a plugin. – MBillau May 13 '14 at 13:13
  • How can i write a new plugin. Can you give any example for that? –  May 13 '14 at 13:15

1 Answers1

0

on Click call the below function,

onclick="showConfirm();

and on js file add as below,

function showConfirm() {
        navigator.notification.confirm(
            'Your message here!',   // message
            onConfirm,              // callback to invoke with index of button pressed
            'Your title',           // title
            'Options,Exit'          // buttonLabels
        );
    }

function onConfirm(buttonIndex) {
        //Do the magic here.
    }

If you are satisfied with the answer then please click accept.

locknies
  • 1,345
  • 3
  • 15
  • 36