Push notifications setup
lib/notifications.ts
import { requestNotificationPermission } from '@/lib/notifications'; const token = await requestNotificationPermission();
await fetch('https://exp.host/--/api/v2/push/send', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ to: 'ExponentPushToken[xxx]', title: 'Hello!', body: 'This is a notification', }), });
import * as Notifications from 'expo-notifications'; await Notifications.scheduleNotificationAsync({ content: { title: 'Reminder', body: 'Check the app!' }, trigger: { seconds: 3600 }, });