HTTP 기본 인증 정보를 Intent.ACTION_VIEW
으로 전달하는 방법은 무엇입니까? 여기에 내가 의도를 발사하고있어 어디 : 나는 또한, 같은 거래를 Uri.fromParts()
을 시도Android 인 텐트 .ACTION_VIEW 기본 인증
public class OutageListFragment extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> {
// ...
@Override
public void onListItemClick(ListView listView, View view, int position, long id) {
super.onListItemClick(listView, view, position, id);
// Get a URI for the selected item, then start an Activity that displays the URI. Any
// Activity that filters for ACTION_VIEW and a URI can accept this. In most cases, this will
// be a browser.
String outageUrlString = "http://demo:[email protected]/opennms/outage/detail.htm?id=204042";
Log.i(TAG, "Opening URL: " + outageUrlString);
// Get a Uri object for the URL string
Uri outageURI = Uri.parse(outageUrlString);
Intent i = new Intent(Intent.ACTION_VIEW, outageURI);
startActivity(i)
}
}
. 컬은 잘 작동합니다.
의도적 인 URI를받는쪽에 달려 있습니다. 당신의 로그는 당신이 원하는 것을 인쇄합니까? 이 다음 브라우저에 갈 것인가? – Blundell
@Blundell Log는 내가 원하는 것을 인쇄합니다. outageURI.getUserInfo()는 사용자 ID와 암호를 표시합니다. 안드로이드 브라우저는 curl이하는 "Authorization : Basic ZGVtbzpkZW1v \ r \ n"을 보내지 않는 것 같습니다. – Wrolf
하지만 cURL 명령에 헤더로 추가 하시겠습니까? Uri – Blundell