Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : One Signal Push notification did not receive while the app is in use

I am using One Signal Push notification in my app. When my app is in closed that mean when I am not using of my app, I get push notification from one signal that is sent from my testing team. But when I am using an app, I did not get it.

Your answer is more appreciated.

like image 449
Parama Sudha Avatar asked Apr 09 '16 05:04

Parama Sudha


People also ask

Why am I not receiving push notifications on my Android?

Settings > Sounds & Vibration > Do Not Disturb: if this setting is enabled, Push Notifications will not be received. Make sure this is disabled. Settings > General > Background App Refresh: this setting allows the app to run in the background and must be turned on.

Why are push notifications not working?

Reinstall the App or Wait for Updates One of the main reasons why your phone's notifications aren't working could be due to broken app updates. If your Android device is not getting notifications from one app in particular, it's possible that the developers have accidentally rolled out a buggy update.

Why user can't see notifications even though it was successfully sent to user's device?

This could happen because of slow internet issues on user's device. Under such circumstances, text would get loaded but image might still fail due to poor network.

How do I trigger push notifications on Android?

Turn on notifications for Android devices Tap More on the bottom navigation bar and select Settings. Tap Turn on notifications. Tap Notifications. Tap Show notifications.


2 Answers

In latest version (3.+@aar) you should use inFocusDisplaying:

OneSignal.startInit(this)
  .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
  .init();

And you can set None and InAppAlert instead of Notification.

like image 191
sfmirtalebi Avatar answered Oct 29 '22 17:10

sfmirtalebi


By using this line,I can get the push notification though my app is in opened.

Link to refer

OneSignal.enableNotificationsWhenActive(true);
like image 26
Parama Sudha Avatar answered Oct 29 '22 18:10

Parama Sudha