phonelock-monitor-cordova-plugin
v1.0.6
Published
Lock Monitor Cordova Plugin for fetching all, lock n unlocking timestamps logs of the phone
Downloads
5
Maintainers
Readme
lock-monitor-cordovaplugin
Lock Monitor Cordova Plugin for fetching all, lock n unlocking timestamps logs of the phone.
Usage
| Version's | should 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