arielceb commented on issue #1007:
URL: 
https://github.com/apache/cordova-android/issues/1007#issuecomment-650568043


   the first button get a string value from sharedpreferences
   
   
   public  String GetUrl() {
                SharedPreferences prefs =  
context.getSharedPreferences("managerNet", Context.MODE_PRIVATE);
                SharedPreferences.Editor editor = prefs.edit();         
                editor.commit();
            return prefs.getString("URL", "");  
        }
   
   and the second button deletes a file
   
        public String DeleteUrlTxt()throws Exception {
                String res = "";
   
                 File file = new File("/mnt/sdcard/ManagerMovil/url.txt");
                 if(file.exists()){
                        try {
                                file.delete();
                        } catch(Exception e) {
                                throw e;
                        } 
                 }
                 return "OK";
        }
   
   all using our plugin
   
   GetUrl: function (successCallback, errorCallback) {
           var error = errorCallback;
           if (error == null)
               error = ErrorMovilEngane;
   
           cordova.exec(function (res) {
               if (VidarRespuesta(res))
               successCallback(($.parseJSON(res)).Res);
           }, error, "MovilEngine", "GetUrl", []);
       },
   
   DeleteUrlTxt: function (successCallback) {
           var error = ErrorMovilEngane;
           cordova.exec(function (res) {            
               if (VidarRespuesta(res))
                   successCallback(res);
           }, error, "MovilEngine", "DeleteUrlTxt", []);
       },
   
   var VidarRespuesta = function (pOjb) {
   
   
       var pOjb2 = $.parseJSON(pOjb);
   
       var res = true;
       if (pOjb2.TypeRes == 1) {
           //console.log("VidarRespuesta Res1: " + pOjb2.Res);
           usHelpers.Message.Progress.hide();
           usHelpers.Message.Alert(pOjb2.Res);        
           res = false;
       }
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to