diff --git a/README.md b/README.md index 5898411..457a1f4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ +# foreground-service-library-test -# react-native-foreground-service +This is a clone of react-native-foreground-service with a small change. An exception thrown when the priority is parsed in the NotificationHelper.java's buildNotification method is fixed. A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to play an audio track. @@ -11,7 +12,7 @@ See [the Android official documentation](https://developer.android.com/guide/com ## Getting started -`$ npm install @voximplant/react-native-foreground-service --save` +`$ npm install foreground-service-library-test --save` ### Automatic installation (Android only) @@ -154,4 +155,4 @@ NotificationConfig | title | Notification title | yes | | text | Notification text | yes | | icon | Icon name | yes | -| priority | Priority of this notification. One of: | no | \ No newline at end of file +| priority | Priority of this notification. One of: | no | diff --git a/android/src/main/java/com/voximplant/foregroundservice/NotificationHelper.java b/android/src/main/java/com/voximplant/foregroundservice/NotificationHelper.java index 2415c7c..0ca2a07 100644 --- a/android/src/main/java/com/voximplant/foregroundservice/NotificationHelper.java +++ b/android/src/main/java/com/voximplant/foregroundservice/NotificationHelper.java @@ -96,7 +96,7 @@ Notification buildNotification(Context context, Bundle notificationConfig) { notificationBuilder = new Notification.Builder(context); } - int priorityInt = notificationConfig.containsKey("priority") ? notificationConfig.getInt("priority"): Notification.PRIORITY_HIGH; + int priorityInt = notificationConfig.containsKey("priority") ? (int)notificationConfig.getDouble("priority"): Notification.PRIORITY_HIGH; int priority; switch (priorityInt) {