2016-05-31 2 views
1

기기의 모든 URL에 응답하는 앱을 만들고 싶습니다. 문서는Android의 모든 URL에 응답하는 인 텐트 필터?

<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:host="www.youtube.com" android:scheme="http" /> 
</intent-filter> 

하지만 어떻게 난 그냥 특정 도메인이나 호스트에 속하지 않는 모든 URL을 처리하기 위해 텐트 필터를 정의 할 below- 같은 특정 구조를 처리하는 방법을 언급? 가능한가?

답변

1

단순히 당신이 게시 코드에서 아래 라인을 제거합니다

<data android:host="www.youtube.com" android:scheme="http" /> 

그래서 당신이 또는

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

으로 끝날 것이다, 당신은 단지

<data android:scheme="http" /> 
에 라인을 단축 할 수 있습니다

이렇게하면 앱이 http URL 만 차단하므로 기본적으로 연결됩니다.

2

<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="http"/> 
      <data android:scheme="https"/> 
      <data android:scheme="about"/> 
      <data android:scheme="javascript"/> 
     </intent-filter> 
같은 스키마를 정의
관련 문제