com.lampa.startapp
com.lampa.startapp copied to clipboard
Example to add alarm to alarm manager - Error
Hi all and happy new year!!!! I was trying to set an alarm with the following code:
var sApp = startApp.set({ /* params */
"action":"android.intent.action.SET_ALARM",
"noParseAction": true
}, {
"android.intent.extra.alarm.MESSAGE":"New Alarm",
"android.intent.extra.alarm.HOUR":17,
"android.intent.extra.alarm.MINUTES": 30
});
sApp.start(function(success) {
console.log(success);
}, function(error) {
console.error(error);
});
I also added the following permission in the manifest
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
But I get the following error:
class java.lang.NoSuchFieldException: No field android.intent.action.SET_ALARM in class Landroid/content/Intent; (declaration of 'android.content.Intent' appears in /system/framework/framework.jar)
How can I solve? I'm trying on a galaxy A7 - Android marshmallow Thanks a lot.
Hi!
Please, change noParseAction
to noParse
. Its my error in docs.
@lampaa thanks a lot! I found other error in docs:
sApp.start(function(success) { console.log(success); }, function(error) { console.error(success); });
inside function error there is "console.error(success)" but success is not defined. the right solution is "console.error(error)"
@Danyzzz fixed, thx)
I can fix this by replacing "action":"android.intent.action.SET_ALARM" by "intent":"android.intent.action.SET_ALARM".