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

पैकेज विवरणv2.0.1+1

foreground_service

एंड्रॉइड फ्रंटग्राउंड सर्विस के माध्यम से डार्ट कोड चलाने के लिए फ्लटर प्लगइन। एंड्रॉइड O पर बहुत ही कम टेस्ट किया गया है, और M पर थोड़ा सा टेस्ट किया गया है। iOS सपोर्ट की योजना नहीं है।

30-दिन डाउनलोड
25
लाइक
52
Pub अंक
30

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

flutter pub add foreground_service

पैकेज अवलोकन

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

एक फ्लटर प्लगइन जो डार्ट कोड को एंड्रॉइड फ्रंटग्राउंड सेवा में चलाने की अनुमति देता है, जिससे लंबे समय तक चलने वाले कार्य भी ऐप के पृष्ठभूमि में होने पर भी जारी रहते हैं। मुख्य रूप से Android O और बाद के संस्करणों के लिए डिज़ाइन किया गया है, पुराने संस्करणों पर न्यूनतम परीक्षण किया गया है। iOS समर्थन योजना में नहीं है। प्लगइन एंड्रॉइड के फ्रंटग्राउंड सेवा जीवनचक्र के साथ एकीकृत है, जिससे ऐप्स को स्थायी संचालन जैसे स्थान ट्रैकिंग या ऑडियो प्लेबैक बनाए रखने में सक्षम बनाता है जब तक सिस्टम द्वारा खत्म नहीं कर दिया जाता है। इसके लिए एंड्रॉइड मैनिफेस्ट में सही कॉन्फ़िगरेशन और अनुमतियाँ आवश्यक हैं।

उपयोग

  • पृष्ठभूमि स्थान ट्रैकिंग
  • लंबे समय तक चलने वाला डेटा प्रोसेसिंग
  • पृष्ठभूमि में ऑडियो प्लेबैक
  • स्थायी नेटवर्क कनेक्शन
  • रियल-टाइम मॉनिटरिंग सेवाएं

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

  • Android फ्रंटग्राउंड सेवा एन्क्रिप्शन
  • फ़ॉरग्राउंड संदर्भ में डार्ट कोड निष्पादन
  • सिस्टम-स्तरीय स्थायित्व
  • न्यूनतम iOS समर्थन
  • प्रकरण विन्यास की आवश्यकता है

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

  • पृष्ठभूमि कार्य विश्वसनीयता की आवश्यकता वाले ऐप्स
  • स्थान-आधारित सेवाएं
  • मीडिया प्लेयर
  • आईओटी डिवाइस कंट्रोलर्स
  • रियल-टाइम डेटा सिंक

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

  • कोई iOS समर्थन नहीं
  • पुराने Android संस्करणों पर सीमित परीक्षण किया गया
  • Android मैनिफेस्ट सेटअप की आवश्यकता होती है
  • सामने की सेवा नोटिफिकेशन की आवश्यकता है
  • बैटरी उपयोग के प्रभाव

मूल README

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

foreground_service (Flutter v.1.12.x or later)

Create Android foreground service/notification

Prep (Android side):

Android foreground services require a notification to be displayed,
and notifications require an icon.

For this plugin to work, the icon needs to be in this specific location:

res/drawable/org_thebus_foregroundserviceplugin_notificationicon

(take a look at the /example app if you're confused)


-- NOTE FOR PLUGIN VERSION 2.0.0 and above --
compileSdkVersion & targetSdkVersion need to be 29 or above, or the build will fail
these values are set/can be changed in the build.gradle for the app

Use (Flutter/Dart side):

To start the service, call ForegroundService.startForegroundService([serviceFunction])

serviceFunction will then be executed periodically, but "minimum/best-effort"
i.e. it will try to make the interval between function executions *at least* that long

Doesn't work?

As long as you're calling ForegroundService.startForegroundService,
"flutter run" should show error messages that indicate what's wrong/missing

i.e. messages beginning with E/ForegroundServicePlugin indicate an error from the plugin

Caution:

ForegroundService.notification.get* methods may give unexpected values.

Once notifications are sent out, there's no way to retrieve the "current" data.

To work around this, the plugin keeps a version of the notification around.
This version may not have been "sent out" yet, however.

Disclaimer:

Most of the fancy stuff is shamelessly pilfered from the android_alarm_manager plugin

श्रेणियाँ

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

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

अभी कोई डेटा उपलब्ध नहीं है।