Add new facility for apps to declared their preferred intents.
This is an extension from the existing data/etc/perferred-apps facility. Now applications pre-installed on the system image can declare which intents they would like to be considered the preferred app for. When the system firsts initializes, or the application settings are reset, these are used to configured the current preferred app settings appropriately. You use this with a new <preferred> tag under your activity, which indicates which intents you would like to be the preferred handler for. The syntax for this is written much like an intent filter, however semantically it is not really an intent filter and so has some important differences: - You can not use globbing patterns (for SSPs or paths). - You can use only one action (if you use more than one it will only use the first one, so be careful). Semantically what this is actually used for is a template from which to generate a set of Intent objects, which are used to probe the current environment in order to see if there are multiple activities that can handle the Intent and, if so, generate a new preferred setting for that pointing to your app. As an example, here is how the preferred tag might be written for the Maps application: <preferred> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:host="maps.google.com" /> <data android:path="/" /> <data android:pathPrefix="/maps" /> </preferred> <preferred> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="geo" /> </preferred> From this, we generate the following set of potential Intents to be matched, all with ACTION_VIEW, CATEGORY_DEFAULT+CATEGORY_BROWSABLE: Change-Id: I7fd42aec8b6109c7dd20012529662362f1b7437a http://maps.google.com/ http://maps.google.com/maps https://maps.google.com/ https://maps.google.com/maps geo:
Loading
Please register or sign in to comment