I am starting to work on the new Android Wear 2.0 Api's specifically Complications. I have found out that the Complications will default to the "easiest" supported type that the provider also supports, such as the Android Wear Battery Life will default to TYPE_SHORT_TEXT when the complication supports TYPE_SHORT_TEXT as well as TYPE_RANGED_VALUE. So I am wondering if there is a way to access the types the provider supports (which is added in the manifest for provider as a service) as shown below.
<meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="RANGED_VALUE,SHORT_TEXT,LONG_TEXT"/>
Is there a way to access the array of supported types of a provider?
EDIT:
I found the way to access the supported types of a provider through reading the manifest's meta data where the supported types for the service is needed to be declared.
ComponentName service = new ComponentName(this, DataProvider.class);
try {
Bundle bundle = getPackageManager().getServiceInfo(service, PackageManager.GET_META_DATA).metaData;
if(bundle != null) {
for (String key : bundle.keySet()) {
Object value = bundle.get(key);
Log.d(TAG, String.format("%s %s (%s)", key,
value.toString(), value.getClass().getName()));
}
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
Though I am still wondering about how to access the supported type of Google's system built providers (under AppName: Android Wear) such as Watch battery, World clock, etc.
Any ideas?