27 মার্চ, 2025 থেকে, আমরা AOSP তৈরি করতে এবং অবদান রাখতে aosp-main
এর পরিবর্তে android-latest-release
ব্যবহার করার পরামর্শ দিচ্ছি। আরও তথ্যের জন্য, AOSP-তে পরিবর্তনগুলি দেখুন।
একটি AppCard হোস্ট কনফিগার করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
AppCards দেখায় এমন অ্যাপগুলির সাথে যোগাযোগ করতে AppCardHost
ব্যবহার করুন।
অনুমতি
AppCardHost
ব্যবহার করে এমন যেকোনো অ্যাপের নিম্নলিখিত অনুমতি থাকতে হবে:
-
android.permission.INTERACT_ACROSS_USERS_FULL
-
android.permission.QUERY_ALL_PACKAGES
- ( শুধুমাত্র API স্তর 34 এবং উচ্চতর)
android.car.permission.BIND_APP_CARD_PROVIDER
আরম্ভ করুন
হোস্ট শুরু করতে, প্রদান করুন:
- প্রসঙ্গ
-
updateRate
AppCard আপডেট রেট মিলিসেকেন্ডে। -
fastUpdateRate
EnforceFastUpdateRate
সাথে ট্যাগ করা উপাদানগুলির জন্য মিলিসেকেন্ডে আপডেটের হার -
responseExecutor
একটি থ্রেড যার উপর আপনি AppCard অ্যাপ থেকে প্রতিক্রিয়া পেতে চান।
ডিজাইন
একটি AppCardHost
এর সাথে দুটি উপায়ের একটিতে যোগাযোগ করা যেতে পারে:
বা,
অ্যাপকার্ড লিসনার
AppCardListener
উপাদানটি AppCardHost
এবং AppCard অ্যাপ থেকে যোগাযোগের আপডেট পেতে একটি AppCardHost
এর সাথে নিজেকে নিবন্ধন করে। একটি AppCardListener
এর ইন্টারফেস ফাংশন এখানে বিস্তারিত আছে।
fun onAppCardReceived(AppCardContainer)
একটি অ্যাপ থেকে একটি AppCard গৃহীত হলে এই ফাংশনটি ট্রিগার হয়। এটি একটি AppCardContainer
হিসাবে পাঠানো হয় যা একটি AppCard এবং একটি appIdentifier
প্রদান করে যেটি AppCard পাঠিয়েছে সেই অ্যাপটিকে সনাক্ত করতে fun onComponentReceived(AppCardComponentContainer)
এই ফাংশনটি ট্রিগার হয় যখন একটি AppCard উপাদান একটি অ্যাপ থেকে প্রাপ্ত হয়। এটি একটি AppCardComponentContainer
হিসাবে পাঠানো হয়, যা একটি AppCards উপাদান প্রদান করে, যে অ্যাপটি AppCard পাঠিয়েছে সেটি সনাক্ত করতে Identifier
এবং AppCard যেটির সাথে উপাদানটি সম্পর্কিত তা নির্দেশ করার জন্য একটি স্ট্রিং আইডি প্রদান করে৷ fun onProviderRemoved(String, String?)
একটি AppCard প্রদানকারী সরানো বা অক্ষম করা হলে এই ফাংশনটি ট্রিগার হয়। প্রদত্ত প্যাকেজের নাম এবং প্রদানকারী কর্তৃপক্ষের সাথে সম্পর্কিত যেকোনো সক্রিয় AppCard পরিষ্কার করতে এই পদ্ধতিটি ব্যবহার করুন। যদি কর্তৃপক্ষ {@code null}
হয়, তাহলে একটি সম্পূর্ণ প্যাকেজ সরানো হয়েছে৷
fun onProviderAdded(String, String?)
যখন একটি AppCard প্রদানকারী যোগ করা বা সক্ষম করা হয় তখন এই ফাংশনটি ট্রিগার হয়৷ নমুনা ব্যবহার। একটি AppCard পিকারে উপলব্ধ সমস্ত AppCard রিফ্রেশ করতে একটি ট্রিগার হিসাবে এই ফাংশনটি ব্যবহার করুন৷ যদি কর্তৃপক্ষ {@code null}
হয়, তাহলে একটি সম্পূর্ণ প্যাকেজ যোগ করা হয়েছে৷
fun onPackageCommunicationError(appIdentifier, Throwable)
অ্যাপকার্ড প্রদানকারীর সাথে যোগাযোগ করার সময় AppCardHost
একটি ত্রুটির সম্মুখীন হলে এই ফাংশনটি ট্রিগার হয়৷ নমুনা ব্যবহার। ব্যবহারকারীকে দেখানোর জন্য এই পদ্ধতিটি ব্যবহার করুন যে তারা নির্বাচিত একটি AppCard একটি ত্রুটির সম্মুখীন হয়েছে৷
এপিআই
fun refreshCompatibleapp()
যখনই হোস্ট ব্যবহার করা কার্যকলাপ পুনরায় শুরু করা হয় তখন এই পদ্ধতিটি কল করা উচিত যাতে হোস্ট অ্যাপকার্ড সমর্থন করে এমন অ্যাপগুলির তালিকা রিফ্রেশ করতে পারে। fun destroy()
হোস্ট ব্যবহার করে এমন একটি কার্যকলাপ ধ্বংস হয়ে গেলে এই পদ্ধতিটি কল করুন যাতে হোস্ট সমস্ত সংযোগ এবং অভ্যন্তরীণ সদস্যদের পরিষ্কার করতে পারে। fun registerListener(AppCardListener)
একটি AppCardListener
রেজিস্টার করতে ব্যবহৃত হয়। fun unregisterListener(AppCardListener)
একটি AppCardListener
নিবন্ধনমুক্ত করতে ব্যবহৃত হয়। fun getAllAppCards(AppCardContext)
একটি প্রদত্ত AppCardContext
সহ সিস্টেমে প্রদত্ত সমস্ত AppCards সহ একটি নিবন্ধিত AppCardListener
সরবরাহ করতে এই পদ্ধতিতে কল করুন যা প্রদানকারীদের তাদের AppCard গঠনের বিষয়ে ইঙ্গিত দেয়৷ fun requestAppCard(AppCardContext, appIdentifier, String)
একটি নির্দিষ্ট AppCard সহ একটি নিবন্ধিত AppCardListener
সরবরাহ করার জন্য এই পদ্ধতিতে কল করুন, একটি AppCardContext
দেওয়া হয়েছে যা প্রদানকারীদের তাদের AppCard কীভাবে গঠন করতে হবে তার ইঙ্গিত দেয়। fun notifyAppCardRemoved(appIdentifier, String)
একটি AppCard প্রদানকারীকে জানান যে তার AppCard আর সক্রিয় নেই৷ fun notifyAppCardInteraction(appIdentifier, String, String, String)
একটি AppCard প্রদানকারীকে অবহিত করুন যে তার AppCard এর সাথে ইন্টারঅ্যাক্ট করা হয়েছে। শুধুমাত্র সমর্থিত ইন্টারঅ্যাকশন হল একটি বোতাম ক্লিক, যা একটি AppCardMessageConstants.InteractionMessageConstants.MSG_INTERACTION_ON_CLICK
দ্বারা চিহ্নিত করা হয়। আমরা একটি onClick
শ্রোতা সহ একটি AppCard-এর জন্য একটি বোতাম তৈরি করার পরামর্শ দিই যা এই ফাংশনটিকে appIdentifier
, AppCard আইডি, কম্পোনেন্ট আইডি এবং ইন্টারঅ্যাকশন আইডি দিয়ে কল করে৷ fun sendAppCardContextUpdate(AppCardContext, appIdentifier, String)
একটি নির্দিষ্ট AppCard এর জন্য একটি AppCardContext
আপডেট পাঠান। উদাহরণস্বরূপ, পার্ক মোড থেকে ড্রাইভ মোডে স্থানান্তর করার সময়, একটি AppCardContext
আপডেট পাঠাতে এই পদ্ধতিটি ব্যবহার করুন যেখানে প্রতিটি সক্রিয় AppCard-এর জন্য isInteractable
false
সেট করা আছে। FAQ
আমি নমুনা বাস্তবায়ন কোথায় পেতে পারি?
প্রতিটি AppCardContentProvider
কতগুলি AppCard সমর্থন করতে পারে?
একটি AppCardContentProvider
অসীম সংখ্যক AppCard সমর্থন করতে পারে। যাইহোক, একটি ইতিবাচক ব্যবহারকারীর অভিজ্ঞতা বনাম অবনমিত কর্মক্ষমতা সহ AppCard সংখ্যার ভারসাম্য নিশ্চিত করুন৷
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-06-26 UTC-তে শেষবার আপডেট করা হয়েছে।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-06-26 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Configure an AppCard host\n\nUse `AppCardHost` to communicate with apps that show AppCards.\n\nPermissions\n-----------\n\nAny app that uses an `AppCardHost` must have the following permissions:\n\n- `android.permission.INTERACT_ACROSS_USERS_FULL`\n- `android.permission.QUERY_ALL_PACKAGES`\n- (In API level 34 and higher **only** ) `android.car.permission.BIND_APP_CARD_PROVIDER`\n\nInitialize\n----------\n\nTo initialize the host, provide:\n\n- Context\n- `updateRate` AppCard update rate in milliseconds.\n- `fastUpdateRate` Update rate in milliseconds for components tagged with `EnforceFastUpdateRate`\n- `responseExecutor` A thread on which you want to receive responses from AppCard apps.\n\nDesign\n------\n\nAn `AppCardHost` can be interacted with in one of two ways:\n\n- Register as an [`AppCardListener`](#appcardlistener)\n\nOR,\n\n- Interact with the [`AppCardHost` APIs](#api)\n\n### AppCardListener\n\nThe `AppCardListener` component registers itself with an `AppCardHost`\nto receive communication updates from the `AppCardHost` and AppCard apps.\nThe interface functions of an `AppCardListener` are detailed here.\n\n\u003cbr /\u003e\n\n`fun onAppCardReceived(AppCardContainer)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis function is triggered when an AppCard has been received from an app. It's sent as an `AppCardContainer` which provides an AppCard and an `appIdentifier` to identify the app that sent the AppCard\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun onComponentReceived(AppCardComponentContainer)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis function is triggered when an AppCard component is received from an app. It's sent as an `AppCardComponentContainer`, which provides an AppCards component, `Identifier` to identify the app that sent the AppCard, and a string ID to point to the AppCard to which the component is related.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun onProviderRemoved(String, String?)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis function is triggered when an AppCard provider has been removed or disabled. Use this method to clean up any active AppCard related to the given package name and provider authority.\u003cbr /\u003e\n\nIf authority is `{@code null}`, then an entire package was removed.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun onProviderAdded(String, String?)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis function is triggered when an AppCard provider has been added or enabled.\u003cbr /\u003e\n\n**Sample usage.** Use this function as a trigger to refresh all available\nAppCards in an AppCard picker. If authority is `{@code null}`, then an entire\npackage was added.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun onPackageCommunicationError(appIdentifier, Throwable)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis function is triggered when the `AppCardHost` encounters an error when communicating with an AppCard provider.\n\n\u003cbr /\u003e\n\n**Sample usage.** Use this method to show to the user that an AppCard they have\nselected has encountered an error.\n\n\u003cbr /\u003e\n\n### APIs\n\n\u003cbr /\u003e\n\n`fun refreshCompatibleapp()`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis method should be called whenever the activity that is using the host is resumed so that the host can refresh its list of apps that support AppCards.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun destroy()`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nCall this method when an activity that is using a host is destroyed so that the host can clean up all connections and internal members.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun registerListener(AppCardListener)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nUsed to register an `AppCardListener`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun unregisterListener(AppCardListener)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nUsed to unregister an `AppCardListener`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun getAllAppCards(AppCardContext)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nCall this method to supply a registered `AppCardListener` with all the AppCards provided in the system with a given `AppCardContext` that provides hints to the providers on how to structure their AppCard.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun requestAppCard(AppCardContext, appIdentifier, String)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nCall this method to supply a registered `AppCardListener` with a specific AppCard, given an `AppCardContext` that gives hints to the providers on how to structure their AppCard.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun notifyAppCardRemoved(appIdentifier, String)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nNotify an AppCard provider that its AppCard is no longer active.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun notifyAppCardInteraction(appIdentifier, String, String, String)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nNotify an AppCard provider that its AppCard has been interacted with. The only supported interaction is a button click, which is signified by a `AppCardMessageConstants.InteractionMessageConstants.MSG_INTERACTION_ON_CLICK`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nWe recommend creating a button for an AppCard with an `onClick` listener that calls this function with `appIdentifier`, AppCard ID, component ID, and interaction ID.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n`fun sendAppCardContextUpdate(AppCardContext, appIdentifier, String)`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nSend an `AppCardContext` update for a specific AppCard. For example, when shifting from Park mode to Drive mode, use this method to send an `AppCardContext` update in which `isInteractable` is set to `false` for each active AppCard.\n\n\u003cbr /\u003e\n\nFAQ\n---\n\n1. Where can I find sample implementations?\n\n - [Sample host](https://android.googlesource.com/platform/packages/apps/Car/libs/+/refs/tags/ub-automotive-master-20250418/car-app-card-host-lib/sample-host/). Shows all available AppCards in the system, along with\n testing capabilities.\n\n - DriverUI and [Pano manager](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/services/Car/car_product/distant_display/apps/CarDistantDisplayPanoManager/;l=1?q=CarDistantDisplayPanoManager&sq=&ss=android%2Fplatform%2Fsuperproject%2Fmain). Pano manager acts as the picker while\n DriverUI acts as the presenter.\n\n2. How many AppCards can each `AppCardContentProvider` support?\n\n An `AppCardContentProvider` can support an infinite number of AppCards.\n However, be sure to balance the number of AppCards with degraded performance\n versus a positive user experience."]]