Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library seems not worked #31

Open
hcphuc2595 opened this issue May 31, 2022 · 8 comments
Open

Library seems not worked #31

hcphuc2595 opened this issue May 31, 2022 · 8 comments

Comments

@hcphuc2595
Copy link

hcphuc2595 commented May 31, 2022

Hello,
I tried to implement this library into my project for sending scheduled alerts. but I found out some problems.
On IOS: The alert is sent every minute (not at the date and snooze expected).
On Android: I see in the log that alert is created but I received nothing (no alerts, no push notifications). I tried to replicate the same configurations as in example app but still not work.

const dateForAlert = moment() .add(3, 'minutes') .startOf('minute') .format(); const resAlarm = await createAlarm({ active: true, date: dateForAlert, allowWhileIdle: true, message: ${loadID} ${I18n.t('alarmMessage')}, // snooze: SNOOZE_MINUTES, snooze: 2, userInfo: { tripID, loadID, }, });

Moreover on Android, I always have the error in debug mode and in release apk mode, the app crashed. Here is the error I can find in the log.
Error: EISDIR: illegal operation on a directory, read at Object.readSync (fs.js:592:3) at tryReadSync (fs.js:366:20) at Object.readFileSync (fs.js:403:19) at UnableToResolveError.buildCodeFrameMessage (/home/brady/obs-websocket-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:347:17) at new UnableToResolveError (/home/brady/obs-websocket-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:333:35) at ModuleResolver.resolveDependency (/home/brady/obs-websocket-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:211:15) at DependencyGraph.resolveDependency (/home/brady/obs-websocket-app/node_modules/metro/src/node-haste/DependencyGraph.js:413:43) at /home/brady/obs-websocket-app/node_modules/metro/src/lib/transformHelpers.js:317:42 at /home/brady/obs-websocket-app/node_modules/metro/src/Server.js:1471:14 at Generator.next (<anonymous>)

@liplylie
Copy link
Owner

liplylie commented Jul 6, 2022

What version of React Native, react-native-push-notification, react-native-simple-alarm, @react-native-community/async-storage @react-native-community/push-notification-ios are you using?

@hcphuc2595
Copy link
Author

Here is the information:

  • React-native version 0.63.3
  • React-native-push-notification version 8.1.1
  • React-native-simple-alarm version 2.0.2
  • @react-native-community/async-storage version 1.12.1
  • @react-native-community/push-notification-ios version 1.10.1

@ameya-linge
Copy link

I am also having exact same issues, @liplylie

@ameya-linge
Copy link

ameya-linge commented Jul 15, 2022

@liplylie
Actually I found the issue causing: On IOS: The alert is sent every minute (not at the date and snooze expected). In code,
You have specified repeatTime for IOS but whereas in react-native-push-notification package it is mentioned that this does not work for IOS, therefore it will repeat every minute since repeatType is set to "minute"
Don't know yet what could be the workaround since this is not supported in IOS.
Great package though! I hope we come up with some solution soon.

Thanks.

In file activateAlarm.js :


 case 6:
                snooze = alarm.snooze;
                if (react_native_1.Platform.OS === "android") {
                    repeatTime = 1000 * 60 * Number(snooze);
                    androidAlarm = Object.assign({}, alarm, {
                        date: new Date(date),
                        id: JSON.stringify(id),
                        notificationId: id,
                        repeatType: "time",
                        repeatTime: repeatTime,
                        userInfo: __assign(__assign({}, alarm.userInfo), { id: JSON.stringify(id), oid: JSON.stringify(id), snooze: snooze }),
                    });
                    react_native_push_notification_1.default.localNotificationSchedule(androidAlarm);
                }
                else {
                    repeatTime = snooze * 1000;
                    iosAlarm = Object.assign({}, alarm, {
                        date: new Date(date),
                        repeatType: "minute",
                        **repeatTime: repeatTime,**
                        userInfo: __assign(__assign({}, alarm.userInfo), { oid: id, snooze: snooze }),
                    });
                    react_native_push_notification_1.default.localNotificationSchedule(iosAlarm);

@liplylie
Copy link
Owner

@ameya-linge hmm, this was working in the past, I'll take a look into this

@liplylie
Copy link
Owner

@ameya-linge yep, you're right, repeating push notifications in specific intervals isn't supported in iOS. Will need to think of a workaround for this

@liplylie
Copy link
Owner

liplylie commented Jul 15, 2022

@hcphuc2595 I'll take at the android error

@ragsav
Copy link

ragsav commented Oct 7, 2022

@liplylie can we implement the library with native code for alarms? Because I think react-native-push-notifications has some issues with android. It does not trigger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants