here if facebook is not installed on your divice then it will redirect to web browser.
public void getFacebook(){
bool result=isAppInstalled("com.facebook.katana");
if(result)
{
string v = FB_URL.Replace("https", "fb");
var uri = Android.Net.Uri.Parse (v);
var intent = new Intent (Intent.ActionView, uri);
StartActivity(intent);
}
else
{
StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse(FB_URL)));
}
}
protected bool isAppInstalled(string packageName)
{
Intent mIntent = PackageManager.GetLaunchIntentForPackage(packageName);
if (mIntent != null)
{
return true;
}
else
{
return false;
}
}
No comments:
Post a Comment