Y
Y
YakutD2021-01-27 19:14:54
Mobile development
YakutD, 2021-01-27 19:14:54

How can you implement local notifications in React Native?

I'm trying my hand at mobile development, I'm a complete novice in this business.
I need to make local notifications to the user on a timer. Moreover, they should not depend on whether he has an Internet connection. For example, at 4:00 p.m., the notification "It's time for tea" should appear. And on pressing the application itself opens.

I've googled but only find examples that require Firebase. If I understand correctly, this does not suit me, because without the Internet, notifications will not come, right? Also I tried react-native-push-notification

scheduleNotfication() { 
      console.log(new Date(Date.now() + (60 * 1000)));
      PushNotification.localNotificationSchedule({ 
      message: "Время пить чай", // message 
      date: new Date(Date.now() + (60 * 1000)) // your required time 
      }); 
     }

Unfortunately, it does not work (neither on the emulator, nor on the real device) Maybe there is some other library? And preferably cross-platform (but not necessarily, Android is a priority), and so that you can test on the emulator

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Alexandrovich, 2021-01-27
@RomReed

I remember how I used this https://github.com/zo0r/react-native-push-notification
and as an option https://wix.github.io/react-native-notifications/d...
on the push emulator, notification is not works. Check if the application has permission to send notifications.

K
Kirill Makarov, 2021-01-28
@kirbi1996

Here is the package that you zayuzal just the same you need, you just need to call it correctly, configure all the permissions, you always have to google in react native, so look for a solution on page 2 or 3. Well, of course, google in English, I think it will be possible to find

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question