的QR掃描儀應爲返回的應用程序包的名稱,與調用下面的函數,此代碼對我的作品
public void startApplication(Context context, String packageName) {
PackageManager pm = context.getPackageManager();
Intent appStartIntent = pm.getLaunchIntentForPackage(packageName);
if (appStartIntent != null)
{
context.startActivity(appStartIntent);
}
// if the intent is null which means you have not installed the app then open the google play
else {
Intent searchIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName));
searchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(searchIntent);
}
}
但我無法自定義Qr代碼應用程序。我希望如果鏈接被點擊,應用程序會打開或安裝。 – Varun
你不需要自定義掃描儀,但至少你應該有自己的應用程序來實現你所說的,是的? – jaredzhang