2012-09-19 38 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