이러한 인 텐트 필터와이 처리기로 공유 인 텐트를 수신하도록 앱을 설정했습니다. 공유 메뉴에는 표시되지 않습니다.공유 메뉴에 앱이 표시되지 않습니다.
<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();
}
});
}
공유 의도와 같은 것이 없습니다. 앱은 다양한 액션, 유형, 부가 기능 및 데이터로 인 텐트를 사용하여 데이터를 공유 할 수 있습니다. 대부분이 앱은 ACTION_SEND를 사용하지만 앱에 따라 다른 매개 변수가 크게 달라집니다. 인 텐트 필터를 사용하면 http 및 https 체계를 사용하는 Intents 만 잡을 수 있고 코드는 텍스트/일반 형식을 추가로 제한합니다. 위의 코드가 작동하는지 여부에 관계없이 모두 "공유 메뉴"가 트리거 될 때 수행되는 작업에 따라 다릅니다. –
특히 Dolphin Browser에서 공유 링크 인 텐트를 처리하려고합니다. – sajattack