I'm trying to create a Visit us on facebook thing, I want to rather open the page on facebook app (if the user have it) if don't then open on normal browser. This is my code based in @Jared Rummler answer
private void showPage(String url) {
Uri uri = Uri.parse(url);
try {
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo("com.facebook.katana", 0);
if (applicationInfo.enabled) {
uri = Uri.parse("fb://facewebmodal/f?href=" + url);
}
} catch (PackageManager.NameNotFoundException ignored) {
try {
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo("com.facebook.lite", 0);
if (applicationInfo.enabled) {
uri = Uri.parse("fb://facewebmodal/f?href=" + url);
}
} catch (PackageManager.NameNotFoundException e) {
//do nothing
}
}
startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
and to url I'm using the string:
"https://www.facebook.com/<my_page_name>"
Ok. However it just only works to normal facebook app. Anyone know what I have to change to make it works with facebook lite app?
I'm catching the following error on logcat:
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.technology.softwares.click.rs, PID: 4086 android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=fb://facewebmodal/f?href=https://www.facebook.com/<my_page_name>
Thanks