Add:
- google-services.json - utils/notifications.ts Fix: - app.config.js : tambah access googleServicesFile - app/_layout.tsx : tambah untuk push notifikasi - package.json: install install expo-notifications expo-device expo-constants ### No Issue
This commit is contained in:
@@ -1,10 +1,27 @@
|
||||
import { AuthProvider } from "@/context/AuthContext";
|
||||
import AppRoot from "@/screens/RootLayout/AppRoot";
|
||||
import { registerForPushNotificationsAsync } from "@/utils/notifications";
|
||||
import { useEffect } from "react";
|
||||
import "react-native-gesture-handler";
|
||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
||||
export default function RootLayout() {
|
||||
useEffect(() => {
|
||||
// Jalankan sekali saat app pertama kali dibuka
|
||||
registerForPushNotificationsAsync().then((token) => {
|
||||
if (token) {
|
||||
// TODO: Kirim token ke backend kamu
|
||||
// Contoh:
|
||||
// fetch('https://api.hipmibadung.id/save-token', {
|
||||
// method: 'POST',
|
||||
// headers: { 'Content-Type': 'application/json' },
|
||||
// body: JSON.stringify({ token })
|
||||
// });
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SafeAreaProvider>
|
||||
|
||||
Reference in New Issue
Block a user