If app is active shows an alert
See original GitHub issueWhen the app is active and receive the notification an alert with the app name appears on screen.
The code:
componentWillMount(){
this.fetchData();
let self = this;
PushNotification.configure({
onRegister: function(token) {
console.log( 'TOKEN:', token );
},
onNotification: function(notification) {
console.log(notification);
if(notification.userInteraction){
self.props.navigation.navigate('Single', { data: notification.data, title: notification.data.book_name + ' ' + notification.data.number + ':' + notification.data.chapter } );
}
},
permissions: {
alert: false,
badge: false,
sound: false
},
popInitialNotification: false,
requestPermissions: true,
});
AsyncStorage.getItem('notifications', (error, result) => {
if(result == null){
AsyncStorage.setItem('notifications', 'true');
let db = this.openDB();
db.transaction((tx) => {
tx.executeSql('SELECT d.*, l.nombre_en, t.verse_text, t.devotional_text FROM datos d INNER JOIN libros l ON l.numero = d.book INNER JOIN textos t ON t.datos = d.id LIMIT 10', [], (tx, results) => {
let len = results.rows.length;
let value = 20;
let currentValue = 0;
let currentDate = new Date(Date.now() + ((currentValue + value) * 1000));
for (let i = 0; i < len; i++) {
let row = results.rows.item(i);
let title = row.verse_text;
if(title.length > 60) title = title.substring(0,60) + '...';
let verseText = row.verse_text;
let verseReview = row.devotional_text;
let verseTitle = title;
let verseBook = row.nombre_en;
let verseNumber = row.book;
let verseChapter = row.chapter;
currentDate = new Date(Date.now() + ((currentValue + value) * 1000));
let data = {
id: row.id,
title: verseTitle,
text: verseText,
review: verseReview,
book_name: verseBook,
chapter: verseChapter,
number: verseNumber,
day: row.day,
color: row.color
};
PushNotification.localNotificationSchedule({
title: verseTitle,
message: verseTitle,
date: currentDate,
userInfo: data,
});
currentValue = currentValue + value;
}
});
});
}
});
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Get push notification while App in foreground iOS
If the application is running in the foreground, iOS won't show a notification banner/alert. That's by ...
Read more >Fix notification issues in the Teams Android app
Open the Settings app. · Tap Permissions. · Tap Manage Auto Launch. If you have enabled other apps to auto-launch, you'll see You've...
Read more >Exposure Notifications: Helping fight COVID-19 - Google
Learn how Exposure Notifications, built by Google and Apple, enable apps to send you a notification if you've likely been exposed to COVID-19....
Read more >Use notifications on your iPhone or iPad - Apple Support (CA)
Go to Settings and tap Notifications. · Select an app under Notification Style. · Under Alerts, choose the alert style that you want....
Read more >Camera and doorbell alerts - Google Nest Help
When enabled, you can receive camera alerts as long as you're signed into the app. Away-only notifications. Tap the switch to enable or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you’re using
react-native-onesignal
then try to use following this to disable the notification displays as popup:This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.