1.0.6 • Published 6 years ago

phonelock-monitor-cordova-plugin v1.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

lock-monitor-cordovaplugin

Lock Monitor Cordova Plugin for fetching all, lock n unlocking timestamps logs of the phone.

Usage

Version'sshould be above
java>=1.7
Cordova>=6.3.0

To use lock-monitor-cordova plugin, Simply Use the Following code to your once you have installed in your project.

//for starting the service 

    window.plugins.lockServiceMethod("", function (s) {
            console.log(s);
        }, function (e) {
            console.log(e);
        });

/*for fetching the jason for all 
 * {
 *[
 *     {
 *         "locked_time":locked time string
 *         "unlocked_time":unlocked time string
 *     },
 *     {
 *         "locked_time":locked time string
 *         "unlocked_time":unlocked time string
 *     },
 *     {
 *         "locked_time":locked time string
 *         "unlocked_time":unlocked time string
 *     }
 * ]
 *
 * 
 * */
    window.plugins.fetchAllPhoneLocksLogsMethod("", function (s) {
            console.log(s);
        }, function (e) {
            console.log(e);
        });

//for setting the url of the json array.
//returns true on set
    var jarr = {"url":"https://myrestserverurl.com"};    
    window.plugins.setRestServerMethod(jarr, function (s) {
            console.log(s);
        }, function (e) {
            console.log(e);
        })       

//for setting the userId -- usually to recognise the user whose lock logs are these of //the json array.
//returns true on set
    var jarr = {"userId":"123"};    
    window.plugins.setUserIdMethod(jarr, function (s) {
            console.log(s);
        }, function (e) {
            console.log(e);
    })     

Sync the Data to the Server

following is the json object that would be synced on Network Change receiver from the plugin.

{
    "userId":<user id set from the function>,
    "data":[
        {
          "locked_time":locked time string
          "unlocked_time":unlocked time string
        },
        {
          "locked_time":locked time string
          "unlocked_time":unlocked time string
        }
    ]
}

Running and Testing

Please install by the following command

cordova plugin add phonelock-monitor-cordova-plugin

Built With

Author

  • Kuldeep Kumar