diff --git a/example/android/myapplication/src/main/res/raw/doorbell.mp3 b/example/android/myapplication/src/main/res/raw/doorbell.mp3 new file mode 100644 index 000000000..4124aba1c Binary files /dev/null and b/example/android/myapplication/src/main/res/raw/doorbell.mp3 differ diff --git a/example/index.js b/example/index.js index 819c02337..7fe95a72d 100644 --- a/example/index.js +++ b/example/index.js @@ -46,9 +46,11 @@ class NotificationsExampleApp extends Component { completion(); }); - Notifications.ios.events().appNotificationSettingsLinked(() => { - console.warn('App Notification Settings Linked') - }); + if (Platform.OS === 'ios') { + Notifications.ios.events().appNotificationSettingsLinked(() => { + console.warn('App Notification Settings Linked') + }); + } } requestPermissionsIos(options) { @@ -93,6 +95,7 @@ class NotificationsExampleApp extends Component { sound: 'chime.aiff', category: 'SOME_CATEGORY', link: 'localNotificationLink', + android_channel_id: 'my-channel', }); } @@ -100,6 +103,22 @@ class NotificationsExampleApp extends Component { Notifications.removeAllDeliveredNotifications(); } + setNotificationChannel() { + Notifications.setNotificationChannel({ + channelId: 'my-channel', + name: 'My Channel', + groupId: 'my-group-id', + groupName: 'my group name', + importance: 5, + description: 'My Description', + enableLights: true, + enableVibration: true, + showBadge: true, + soundFile: 'doorbell.mp3', + vibrationPattern: [200, 1000, 500, 1000, 500], + }) + } + async componentDidMount() { const initialNotification = await Notifications.getInitialNotification(); if (initialNotification) { @@ -134,7 +153,7 @@ class NotificationsExampleApp extends Component { {this.renderNotification(notification)} )); - const openedNotifications = this.state.openedNotifications.map((notification, idx) => + const openedNotifications = this.state.openedNotifications.map((notification, idx) => ( {this.renderOpenedNotification(notification)} @@ -148,6 +167,9 @@ class NotificationsExampleApp extends Component {