Comments (25)
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.
It's useless...
from react-native-alarm.
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.
how to set a repeat alarm clock ? thanks
from react-native-alarm.
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.
@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.
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.
@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.
It's a alarm library, but not have time definition for alarm?
from react-native-alarm.
+1 Please provide more usage description
from react-native-alarm.
I will provide a usage later. Thanks
from react-native-alarm.
@joaom182 the time is a parameter.
from react-native-alarm.
Kindly let us know about detailed parameters and order...
from react-native-alarm.
@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.
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.
Last reply by smartliang is 1 month ago :)
from react-native-alarm.
@zahid313 Hi, were you able to make this alarm work?
from react-native-alarm.
RNAlarm.clearAlarm();
Is not working for me. Somebody else?
from react-native-alarm.
@stereu It didn't work for me either. Did you have any luck to setAlarms? Did it work for you?
from react-native-alarm.
Was someone able to set an Alarm with react native? using this library or any other library?
from react-native-alarm.
@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.
Is there any way to display for example splash over the lock screen when the alarm is being triggered?
from react-native-alarm.
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.
You can write this for your documentation I was confused when I try use this library
from react-native-alarm.
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)
- permissions
- null is not an object HOT 1
- Multiple alarms
- Trigger alarm when app is closed.
- ε εΌοΌε¦δ½δ½Ώη¨εοΌεηηδΈζγγ HOT 3
- Unable to set alarms HOT 3
- How to delete or cancel alarm HOT 4
- How to change "ε ³ι" text and add another text HOT 2
- [Android] How to clearAlarm?
- Works as a notification instead[on few phones].
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-alarm.