কম্পিউটার টিউটোরিয়াল

iOS অ্যাপের নোটিফিকেশন স্ট্যাটাস চেক করা


নোটিফিকেশন আপনার অ্যাপের ইউজারদের গুরুত্বপূর্ণ তথ্য যোগাযোগ করে, আপনার অ্যাপ ইউজারের ডিভাইসে চলছে কিনা সেটা না করেই।

উদাহরণস্বরূপ, একটি স্পোর্টস অ্যাপ ইউজারকে জানাতে পারে তাদের প্রিয় টিম যখন গোল করে। নোটিফিকেশন আপনার অ্যাপকে তথ্য ডাউনলোড করতে এবং ইন্টারফেস আপডেট করতে বলতে পারে। নোটিফিকেশন এলার্ট দেখাতে পারে, সাউন্ড প্লে করতে পারে, বা অ্যাপ আইকনে ব্যাজ (badge) দেখাতে পারে।

iOS অ্যাপের নোটিফিকেশন স্ট্যাটাস চেক করা

নোটিফিকেশন স্ট্যাটাস সম্পর্কে আরো জানুন: https://developer.apple.com/documentation/usernotifications

Apple UserNotifications ফ্রেমওয়ার্ক ব্যবহার করার সুপারিশ করে, তাহলে শুরু করি। নোটিফিকেশন স্ট্যাটাস পাওয়ার খুব সিম্পল এবং সহজ সমাধান দেখব।

Step 1 − প্রথমে UserNotifications ফ্রেমওয়ার্ক ইম্পোর্ট করুন।

import UserNotifications

Step 2 − UNUserNotificationCenter.current() অবজেক্ট তৈরি করুন।

let currentNotification = UNUserNotificationCenter.current()

Step 3 − স্ট্যাটাস চেক করুন।

currentNotification.getNotificationSettings(completionHandler: { (settings) in
    if settings.authorizationStatus == .notDetermined {
        // Notification permission is yet to be been asked go for it!
    } else if settings.authorizationStatus == .denied {
        // Notification permission was denied previously, go to settings & privacy to re-enable the permission
    } else if settings.authorizationStatus == .authorized {
        // Notification permission already granted.
    }
})

ফাইনাল কোড

import UserNotifications
let currentNotification = UNUserNotificationCenter.current()
currentNotification.getNotificationSettings(completionHandler: { (settings) in
    if settings.authorizationStatus == .notDetermined {
        // Notification permission is yet to be been asked go for it!
    } else if settings.authorizationStatus == .denied {
        // Notification permission was denied previously, go to settings & privacy to re-enable the permission
    } else if settings.authorizationStatus == .authorized {
        // Notification permission already granted.
    }
})

  1. Action Center- থেকে অ্যাপ নটিফিকেশন সেটিংস দ্রুত টিউন করা

  2. iOS 11-এ অ্যাপ স্টোর ব্যবহার করার পদ্ধতি

  3. iOS 11-এ আইপ্যাড ডক ব্যবহার করার সম্পূর্ণ গাইড

  4. আইওএস ১৬-এ আইওএস ১৫-স্টাইল লক-স্ক্রিন নোটিফিকেশন ফেরত আনা