NEXUS S에 Android 2.3.4를 설치 한 후 NFC 앱이 더 이상 시작되지 않습니다.

StackOverflow https://stackoverflow.com/questions/6049635

  •  15-11-2019
  •  | 
  •  

문제

Android 2.3.4 내 Nexus S에 설치 한 후 NFC 앱은 더 이상 시작되지 않습니다.

Google 문서에서 설명한 세 가지 의도 (NDEF_DICCOURED, TECH_DICCOURED, TACH_DICCOROVERED, TACH_DICCOROVERED)를 시도했지만 NEXUX는 기본 Google 애플리케이션을 열고 내 앱을 무시하는 데 문제를 해결합니다.

나는 이것을 나타냈다

<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
</intent-filter>
.

그리고 내가 틀리지 않으면 뉴스 2.3.3에서 지원되는 것 같습니다. 넥서스가 왜 무시합니까?

당신이 도와 주실 수 있습니까?

최고의 안부, 휴고.

도움이 되었습니까?

해결책

You need to add this to your intent filters:

<intent-filter>
   <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
</intent-filter>

When a tag is scanned, Android should show a popup asking which app to handle it.

Update

Based on additional info from your comment, the problem is that your tag contains information which is recognized by Android. In this case, that is a URL. Since Android can find an app (the default NFC app) which can handle urls, then that app will take priority and be called instead of an app which simple handles tag discovery. Tag discovery is only dispatched if no other intent filter matched the tag. To quote the docs:

android.nfc.action.TAG_DISCOVERED: This intent starts if no Activities handle the NDEF_DISCOVERED and TECH_DISCOVERED intents or if the tag that is scanned is unknown.

So you must declare your tag to handle messages in the tags as well. You need to specify exactly the type of data you are targeting as well (in this case, urls), else the Google Android app will still take precedence for URLs. You can read more information on the Android NFC page

다른 팁

You have to also add data in the intent filter. Please refer to http://developer.android.com/guide/topics/nfc/nfc.html#tech-disc

and look under ACTION_NDEF_DISCOVERED in Filtering for NFC intents.

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