Skip to content

Commit

Permalink
Update App.tsx
Browse files Browse the repository at this point in the history
Update the code to reflect changes in plugin version 2.0.2
  • Loading branch information
opmat authored Feb 1, 2024
1 parent 19eb36e commit 5a81776
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions examples/RNOneSignalExpoExample/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import React from 'react';
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
import OneSignal from 'react-native-onesignal';
import { LogLevel, OneSignal } from "react-native-onesignal";

const initOneSignal = () => {
OneSignal.setAppId("8fbf6c72-4b80-47a8-86ae-68de02259355");
OneSignal.setLogLevel(6, 0);
OneSignal.promptForPushNotificationsWithUserResponse(response => {
console.log(response);
});
OneSignal.initialize("8fbf6c72-4b80-47a8-86ae-68de02259355");
OneSignal.Debug.setLogLevel(LogLevel.Verbose);

// Also need to enable notifications to complete OneSignal setup
if (await OneSignal.Notifications.canRequestPermission()) {
let permission = OneSignal.Notifications.hasPermission();
if (!permission) {
await OneSignal.Notifications.requestPermission(true);
}
}
OneSignal.setConsentRequired(true);
OneSignal.setConsentGiven(true);
}

export default function App() {
Expand Down

0 comments on commit 5a81776

Please sign in to comment.