ExpoAdvanced
expo-notifications — local reminder
টাস্ক reminder-এর জন্য local notification শুরুর নিয়ম।
7টি অংশবাংলা ভাষায়
Reminder-এর জন্য local notification — কোনো server ছাড়াই ফোনে schedule হয়।
terminalbash
bash
npx expo install expo-notificationsimport * as Notifications from "expo-notifications";
async function setReminder(title, seconds) {
await Notifications.scheduleNotificationAsync({
content: { title: "TaskTrack Reminder", body: title },
trigger: { type: "timeInterval", seconds, repeats: false },
});
}Permission:
const { status } = await Notifications.requestPermissionsAsync();
if (status === "granted") {
await setReminder("দুধ কিনবেন", 3600);
}scheduleNotificationAsync— schedule; id return করেcancelScheduledNotificationAsync(id)— বাতিল- date trigger-এ
{ type: "date", date: ... }
SDK 53+ trigger
বেশিরভাগ SDK-তে trigger-এর type field অপরিহার্য (timeInterval / date)। Foreground-এ অ্যাপ থাকলে notification-এর response listener দিয়ে handle করুন।
শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।