2013-11-04 27 views
1

這是我的代碼。我已閱讀其他人關於這個問題的帖子。他們說他們的代碼工作得很好。 而我的代碼幾乎與他們的一樣。爲什麼它在我的測試中不起作用。我的設備是三星I9300。Android URL方案不起作用

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.haibin.androidtest.MainActivity" 
     android:label="@string/app_name" 
     android:exported="true" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
     <intent-filter> 
      <data android:scheme="haibintest"/> 

      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
     </intent-filter> 
    </activity> 
</application> 

PS:我用「亞行-d殼上午開始-d haibintest:// -a android.intent.action.VIEW」的命令行和它susccessfully推出,而使用url在做布勞爾沒有工作。

ps2:我在opera中測試它,它工作得很好,所以我知道它在某些瀏覽器和設備中不起作用。

回答

1

要使用URL方案中,亞行可以使用以下命令行:

adb shell 'am start "intent:#Intent;scheme=yourscheme://yoururl?param1=value1;end"' 

或者你甚至可以用QrCodes做到這一點: 轉到ZXing,併產生這種格式的URL:

yourscheme://yoururl?param1=value1 

然後,用一個QrCode應用程序掃描了像BarcodeScanner