NFC를 통해 특정 도메인에 대해 열린 URI를 처리하려고합니다.Android NFC : 앱이 시작되었지만 의도가 의도되지 않았습니다.
매니페스트이 있습니다
<activity android:name="HistoryActivity"
android:theme="@android:style/Theme.Light.NoTitleBar"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https"
android:host="mydomain.me"
android:pathPrefix="/x" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"
android:host="mydomain.me"
android:pathPrefix="/x" />
</intent-filter>
</activity>
onResume과 같이 onNewIntent :
@Override
protected void onResume() {
super.onResume();
Intent intent = new Intent(this, this.getClass());
//intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
this.handleNfcBeam(intent);
}
@Override
protected void onNewIntent(Intent intent)
{
setIntent(intent);
this.handleNfcBeam(intent);
}
와 같은 handleNfcBeam 보이는 : I 빔 올바른 URL이 앱이 경우
protected boolean handleNfcBeam(Intent intent)
{
String action = intent.getAction();
if (action != null &&
action.equalsIgnoreCase("android.nfc.action.NDEF_DISCOVERED"))
{
return true; // todo: process URL
}
return false;
}
을 발사되고있다. 그러나, 행동은 항상 null입니다 !! 내가 잘못하고있는 중이 야 내가 이벤트가 실제로 메시지를 처리 할 수있는 점에 못 했어
...
?
덕분에, 다니엘
감사합니다. 나는 투표 할만한 평판 포인트가 충분하지 않습니다. - 그리고 나는 여전히 대답을 표시 할 수 없도록 "신비"를 해결하지 못했습니다. –
내가 언급 한 것을 확인 했습니까? 특히 매니페스트에 정의한 내용이 태그에 정확히 포함되어 있는지 확인하십시오. – corvairjo
문제는 실제로 잘못된 NDEF 메시지가 전송 된 것과 같습니다. –