com.lampa.startapp icon indicating copy to clipboard operation
com.lampa.startapp copied to clipboard

Example to add alarm to alarm manager - Error

Open Helpquake opened this issue 5 years ago • 4 comments

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.

Helpquake avatar Jan 02 '19 11:01 Helpquake

Hi!

Please, change noParseAction to noParse. Its my error in docs.

lampaa avatar Jan 14 '19 08:01 lampaa

@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 avatar Jan 14 '19 14:01 Danyzzz

@Danyzzz fixed, thx)

lampaa avatar Jan 14 '19 14:01 lampaa

I can fix this by replacing "action":"android.intent.action.SET_ALARM" by "intent":"android.intent.action.SET_ALARM".

jrpereirajr avatar Jun 12 '20 21:06 jrpereirajr