如果安装了如何在Facebook App中打开Facebook页面链接,如果未在Android中的默认浏览器中打开应用程序?
我试过这段代码,但它没有用?
Face.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = null;
String Facebook = dbList.get(0).getFacebook().toString();
try {
// get the Twitter app if possible
getPackageManager().getPackageInfo("com.facebook.android", 0);
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/" +Facebook));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
} catch (Exception e) {
// no Twitter app, revert to browser
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/?hl=en"));
}
startActivity(intent);
}
});
答案 0 :(得分:1)
答案 1 :(得分:0)
git fetch origin (or other repo name show above)
git branch -a # this will show all the branches.
答案 2 :(得分:0)
我使用Unity Android游戏。任务是在FB应用程序中打开Facebook Fan页面(如果已安装)。我需要做的就是:
创建Android库并检查是否已安装FB:
public boolean isFbInstalled(Activity a) {
PackageManager packageManager = a.getApplicationContext().getPackageManager();
try {
int versionCode = packageManager.getPackageInfo("com.facebook.katana", 0).versionCode;
if (versionCode >= 3002850) { //newer versions of fb app, no need to handle older
return true;
}
} catch (PackageManager.NameNotFoundException e) {
return false;
}
return false;
}
转到this service,并将生成的链接用于不同的平台:)