I have created a plugin application which is composed by multiple .apk Some .apk provides only a Live Wallpaper service with the following XML:
<application
... omitted
<service
android:name=".DigitalWallpaperService"
android:label="Wear Digital WatchFace">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="xxx.WATCHFACE" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/clock"/>
</service>
</application>
I have created an AsyncLoader that needs to retrieve only this type of service, so my query looks like this one:
// query the available watch faces
Intent filter = new Intent("android.service.wallpaper.WallpaperService");
filter.addCategory("xxx.WATCHFACE");
List<ResolveInfo> watchFaces = packageManager.queryIntentServices(filter, 0);
But I get back nothing. I though that packageManager.queryIntentServices would return them but it doesn't. Any alternative? I don't want all available Live Wallpapers but only those who implement the category I mention before.
So I have resolved using a different Intent Filter. First, I declare my Live Wallpapers using a special category owned by my company namespace:
Then I simply query the available Wallpaper Services and filter using my Category:
I hope it can help somebody else.