wmcmahan / react-native-calendar-reminders

React Native Module for IOS Calendar Reminders
MIT License
90 stars 20 forks source link

Unable to create alarm #19

Open blackPeanut opened 8 years ago

blackPeanut commented 8 years ago

Hi there! I'm trying to create alarm for reminder but unsuccessful. I've linked EventKit.framework & RNCalendarReminders in Build Phases, tried to set different data etc, but all my Reminders with alarm arr I create whatever I try to change appears in Reminder section, without any info regarding alarm. Do you have any Ideas what it could be?

P.S. NativeAppEmmiter imported, I've used events for creating Reminder with alarm you wrote in Readme. P.S.S. I've downloaded app 'thehoick-habit-app' created by Adam (guy who wrote #9 ) but unfortunately, I didn't succeed also to rcv any alarm after setting new notification.

Do you have any ideas what it could be? Thanks

wmcmahan commented 8 years ago

Hi @blackPeanut, could you give an example of your code and the error if there is one? Thanks

blackPeanut commented 8 years ago

Yep, sure. Here you go. P.S. By the way, 'saveReminder event' didn't even dispatch if i uncomment recurrence;

import React, { Component, } from 'react';
import {
  View,
  TouchableHighlight,
  Text,
  NativeAppEventEmitter,
  StyleSheet,
} from 'react-native';

import RNCalendarReminders from 'react-native-calendar-reminders';

export default class Rem extends Component {
  constructor(props) {
    super(props);
  };//constructor

  handleAddReminder() {
    RNCalendarReminders.saveReminder('title', {
      location: 'location',
      notes: 'notes',
      startDate: '2017-10-01T09:45:00.000UTC',
      alarms: [{
        date: -1 // or absolute date
      }],
      //recurrence: 'daily'
    });
  }

  componentWillMount() {
    this.eventEmitter = NativeAppEventEmitter.addListener('remindersChanged', reminders => {
      console.log('REMINDERS OBJECT HAS BEEN CHANGED', reminders);
    });

    RNCalendarReminders.authorizeEventStore(({status}) => {
        console.log(status);
        status === 'denied' ? alert('Enable notifications') : null;
      });
  }//cwm

  componentWillUnmount () {
  this.eventEmitter.remove();
  }

  render() {
    return (
      <View style={styles.container}>
        <TouchableHighlight style={styles.btn} onPress={this.handleAddReminder}>
          <Text>Reminder</Text>
        </TouchableHighlight>
      </View>
    );//return
  };//render
};//class

const styles = StyleSheet.create({
  container: {
    paddingTop: 20,
    paddingBottom: 40,
  },
  btn: {
    width: 60,
    height: 20,
    backgroundColor: 'tomato',
  }
});

screen shot 2016-08-16 at 8 13 17 pm

wmcmahan commented 8 years ago

Thanks. When setting a 'dueDate' and 'recurrence' it should put it in the "scheduled" reminders. Although, setting the alarm date to a relative time versus absolute time have different results. Neither seem to be throwing triggering the notification and i'm not exactly sure why.

blackPeanut commented 8 years ago

@wmcmahan I've tried to set alarm time as absolute and relative. Have you succeed to run my example and put reminders in scheduled with any possible options?

P.S. Are you planning to fix this in nearest future? Or better to look through for other solution for now?

Thanks

wmcmahan commented 8 years ago

Reminders should be marked as scheduled if they have a dueDate. ex:

RNCalendarReminders.saveReminder('title', {
  location: 'location',
  notes: 'notes',
  startDate: new Date('2017-10-01T09:45:00.000UTC'),
  dueDate: new Date('2017-10-01T09:46:00.000UTC'),
  alarms: [{
    date: new Date('2017-10-01T09:44:00.000UTC'),
  }],
  recurrence: 'daily'
});

I'm looking into the the notifications and why they might not get triggered when programmaticaly creating and alarm. Not sure if it is an ios issue or not. I will try to find a fix soon if its related to this code.

blackPeanut commented 8 years ago

Yep, now I can add a notification to scheduled (seems it should be due date) but as you have mentioned (also recurrence stared to work) it doesn't trigger actually the alarm.

Thanks, no other solutions, except yours 😢

trustme217 commented 6 years ago

when I use that package for creating alarm, it works for creating new events on the calendar on the device, but Alarm does not work. for exam

  1. Set Alarm at 1:50 PM
  2. Waited for this time AR no notifications or signals

here is my codebase

1111

screen shot 2017-12-08 at 08 49 08

MohdLucky commented 6 years ago

hey, please help me in reminder app in react native ios ,

trustme217 commented 6 years ago

Who are you? And what’s your issue?

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10


From: Mohd Lucky notifications@github.com Sent: Monday, October 22, 2018 8:39:46 AM To: wmcmahan/react-native-calendar-reminders Cc: blackstar217; Comment Subject: Re: [wmcmahan/react-native-calendar-reminders] Unable to create alarm (#19)

hey, please help me in reminder app in react native ios ,

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/wmcmahan/react-native-calendar-reminders/issues/19#issuecomment-431760275, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AdBtPSKKQPTiwwg2fBuxRNAbo4dnAb1Bks5unXZBgaJpZM4JltFV.