Giter VIP home page Giter VIP logo

Comments (25)

zahid313 avatar zahid313 commented on July 24, 2024 14

this is how you create a Alarm

    RNAlarm.setAlarm(Date.parse("2018-01-01T18:40:24Z").toString(),
            'Meeting with customer',
            '', 
            '',
         () => {
           console.log("Event triggered");
         },
         () => {
          console.log("Event trigger Failed");
         });

from react-native-alarm.

rodrigofbm avatar rodrigofbm commented on July 24, 2024 6

It's useless...

from react-native-alarm.

PhilipFlyvholm avatar PhilipFlyvholm commented on July 24, 2024 5

After looking in the IOS code i found this:

RCT_EXPORT_METHOD(setAlarm:(NSString *)triggerTime
                  title:(NSString *)title
                  isRetry:(NSString *)isRetry
                  musicUri:(NSString *)musicUri
                  successCallback:(RCTResponseSenderBlock)successCallback
                  errorCallback:(RCTResponseSenderBlock)errorCallback)

Which means that to set an alarm use:

import RNAlarm from 'react-native-alarm';

RNAlarm.setAlarm(DateAsString,
Title,
Retry? (Don't know what this is),
musicUri (Path to wanted sound),
() => {
// Success callback function
},
() => {
// Fail callback function
});

or short way of showing it:

RNALarm.setAlarm(DateAsString, Title, Retry (Set as '' i guess), musicUri (Set as '' if not used), successCallback, errorCallback);

There is also a clear function which should just be: RNAlarm.clearAlarm();

Important note: I have not tried this out yet. It is just what i have read from the code.

from react-native-alarm.

ylcGithub avatar ylcGithub commented on July 24, 2024 1

how to set a repeat alarm clock ? thanks

from react-native-alarm.

rediceli avatar rediceli commented on July 24, 2024 1

Success usage:

let  d=new Date().getTime();
d=d+300*1000;   /* will alarm 5min later */
RNAlarm.setAlarm(d+'', /* Convert to string */
'alarm',
...

from react-native-alarm.

gumelartejasukma avatar gumelartejasukma commented on July 24, 2024 1

@ffJPabloFlores
This one can use the mp3 file from raw directory in android. Just replace the "android" folder with mine :
https://github.com/gumelartejasukma/react-native-alarm

from react-native-alarm.

smartliang avatar smartliang commented on July 24, 2024

import RNAlarm from 'react-native-alarm';

// TODO: What to do with the module?
RNAlarm.setAlarm('Meeting',
'Meeting with customer',
'',
'',
() => {
// Success callback function
},
() => {
// Fail callback function
});

from react-native-alarm.

maharjanaman avatar maharjanaman commented on July 24, 2024

@smartliang with the usage information provided above, it always gets to fail callback function. Can we have more information on its usages??? Also I tried clearing alarm by calling RNAlarm.clearAlarm(). But it doesnot seems to work and also how to stop alarm thats already playing?

from react-native-alarm.

joaom182 avatar joaom182 commented on July 24, 2024

It's a alarm library, but not have time definition for alarm?

from react-native-alarm.

zahid313 avatar zahid313 commented on July 24, 2024

+1 Please provide more usage description

from react-native-alarm.

smartliang avatar smartliang commented on July 24, 2024

I will provide a usage later. Thanks

from react-native-alarm.

smartliang avatar smartliang commented on July 24, 2024

@joaom182 the time is a parameter.

from react-native-alarm.

ivancheng1214 avatar ivancheng1214 commented on July 24, 2024

Kindly let us know about detailed parameters and order...

from react-native-alarm.

miakachammy avatar miakachammy commented on July 24, 2024

@smartliang , Hello. Can you please provide usage information on how to use your react-native-alarm? It'll be a great help. Thanks a lot.

from react-native-alarm.

rhysmitchell avatar rhysmitchell commented on July 24, 2024

Could you provide the descriptions for the 3rd and 4th parameters of the setAlarm function?
To make it explicit, it might make sense to construct a named alarm object and pass it in. That way, everybody can see what the expected parameters are. Just my two cents πŸ˜„

from react-native-alarm.

quangduz avatar quangduz commented on July 24, 2024

Last reply by smartliang is 1 month ago :)

from react-native-alarm.

miakachammy avatar miakachammy commented on July 24, 2024

@zahid313 Hi, were you able to make this alarm work?

from react-native-alarm.

stereu avatar stereu commented on July 24, 2024

RNAlarm.clearAlarm();
Is not working for me. Somebody else?

from react-native-alarm.

ffJPabloFlores avatar ffJPabloFlores commented on July 24, 2024

@stereu It didn't work for me either. Did you have any luck to setAlarms? Did it work for you?

from react-native-alarm.

ffJPabloFlores avatar ffJPabloFlores commented on July 24, 2024

Was someone able to set an Alarm with react native? using this library or any other library?

from react-native-alarm.

ducpt2 avatar ducpt2 commented on July 24, 2024

@stereu here is my func clear Alarm in RNAlarm.m file:

RCT_EXPORT_METHOD(clearAlarm){
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
NSDictionary *dic = [userDefault dictionaryRepresentation];
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];

for (id key in dic) {
    NSString *identifier1 = [key stringByAppendingString:@"1"];
    NSString *identifier2 = [key stringByAppendingString:@"2"];
    NSString *identifier3 = [key stringByAppendingString:@"3"];
    [center removePendingNotificationRequestsWithIdentifiers:@[identifier1,identifier2,identifier3]];
    [center removeDeliveredNotificationsWithIdentifiers:@[identifier1,identifier2,identifier3]];
    [userDefault removeObjectForKey:key];
}
[userDefault synchronize];

// add this line to remove all.

// [center removeAllPendingNotificationRequests];
}

Not for sure but it work.

from react-native-alarm.

vasyl91 avatar vasyl91 commented on July 24, 2024

Is there any way to display for example splash over the lock screen when the alarm is being triggered?

from react-native-alarm.

LightWills avatar LightWills commented on July 24, 2024

This library doesn't work, Please, what is the library that I can use for a set or rename alarm with react native?

from react-native-alarm.

Warmachine13 avatar Warmachine13 commented on July 24, 2024

You can write this for your documentation I was confused when I try use this library

from react-native-alarm.

avlonder avatar avlonder commented on July 24, 2024

Hi everyone,
I am using the more recent fork: https://github.com/andrerivie/react-native-alarm, but I get the error message: null is not an object(evaluating '_reactNativeAlarm.default.setAlarm').
So, I guess something went wrong with the linking... even though I used 'react-native link'.
I'm using Expo because my laptop runs on Ubuntu and I have to develop for ios, so maybe that's the problem...?

from react-native-alarm.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.