2012-09-19 37 views
1

我的情况QR代码的应用程序如下:安装通过Android的

  1. 每当一些人使用类似于条形码扫描仪的任何第三方应用程序通过Android设备扫描特定应用程序的QR代码:

    a. If the scanned Qr code is not installed in the device it gets ,it open the url where it can be downloaded and installed. 
        b. Otherwise it opens the installed app in the device. 
    

回答

2

如果你想有一个QR代码,打开你的应用程序,您可以编辑您的应用程序:

我认为最好的办法是创建一个链接,其中:

  • 将打开你应用程序,如果它已安装。您应该在您的应用上使用一些意图过滤器来执行此操作。
  • 如果您的应用程序未安装,将打开浏览器到您的网站。然后,您可以从您的网站转到Google Play上的应用。

这里阅读我的回答这方面的更多细节:Opening Android app by way of link

一旦你创建了这个特殊的链接,你可以从这里创建一个QR代码:http://qrdroid.com/generate

如果你想有一个QR码打开任何应用程序:

然后,没有直接的方式来这样做,不幸的是。

您的唯一选择是编码指向Google Play的链接。它总是会链接到那里,但是,如果已经安装了该应用程序,则至少会显示一个“打开”按钮。

0

的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); 
    } 
} 
+0

但我无法自定义Qr代码应用程序。我希望如果链接被点击,应用程序会打开或安装。 – Varun

+0

你不需要自定义扫描仪,但至少你应该有自己的应用程序来实现你所说的,是的? – jaredzhang