React-native-onesignal: disable alert box when app in foreground

Created on 1 Nov 2017  路  6Comments  路  Source: OneSignal/react-native-onesignal

how can i disable the alert box when the app is in opened and just show them as push notifications like when the app is closed? Thanks.

Most helpful comment

Hi, you can look at the readme file here.

Android:

OneSignal.inFocusDisplaying(2);

IOS:

self.oneSignal = [[RCTOneSignal alloc] initWithLaunchOptions:launchOptions
                     appId:@"YOUR APP ID"
                     settings:@{kOSSettingsKeyInFocusDisplayOption : @(OSNotificationDisplayTypeNotification), kOSSettingsKeyAutoPrompt : @YES}];

All 6 comments

Hi, you can look at the readme file here.

Android:

OneSignal.inFocusDisplaying(2);

IOS:

self.oneSignal = [[RCTOneSignal alloc] initWithLaunchOptions:launchOptions
                     appId:@"YOUR APP ID"
                     settings:@{kOSSettingsKeyInFocusDisplayOption : @(OSNotificationDisplayTypeNotification), kOSSettingsKeyAutoPrompt : @YES}];

@ccoeder may you please share updated link. The docs don't seem to be there anymore.

@Noitidart oh, they changed the readme file. I found the old version here.

Thanks very much for such a fast reply @ccoeder !! I'll check that out. I'll also look out for updated docs, in case stuff changed.

Please can i use the code for android?

@hemanowell Have you tried this one? OneSignal.inFocusDisplaying(2);

Was this page helpful?
0 / 5 - 0 ratings