पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv0.6.1

notification_permissions

एंड्रॉइड और आईओएस पर सूचना अनुमतियों की जाँच और अनुरोध करने के लिए एक प्लगइन

AndroidiOS
30-दिन डाउनलोड
1.3 हज़ार
लाइक
117
Pub अंक
120

पैकेज इंस्टॉल करें

flutter pub add notification_permissions

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

notification_permissions पैकेज एंड्रॉइड और आईओएस प्लेटफॉर्म पर सूचना अनुमतियों की जांच और अनुरोध करने का एक सरल तरीका प्रदान करता है। यह ऐप्स को वर्तमान अनुमति स्थिति का निर्धारण करने और उपयोगकर्ताओं को सूचनाओं को देने या निषेध करने के लिए प्रेरित करने में सक्षम बनाता है, जिससे प्लेटफॉर्म-विशिष्ट आवश्यकताओं का पालन किया जाता है। प्लगइन हल्का है और फ्लटर एप्लिकेशन में बिना किसी बाधा के एकीकृत होता है, जिसमें रनटाइम चेक और उपयोगकर्ता इंटरैक्शन फ्लो का समर्थन होता है। यह डेवलपर्स को सूचना पहुँच को जिम्मेदारी से प्रबंधित करने में मदद करता है और उपयोगकर्ता अनुभव को उच्चतर बनाता है, जब उपयोगकर्ताओं को उचित समय पर अनुमति अनुरोध के मार्गदर्शन करता है।

उपयोग

  • वर्तमान अधिकृत सूचना की स्थिति की जाँच करें
  • उपयोगकर्ताओं से नोटिफिकेशन अनुमतियाँ मांगना
  • एप्लिकेशन लॉजिक में अनुमति प्रतिक्रियाओं का संभालना
  • प्लेटफॉर्म दिशानिर्देशों का पालन सुनिश्चित करना
  • समय पर नोटिफिकेशन के माध्यम से उपयोगकर्ता एंगेजमेंट में सुधार

मुख्य विशेषताएँ

  • Android और iOS के लिए क्रॉस-प्लेटफॉर्म समर्थन
  • अनुमति के जांचने और मांगने के लिए सरल API
  • असिंक्रोनस अनुमति प्रबंधन का समर्थन करता है
  • स्पष्ट अनुमति स्थिति राज्य प्रदान करता है
  • आवश्यक न्यूनतम बॉयलरप्लेट कोड

इनके लिए उपयुक्त

  • पुश नोटिफिकेशन की आवश्यकता वाले ऐप्स
  • अनुमति मार्गदर्शन की आवश्यकता वाले उपयोगकर्ता-मुखी ऐप्स
  • गोपनीयता-संवेदनशील विशेषताओं के निर्माण कर रहे विकासकर्ता
  • दोन मोबाइल प्लेटफॉर्म के लिए फ्लटर ऐप्स
  • उपयोगकर्ता सहमति और पारदर्शिता पर जोर देने वाले प्रोजेक्ट

विचार योग्य बातें

  • अनुमति अस्वीकृति के परिदृश्यों का सही तरीके से निपटारा करने की आवश्यकता है
  • उपयोगकर्ता के प्रवाह को प्रभावित करने वाले प्रणाली डायलॉग को ट्रिगर कर सकता है
  • प्रत्येक प्लेटफॉर्म पर सही एप्लिकेशन कॉन्फ़िगरेशन के बिना काम नहीं करता है
  • केवल नोटिफिकेशन की अनुमति (अन्य प्रकारों के लिए नहीं)
  • ऑपरेटिंग सिस्टम-स्तर के व्यवहार के कारण वास्तविक उपकरणों पर परीक्षण की आवश्यकता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Flutter Notification Permissions

Package to check for and ask for Notification Permissions on iOS and Android.

Checking Notification Permission Status

Future<PermissionStatus> permissionStatus =
    NotificationPermissions.getNotificationPermissionStatus();

This method will return an enum with the following values:

enum PermissionStatus {
  provisional, // iOS Only
	granted,
	unknown,
	denied
}

In iOS, a permission is unknown when the user hasn’t accepted or refuse the notification permissions. In Android this state will never occur, since the permission will be granted by default and it will be denied if the user goes to the app settings and turns off notifications for the app. The provisional status will also offer the same behavior.

Requesting Notification Permissions

If the PermissionStatus is denied or unknown, we can ask the user for the Permissions:

Future<PermissionStatus> permissionStatus = NotificationPermissions.requestNotificationPermissions({NotificationSettingsIos iosSettings, bool openSettings});

On Android, if the permission is denied, this method will open the app settings.

In iOS, if the permission is unknown or provisional, it will show an alert window asking the user for the permission. On the other hand, if the permission is denied it has the same behaviour as Android, opening the app settings. Also in iOS if you set openSettings to false settings window won't be opened. You will get denied status. NotificationPermissions.requestNotificationPermissions returns status after user select answer from native permission popup.

Note: if the permission is granted, this method will not do anything.

iOS Error: Swift.h not found

If your project is in Objective-C, you will have to do the changes referenced in this SO post in order to solve the issue:

'notification_permissions/notification_permissions-Swift.h' file not found
    #import <notification_permissions/notification_permissions-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

Add use_frameworks! in target Runner in your (YOUR_PROJECT)/ios/Podfile

target 'Runner' do
  use_frameworks! # Add here

Special Thanks

Special thanks to fedecastelli for helping me in the Swift Code!

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट