문제

Android 2.3 (API 레벨 10) 및 이전 버전의 브라우징 가능한 의도로 Android 활동을 등록하는 데 다른 단계가 있습니까?

사용자 정의 체계를 사용하는 의도 필터로 활동을 설정했습니다.

<intent-filter>
    <action name="android.intent.action.VIEW"/>
    <category name="android.intent.category.DEFAULT"/>
    <category name="android.intent.category.BROWSABLE"/>
    <data scheme="@string/myCallbackProtocol"/>
</intent-filter>
.

2.3을 실행하는 물리적 장치에서 SDK의 시뮬레이터가 2.3으로 설정된 경우 브라우저 응용 프로그램은 내 사용자 정의 프로토콜을 사용하여 링크를 앱으로 지시합니다.

그러나 시뮬레이터를 2.2 또는 2.1로 확장하면 브라우저가 리디렉션되지 않고 대신 서버를 찾을 수 없음을 나타냅니다.이러한 API 레벨을 실행하는 실제 장치가 없습니다.

2.1 이상을 실행하는 장치와 호환되도록 내 앱을 릴리스하고 싶습니다.이것이 가능해야한다고 가정하는 것이 잘못 되었습니까? Android 문서 Intent.CATEGORY_BROWSABLE는 1.0 이후로 사용할 수 있습니다.

감사합니다!

도움이 되었습니까?

해결책 2

Solved. BROWSABLE works back at least as far as Android 2.1. Before 2.3 it seems that loading the <data scheme=""> from a string resource leads to the Activity not being registered correctly.

Changing the @string/ reference to a hard-coded value yields the desired result.

<intent-filter>
    <action name="android.intent.action.VIEW"/>
    <category name="android.intent.category.DEFAULT"/>
    <category name="android.intent.category.BROWSABLE"/>
    <data scheme="my-custom-protocol"/>
</intent-filter>

다른 팁

I have had no problems using BROWSABLE going back at least to 2.1 if not earlier. However, I have not implemented a custom scheme, let alone one defined in a string resource. Here is a sample project demonstrating the use of BROWSABLE.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top