How to programatically detect if an app supports Android Wear? -
im trying detect if app supports android wear or watch face.
packagemanager pm = getactivity().getpackagemanager(); list<packageinfo> packs = pm.getinstalledpackages(0); (int = 0; < packs.size(); i++) {}
is code im using. feedback or suggestions awsome!
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; } }
Comments
Post a Comment