Im trying to detect if an app supports Android Wear or is a watch face.
PackageManager pm = getActivity().getPackageManager();
List
To check if Android Wear package exists on system:
public void foobar() {
boolean doesExist = isPackageInstalled("com.google.android.wearable.app");
}
private boolean isPackageInstalled(String packagename) {
PackageManager pm = getApplicationContext().getPackageManager();
try {
pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
return true;
} catch (NameNotFoundException e) {
//swallow exception
return false;
}
}