Giter Site home page Giter Site logo

wumke / react-native-local-notifications Goto Github PK

View Code? Open in Web Editor NEW
84.0 84.0 33.0 867 KB

Manageable local notifications for React Native on iOS and Android.

License: MIT License

Java 75.27% JavaScript 4.36% Objective-C 17.23% Ruby 3.14%
react-native

react-native-local-notifications's People

Contributors

devapro avatar fr33maan avatar kayrnt avatar lfkwtz avatar saeedzhiany avatar wumke avatar zapps avatar zpalmtree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-native-local-notifications's Issues

error while building (error: cannot find symbol NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); )

while building it give an error
.........\MainActivity.java:19: error: cannot find symbol
NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

MainActivity.java:19: error: cannot find symbol
NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

MainActivity.java:19: error: cannot find symbol
NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
^
symbol: variable Context
location: class MainActivity
3 errors

MainActivity.java
import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

/**
 * Returns the name of the main component registered from JavaScript.
 * This is used to schedule rendering of the component.
 */

@Override
protected String getMainComponentName() {
    return "gymcrumbs";
}
@Override
public void onResume() {
    super.onResume();
    NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nMgr.cancelAll();
}

}

compileSdkVersion 23
buildToolsVersion "23.0.2"
"react": "^16.2.0",
"react-native": "^0.54.4",

Crashes when notification time reached

Using react native version 0.59
I defined a notification as shown below then wait it to be displayed but app crashes.
RNLocalNotifications.createNotification(1, 'Some text', '2019-09-07 23:15', 'default');

Android crashes if cancelling a non existing notification

Maybe the AlarmManager.cancel call should be inside the if !null statement

cancel() called with a null PendingIntent
cancel
AlarmManager.java:890
deleteAlarm
RNLocalNotificationsModule.java:118
createAlarm
RNLocalNotificationsModule.java:63
updateNotification
RNLocalNotificationsModule.java:50
invoke
Method.java
invoke
JavaMethodWrapper.java:372
invoke
JavaModuleWrapper.java:160
run
NativeRunnable.java
handleCallback
Handler.java:751
dispatchMessage
Handler.java:95
dispatchMessage
MessageQueueThreadHandler.java:29
loop
Looper.java:154
run
MessageQueueThreadImpl.java:192
run
Thread.java:761

BUILD FAILED

I installed it as described:

Check dependencies
Unable to run command 'Libtool libRNLocalNotifications.a' - this target might include its own product.


** BUILD FAILED **

Fatal error on Android when scheduled notification time is reached

The package is working great on iOS for us, however, there is a problem with Android whereby it causes a fatal exception and crashes the app.

This is the output of LogCat at the time of the exception

2019-07-09 13:10:00.926 28607-28607/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.busbynative:remote, PID: 28607
    java.lang.RuntimeException: Unable to start receiver com.github.wumke.RNLocalNotifications.AlarmReceiver: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(pri=0 contentView=null vibrate=[0,1000] sound=content://settings/system/notification_sound defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3039)
        at android.app.ActivityThread.-wrap18(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6123)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
     Caused by: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(pri=0 contentView=null vibrate=[0,1000] sound=content://settings/system/notification_sound defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE)
        at android.app.NotificationManager.notifyAsUser(NotificationManager.java:306)
        at android.app.NotificationManager.notify(NotificationManager.java:284)
        at android.app.NotificationManager.notify(NotificationManager.java:268)
        at com.github.wumke.RNLocalNotifications.AlarmReceiver.onReceive(AlarmReceiver.java:131)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3032)
        at android.app.ActivityThread.-wrap18(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1557) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6123) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757) 

We are invoking the notification with the following:

// Manual test notification
    RNLocalNotifications.createNotification(
      1,
      "Incident notification",
      "2019-07-09 13:10",
      "busby"
    );

We are using react-native 0.59.10 and have followed all of the installation instructions to the letter. Any ideas on this one?

datetime limited to full minutes only ?

The readme says: The date + time to show the notification, as a string in the format 'yyyy-mm-dd hh:mm'

And indeed I am not able to add seconds. Is there a reason for this limitation ? From the Apple docs I understand that seconds (even milliseconds) should be possible ?

I want to use local notifications for timing sub-minute events. So its important to have seconds support and I wonder if that is possible at all.

Cannot override default notification sound

Hi, first of all thank you for this plugin.
I have a problem with custom notification sounds. When I debug the code, I can see my custom mp3 is resolved in resources.
https://i.imgsafe.org/c7/c7c04bd67c.png
But in logcat, I see this error,
E/OMXNodeInstance: setConfig(0xe5d26c00:google.vorbis.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
and the device plays default notification sound.

Any help is appreciated.

onNotification problem (Android)

I use react-native-push-notification, for handle onNotification event to get hiddendata. Works fine on ios but on android onNotification method not trigger.

Thanks

not working on iOS

Hello i was just installed this plugin, i set the code to

RNLocalNotifications.createNotification(1,'Some Text', '2018-02-15 21:05', 'default');

but nothing happens at that time, i just set the app to background (i mean i pressed the home button) then no notification appear, also, i haven't receive the warning of "Do you want to receive notifications?"

any idea?

RN v : 0.53.0
device : iPhone 8 Simulator (yes, you can receive local notification here)
platform : Mac

How to retrieve hiddendata

I see in the readme we can provide data to createNotification/updateNotification parameter.
How to get that hiddendata from rn component?

Thanks

Error Build compileReleaseJavaWithJavac. Please Help

Virsions

    "react-native": "^0.47.1",
    "react-native-local-notifications": "^0.1.0",

Error

:react-native-local-notifications:compileReleaseJavaWithJavac
:react-native-local-notifications:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\web\apps\reactnative\demonotify\node_modules\react-native-local-notifications\android\src\main\java\com\github\wumke\RNLocalNotifications\RNLocalNotificationsPackage.java:26: error: method does not override or implement a method from a supertype
    @Override
    ^
1 error
:react-native-local-notifications:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-local-notifications:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Android build failed: MainActivity.java:19: error: cannot find symbol

Followed all the steps exactly and the build fails because of the code you instruct users to add into MainActivity.java:

:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/www/apps/Slick/android/app/src/main/java/com/itsahappymedium/slick/MainActivity.java:19: error: cannot find symbol
        NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        ^
  symbol:   class NotificationManager
  location: class MainActivity
/www/apps/Slick/android/app/src/main/java/com/itsahappymedium/slick/MainActivity.java:19: error: cannot find symbol
        NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                                    ^
  symbol:   class NotificationManager
  location: class MainActivity
/www/apps/Slick/android/app/src/main/java/com/itsahappymedium/slick/MainActivity.java:19: error: cannot find symbol
        NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                                                                          ^
  symbol:   variable Context
  location: class MainActivity
3 errors
:app:compileDebugJavaWithJavac FAILED

Custom notification design

Hello,
Is it easily possible to have a more custom notification design ? I need some buttons and events in my notification.
I'm not from java, I managed to do it in a pure java project, but can't find where to put my files to make it working with react-native.

Thanks

Local Notification is not working

node version: 10:14:1
react-native version: 0.57.8
android version: lollipop 5.1

I am getting error in MainActivity.java when i run react-native run-android
NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
error is in Context

then i remove Context, working fine but local notification is not triggering.
I followed step by step procedure, everything is fine. Please let me know about this issue.

Thanks.

Local Notifications not working

I used RNLocalNotifications.createNotification(1, 'Some text', '2017-01-02 12:30', 'default'); in my componentwillmount component. Local notifications are not triggering.

App not running when linking react-native-local-notifications v0.60.5

@wumke I'm using react native v0.60.5 "react native link" is not used anymore to link component, when trying to run it in xcode the following error appears:
'RCTBridgeModule.h' file not found

is there any way to link react-native-local-notifications using cocoapods or how can we fix this issue?

react-native": "0.60.5",
"react-native-local-notifications": "2.0.0"

App failed

when the step 1 is executed : "Add RNLocalNotifications.xcoderproj into your project in the Libraries folder." exist a compiled erro /node_modules/react-native-local-notifications/ios/RNLocalNotifications/RNLocalNotifications.m:2:9: 'RCTBridgeModule.h' file not found

custom sound

(Future releases: your own custom sounds, name-based!)

Any idea when this future arrives ? ;-)
Is it much work for you to implement this ?
I want to play a sound file that I created myself.

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.