2013-06-22 1 views
1

이러한 인 텐트 필터와이 처리기로 공유 인 텐트를 수신하도록 앱을 설정했습니다. 공유 메뉴에는 표시되지 않습니다.공유 메뉴에 앱이 표시되지 않습니다.

<intent-filter> 
    <action android:name="android.intent.action.SEND" /> 
    <category android:name="android.intent.category.DEFAULT" /> 
    <data android:scheme="http"/> 
</intent-filter> 
<intent-filter> 
    <action android:name="android.intent.action.SEND" /> 
    <category android:name="android.intent.category.DEFAULT" /> 
    <data android:scheme="https"/> 
</intent-filter> 


Intent intent = getIntent(); 
String action = intent.getAction(); 
String type = intent.getType(); 
if (Intent.ACTION_SEND.equals(action) && type.equals("text/plain")) { 
    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); 
    builder.setTitle(R.string.pick_profile); 
    builder.setItems(getConnProfNames(connectionProfiles), new DialogInterface.OnClickListener() { 
     public void onClick(DialogInterface dialog, int which) { 
      selectedItem = connectionProfiles.get(which); 
      DownloadTask.execute(); 
     } 
    }); 
} 
+0

공유 의도와 같은 것이 없습니다. 앱은 다양한 액션, 유형, 부가 기능 및 데이터로 인 텐트를 사용하여 데이터를 공유 할 수 있습니다. 대부분이 앱은 ACTION_SEND를 사용하지만 앱에 따라 다른 매개 변수가 크게 달라집니다. 인 텐트 필터를 사용하면 http 및 https 체계를 사용하는 Intents 만 잡을 수 있고 코드는 텍스트/일반 형식을 추가로 제한합니다. 위의 코드가 작동하는지 여부에 관계없이 모두 "공유 메뉴"가 트리거 될 때 수행되는 작업에 따라 다릅니다. –

+0

특히 Dolphin Browser에서 공유 링크 인 텐트를 처리하려고합니다. – sajattack

답변

0

공유 의도와 같은 것은 없습니다. 앱은 다양한 액션, 유형, 부가 기능 및 데이터로 인 텐트를 사용하여 데이터를 공유 할 수 있습니다. 대부분이 앱은 ACTION_SEND를 사용하지만 앱에 따라 다른 매개 변수가 크게 달라집니다. 인 텐트 필터를 사용하면 http 및 https 체계를 사용하는 Intents 만 잡을 수 있고 코드는 텍스트/일반 형식을 추가로 제한합니다. 위의 코드가 작동하는지 여부에 관계없이 모두 "공유 메뉴"가 트리거 될 때 수행되는 작업에 따라 다릅니다.

돌핀 브라우저가 데이터를 공유하기 위해 사용하는 의도는 공개적으로 문서화되지 않은 AFAIK입니다.

CharSequence text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT); 

정말 따라 당신이 무엇에 :

<intent-filter> 
    <action android:name="android.intent.action.SEND" /> 
    <data android:mimeType="*/*" /> 
    <category android:name="android.intent.category.DEFAULT" /> 
</intent-filter> 

가 나는 또한 이렇게 같은 엑스트라의 URL을 잡아 관리 : 나는 "캐치"다음 필터를 사용하여 텐트 중 하나에 관리 필요한 필터를 얻으려고합니다. URL을 가져 와서 HTML 페이지를로드하려는 경우 내가 사용한 필터가 작업을 수행합니다. URL을 가져 오면 페이지를 표시 할 수 있습니다. WebView에서.