cordova-plugin-wakeuptimer-ef
Advanced tools
Comparing version 1.0.6 to 1.0.7
{ | ||
"name": "cordova-plugin-wakeuptimer-ef", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Wakeup Plugin", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -47,2 +47,3 @@ # Wakeup/Alarm Clock PhoneGap/Cordova Plugin | ||
// set wakeup timer | ||
// important: if the app will be ran on Android 14+ or published on GooglePlay, check the next note | ||
window.wakeuptimer.wakeup( | ||
@@ -69,2 +70,32 @@ successCallback, errorCallback, | ||
// --------------------------------------------------------------------------- | ||
// --------------------------------------------------------------------------- | ||
// ----------------------- IMPORTANT FOR ANDROID USAGE ----------------------- | ||
// --------------------------------------------------------------------------- | ||
// --------------------------------------------------------------------------- | ||
/* | ||
Starting on Android 14 (SDK 34), the android doesn't auto grant permission to schedule an alarm, | ||
this permission can't be granted programatically, requiring the user to grant it on the app settings, | ||
so before schedule an alarm via the `window.wakeuptimer.wakeup`, should be checked the permission, | ||
if it's not granted, can be displayed to the user an option to open the settings and change it manually | ||
*/ | ||
// checking if the app has the alarm permission | ||
window.wakeuptimer.checkAlarmPerm( | ||
function (allowed) { | ||
console.log('Alarm permission already granted? ', allowed ? 'yes' : 'no'); | ||
// do something... | ||
}, | ||
errorCallback, | ||
); | ||
// open app alarm settings | ||
window.wakeuptimer.openAppAlarmSettings( | ||
function (opened) { | ||
console.log('App notification settings opened? ', opened ? 'yes' : 'no'); | ||
// do something... | ||
}, | ||
errorCallback, | ||
); | ||
// ******************************************************************/ | ||
@@ -84,3 +115,3 @@ // *** All methods below are Android Only and its use is OPTIONAL ***/ | ||
function (allowed) { | ||
console.log('Permission already granted? ', allowed ? 'yes' : 'no'); | ||
console.log('Notification permission already granted? ', allowed ? 'yes' : 'no'); | ||
// do something... | ||
@@ -93,3 +124,3 @@ }, | ||
function (allowed) { | ||
console.log('Permission was granted? ', allowed ? 'yes' : 'no'); | ||
console.log('Notification permission was granted? ', allowed ? 'yes' : 'no'); | ||
// do something... | ||
@@ -96,0 +127,0 @@ }, |
@@ -45,2 +45,10 @@ var exec = require("cordova/exec"); | ||
Wakeup.prototype.checkAlarmPerm = function (success, error) { | ||
exec(success, error, "WakeupPlugin", "checkAlarmPerm", []); | ||
}; | ||
Wakeup.prototype.openAppAlarmSettings = function (success, error) { | ||
exec(success, error, "WakeupPlugin", "openAppAlarmSettings", []); | ||
}; | ||
Wakeup.prototype.wakeup = function (success, error, options) { | ||
@@ -57,3 +65,2 @@ exec(success, error, "WakeupPlugin", "wakeup", [options]); | ||
module.exports = Wakeup; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
102534
1481
252