मुख्य सामग्री पर जाएँ
Skillpedia
मोबाइल ऐप10k · #11935

glance-appwidget-updates-and-memory

यह क्या करती है

यह स्किल Jetpack Glance या RemoteViews से बने Android होम स्क्रीन विजेट अपडेट करने का मार्गदर्शन देती है। इसमें पुराने या अटके हुए विजेट कंटेंट को ताज़ा करना और इमेज को Android 17 की memory सीमा में रखना शामिल है। यह उन Android डेवलपरों के लिए है जो ऐप विजेट संभालते हैं।

कब इस्तेमाल करें

  • ✓जब background sync के बाद होम स्क्रीन पर Glance विजेट पुराना या अटका हुआ कंटेंट दिखाए।
  • ✓जब आप Android 17 विजेट सेट कर रहे हों और उसकी इमेज को memory सीमा में रखना हो।
  • ✓जब आप क्लासिक AppWidgetProvider संभालते हैं और उसे सही तरीके से अपडेट करना चाहते हैं।

Skill का लिंक

https://github.com/android/skills/blob/main/system/glance-appwidget-updates-and-memory/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/android/skills/blob/main/system/glance-appwidget-updates-and-memory/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरा Glance विजेट background sync के बाद अपडेट होना बंद कर देता है। रिफ़्रेश ठीक कीजिए और इमेज छोटी रखिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

स्किल आपकी build और manifest सेटिंग जाँचती है, फिर इमेज को विजेट के आकार तक downsample करती है। वह विजेट की स्थिति भी अपडेट करती है, ताकि होम स्क्रीन नवीनतम कंटेंट दिखाए।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

This skill provides guidance for managing state updates and keeping Android AppWidgets that use Jetpack Glance (androidx.glance:glance-appwidget) or RemoteViews within the Android 17 widget bitmap memory limits. For widget UI layout templates, suggest the glance-canonical-layouts skill.

Prerequisites

  • Kotlin Android project (minSdk >= 26) with compileSdk = 37 (targetSdk = 37 when targeting Android 17) in build.gradle.kts.
  • Jetpack Glance (1.2.0, minimum 1.1.1+) and the Compose compiler Gradle plugin enabled on the module.

Critical mandates

  • Preserve existing package name and toolchain versions : Inspect build.gradle.kts, gradle/libs.versions.toml, and Kotlin files first. Keep existing namespace, applicationId, package, targetSdk (unless migrating to Android 17), Android Gradle Plugin (AGP), and Kotlin versions.
  • Downsample images to widget dimensions and estimate the memory cap : Android system_server computes the RemoteViews bitmap memory cap (6 * width * height bytes, or 1.5 * 4 * width * height) once at boot from the real size of the default display and does not expose this cap in a public API. Because unfolding a foldable or switching display resolution to QHD+ after boot can make active window metrics report a larger value than the boot-time cap, always downsample each image first to the widget's target dimensions (maxWidthDp x maxHeightDp in RGB_565 or ALPHA_8), and enforce the per-image byte ceiling (calculateWidgetMemoryCapBytes(context) / distinctImageCount) estimated as 6 * width * height from WindowManager.currentWindowMetrics.bounds on API 30+ (falling back to resources.displayMetrics on API 26-29 or if WindowManager is unavailable).
  • Decode shared bitmaps once outside provideContent : Both SizeMode.Exact (used by glance-canonical-layouts to compose the current span's portrait and landscape orientations) and SizeMode.Responsive (used to pre-bundle a set of DpSize breakpoints) invoke provideContent multiple times per update. Decode shared bitmaps once in provideGlance before provideContent and pass them to ImageProvider(bitmap) so RemoteViews deduplicates the shared Bitmap across all sizes in either mode. If a widget scales distinct bitmaps per LocalSize.current, divide calculateWidgetMemoryCapBytes(context) by the number of distinct bitmaps.
  • Downsample content URIs and grant launcher read permissions : On Android 17 (targetSdk >= 37), bitmap-backed Icons count toward the cap alongside Bitmaps. content:// URIs passed to ImageProvider(uri) or RemoteViews.setImageViewUri don't count toward the inter-process communication (IPC) cap, but the launcher decodes them at full resolution. Downsample the file into context.cacheDir, expose it with FileProvider.getUriForFile, and grant Intent.FLAG_GRANT_READ_URI_PERMISSION to Intent.CATEGORY_HOME packages.
  • Trigger explicit widget updates after state mutations : updateAppWidgetState writes preferences to DataStore without updating the widget UI. After you mutate state, call GlanceAppWidget.update(context, glanceId) or GlanceAppWidget.updateAll(context).
  • Use full updateAppWidget calls when you replace images : In AppWidgetProvider classes, when you replace bitmaps or Icons, call AppWidgetManager.updateAppWidget instead of partiallyUpdateAppWidget.

Reference implementation files

Read the companion reference files in references/ when implementing each step, and update the sample package declaration and class names to match your app:

अक्सर पूछे जाने वाले सवाल

यह कौन सा Android वर्शन लक्षित करती है?

यह Android 17 (API 37) विजेट memory सीमा और उस वर्शन को टार्गेट करने की ज़रूरी सेटिंग कवर करती है।

क्या मुझे Glance चाहिए?

स्किल Jetpack Glance विजेट के लिए बनी है, और यह क्लासिक RemoteViews विजेट भी कवर करती है।

क्या यह विजेट का लेआउट डिज़ाइन करती है?

लेआउट टेम्पलेट एक अलग canonical layouts स्किल संभालती है।

जानकारी

लेखक का मूल विवरण

Manages Android AppWidget state updates, background syncs, and RemoteViews bitmap memory limits with Jetpack Glance (androidx.glance:glance-appwidget) and AppWidgetProvider receivers on Android 17 (API 37). Use this skill when configuring Android 17 (API level 37) compileSdk/targetSdk and AndroidManifest.xml widget receivers, refreshing frozen or stale Glance widget UI after CoroutineWorker DataStore preference updates (updateAppWidgetState), downsampling images within the WindowMetrics memory limit for SizeMode.Responsive, SizeMode.Exact, or LazyColumn, sharing content:// URIs with FileProvid

repo: android/skills

लोकप्रियता

GitHub स्टार
10k
रैंकिंग में स्थान
#11935
लाइसेंस
Apache-2.0
अपडेट की गई
29/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

agp-9-upgrade

10k

आपके एजेंट को Android ऐप को Android Gradle Plugin 9 पर ले जाने और उसके breaking changes सुधारने में मदद करती है। मल्टीप्लेटफ़ॉर्म प्रोजेक्ट के लिए नहीं।

कोडिंगमोबाइल ऐप

camerax

10k

आपके एजेंट को CameraX से Android कैमरा फ़ीचर बनाने में मदद करती है, जिसमें वीडियो रिकॉर्डिंग, हार्डवेयर कंट्रोल, ML Kit और Media3 इफ़ेक्ट शामिल हैं।

कोडिंगमोबाइल ऐप

android-for-cars-parked-apps

10k

आपके एजेंट को Android वीडियो, गेम या ब्राउज़र ऐप को Android Auto और Android Automotive पर parked ऐप के रूप में चलाने के लिए ढालने में मदद करती है।

कोडिंगमोबाइल ऐप

appfunctions

10k

आपके एजेंट को Android ऐप के मुख्य काम ढूँढकर उन्हें AppFunctions के रूप में देने में मदद करती है, ताकि AI एजेंट और वॉइस कमांड उन्हें चला सकें।

AI और एजेंटएजेंट

मिलती-जुलती skills