this question has answer here:
- check if application installed - android 5 answers
i have started final year android project , wondering when user presses button how open, example, facebook app , if user not have facebook app installed redirected m.facebook.com in browser?
thanks in advanced.
you can use try/catch handle it. if facebook app installed, fb://page/123 link open in app. else, catch code run.
@override public void onclick(view v) { try { startactivity(new intent(intent.action_view, uri .parse("fb://page/12345"))); //12345 facebook page number } catch (exception e) { //open link in browser startactivity(new intent(intent.action_view, uri .parse("http://m.facebook.com/etc"))); } }
Comments
Post a Comment