NFC, TAG_DISCOVORED intent is only send via startActivity()

by z_z_z_z » Sat, 12 Feb 2011 06:07:02 GMT

Sponsored Links

I have a device that is constantly sending NFC tags each of it has
only one characte "a" as rawdata , this is not the interesting part.
The problem is that I'm writing a Service that have a
BroadcastReceiver that is listening for the tag_discovered intent. The
idea is when the onReceive() method is called in the BR it will call
some methods in the service. So I've take a looked at the source of and there the intent is fired with startActivity(). So
I cant use broadcast receiver. Is there any special reason to be made
like that, with startActivity() but not with sendBroadcast()? So in my
case I'm forced to use activity to catch the intent thet in it's
onCreate() it calls my broadcaste receiver via sendBroadcast() and
then at the end of the onCreate() it calls finish(). This solution is
very ugly one, because if I have some other application's Activity
running ontop it's onPause() method is colled.... terrible...

So am I missing something about the nfc apps in android and what are
your suggestions about my problem?