You can follow the same model we use for input methods, app widgets, live wallpapers, and other things (none of which are fundamentally kinds of things in the platform, but built on top of the fundamental generic activity, receiver, service, and provider components):
1. Pick the kind of component that best represents your object. If there is not going to be any code that needs to be run by the object, then this is kind-of arbitrary. The two most typical components to use for this are a receive or service. Let's pick a receiver. 2. Define your own action the you can use to find any receivers you are interested in. For example "com.mydomain.keyapp.EXTERNAL_KEYBOARD". 4. Define a meta-data item to be associated with this component. This will be a reference to an XML resource, containing an XML file organized however you want describing your domain-specific information associated with the component. 3. When you run, use PackageManager,queryIntentReceivers() to find all receiver that support your protocol. Use GET_META_DATA to also retrieve the meta-data associate with the component. You can iterate through the returned list, processing the XML meta data file associated with each of the returned components to find out about them. You can look at WallpaperService for a pretty good example of a typical way to structure such a thing (though in this case based on a service, not a receiver): http://developer.android.com/reference/android/service/wallpaper/WallpaperService.html <http://developer.android.com/reference/android/service/wallpaper/WallpaperService.html>Note the SERVICE_INTERACE (that's the action) and SERVICE_META_DATA associated with the component. The WallpaperInfo class is a good example of how you can parse the component and meta-data associated with it: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/app/WallpaperInfo.java<http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/app/WallpaperInfo.java;h=34d3133bdf05e89eb15e2dafdec22040d2decbec;hb=HEAD> (Note because we do not currently support third party shared libraries, you will not be able to define your own custom attributes that can be used by the other applications. You can use any of the standard platform attributes, though, and just retrieve regular attributes of whatever type you want.) On Sat, Feb 13, 2010 at 11:59 PM, Menny <[email protected]> wrote: > So you suggest that I'll have a pre-define resource which will hold > all the information I need (let's say it is an XML resource) for > creating the external keyboard. This sounds OK. > The only problem is how to query for packages which have this > resource? > I can still create an Activity which have another pre-defined activity- > filter which I can query for. > Is this a reasonable method? Or is there a clearer way (I mean, I > create an activity just for query usages)? > > Thanks, > Menny > > On Feb 14, 12:44 am, Mark Murphy <[email protected]> wrote: > > Menny wrote: > > > I don't know what the other ContentProviders URI are. > > > They can be anything, I want to release my keyboard service, and then > > > release layouts as I need. > > > This means that, somehow, the keyboard service needs to "know" which > > > layout packages are installed on the device, and what are the URI of > > > their content-providers. > > > > Another alternative is to still use Context.createPackageContext(), but > > primarily as a bootstrap. The APK would publish its content URI in a > > pre-determined resource (e.g., R.string.any_soft_keyboard_provider_uri), > > which you would then use. > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com| > http://twitter.com/commonsguy > > > > Android Development Wiki:http://wiki.andmob.org > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

