10 examples of 'pushnotificationios' in JavaScript

Every line of 'pushnotificationios' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
77protected showPushNotification(pushNotification: IPushNotification) {
78
79 this._onShowNotification.next(pushNotification);
80}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

88function sendiOSNotification(registrationId, msg_cnt) {
89 var note = new apn.Notification();
90
91 note.badge = msg_cnt;
92 note.sound = "ping.aiff";
93 note.alert = "New message";
94 note.payload = {'messageFrom': 'Obyte'};
95 note.topic = "org.byteball.wallet";
96
97 apnProvider.send(note, registrationId).then((result) => {
98 }, function(err) {
99 console.error(err);
100 });
101}
17registerNotificationListener(listener) {
18 if (Platform.OS === 'ios') {
19 PushNotification.onNotification = (notification) => {
20 listener(notification);
21 notification.finish(PushNotificationIOS.FetchResult.NoData);
22 };
23 } else {
24 PushNotification.onNotification = listener;
25 }
26}
48static setApplicationIconBadgeNumber(number) {
49
50}
136localNotification(notification) {
137 this.deviceNotification = {
138 body: notification.message,
139 alertAction: '',
140 userInfo: notification.userInfo,
141 };
142
143 NotificationsIOS.localNotification(this.deviceNotification);
144}
49showLocalNotification(from) {
50 console.log('PushManager: showLocalNotification');
51 try {
52 const notification = new firebase.notifications.Notification()
53 .setNotificationId('notificationId')
54 .setTitle('Incoming call');
55 notification.android.setSmallIcon('ic_vox_notification');
56 notification
57 .android.setChannelId('voximplant_channel_id');
58 firebase.notifications().displayNotification(notification);
59 } catch (e) {
60 console.warn('React Native Firebase is not set up. Enable google-services plugin at the bottom of the build.gradle file');
61 }
62
63}
14register() {
15 try {
16 this.pushNotification = Push.init({
17 ios: { alert: 'true', badge: 'true', sound: 'true' },
18 android: { senderID: Environment.SENDERID }
19 })
20 this.pushNotification.on('notification', (data) => {
21 this.events.publish('notifications:receive', data)
22 })
23 this.pushNotification.on('registration', (data) => {
24 this.events.publish('notifications:register', data)
25 })
26 this.pushNotification.on('error', (err) => {
27 console.warn('failed to initialise notifications', err.message)
28 })
29
30 } catch (err) {
31 console.warn('failed to initialise notifications', err)
32 }
33}
283function displayNotification (message: string, title?: string) {
284 RNPushNotification.localNotification({
285 title,
286 message,
287 playSound: false,
288 vibrate: false
289 })
290}
58push(notifyInfo: INotificationOptions): INotificationModel {
59 return this.notificationsService.push(notifyInfo);
60}
36private buildNotification(context: PushContext, event: Event, notificationKey: string = null): PushNotification {
37 event = event || NullEvent;
38 return {
39 url: `${this.config.protocol}://${this.config.host}${this.config.port ? ":"
40 + this.config.port : ""}/projections/${context.area}/${context.projectionName}`.toLowerCase(),
41 notificationKey: notificationKey,
42 timestamp: event.timestamp,
43 eventId: event.id
44 };
45}

Related snippets