2011-01-19 5 views
5

「myapp://blah.com/a?b = 1」と入力すると、ブラウザを起動する必要があります& c = 2 "となります。私はこのトピックで多くを検索しましたが、答えのうちのどれも本当に私を助けませんでした。私が迷っていることを理解するのを助けてくれますか?アドレスバーに「myapp://」と入力すると、Androidブラウザからアプリを起動する方法

<activity android:name=".MyAppMain" 
       android:label="@string/app_name" 
       android:configChanges="keyboardHidden|orientation" 
       android:screenOrientation="portrait"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
     <intent-filter> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <data android:scheme="myapp" /> 
     </intent-filter> 
    </activity> 

のEclipse(Androidのアプリケーションとして実行)からのインストール後に私のアプリは、独自の[OK]を動作することができますが、私は "myappの?://blah.com/a B = 1 & C = 2" と入力するときブラウザは単にこの文字列を検索しているだけです。他に何が足りないのか教えていただけますか?インストール後に「myapp://」URLを処理したいシステムに何らかの方法で登録する必要がありますか?

+0

マニフェストでそののみを使用すると機能しますか? –

+0

いいえ、Daniel、それはまだグーグルです:-) – user789175

+0

@ user789175これを理解しましたか? – Phil

答えて

0

私は、これはあなたを助けることを願っています

<activity android:name=".ReceiveInviteActivity"> 

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

       <data 
       android:scheme="appname" 
       android:host="project.example.com" 

       /> 
      </intent-filter> 

     </activity> 

と活動

if (Intent.ACTION_VIEW.equals(action)) { 
      final List<String> segments = intent.getData().getPathSegments(); 
      Log.d("LISTARRAY",segments.toString()); 
      String idString = segments.get(0); 
      Log.d("LISTITEM",segments.get(0).getClass().toString()); 
      String friendId = idString.substring((idString.indexOf("="))+1); 
      Log.d("friendId!",friendId); 

を使用して、これを行っています。

0

は、それが機能しない理由のために、この答えをチェックアウト:Android custom URI scheme incorrectly encoded when type in browser

直接URLバーに入力したとき、あなたのカスタム1が動作しませんので、基本的には、デフォルトのAndroidブラウザは、特定のURIスキームを受け入れます。

関連する問題