Android - Check If Facebook App Exists Returns Wrong Result
I'm opening links received in notifications in FB native app if it's installed on the app and in the browser otherwise, using this code: PackageManager packageManager = context.get
Solution 1:
public static boolean isPackageExisted(Context c, String targetPackage) {
PackageManager pm = c.getPackageManager();
try {
PackageInfo info = pm.getPackageInfo(targetPackage,
PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
return false;
}
return true;
}
Post a Comment for "Android - Check If Facebook App Exists Returns Wrong Result"