Reply To: What does registerActivity do?

Forum MIFARE general topics and applications What does registerActivity do? Reply To: What does registerActivity do?

Re: What does registerActivity do?

15. December 2016 at 14:57
I am sorry but seems that we aren't on the same page, let me quote myself here:

But if instead I put it on the onResume() of every NFC activity, before calling startForeGroundDispatch() it works flawlessly.

Here I am refering to registerActivity().

My calls to the method startForeGroundDispatch() are in the right place, as well as those for stopForeGroundDispatch(). Conversely, I am quite sure that it has something to do with the SDK since changing where I put the registerACtivity() determines whether it works or not. So to be clear:

If I put registerActivity() after super.onResume() and before startForeGroundDispatch() then the code works.

There's probably also a design flaw in Taplinx's SDK since taking into account what you said about registerActivity():

Well, registerActivity() in TapLinx SDK means, that the activity should be able to receive NFC intents from the operating system

Then one should invoke this method for every activity that needs to utilize NFC to be able to receive intents, since only invoking it once will cause that only the first registered activity receives intents. And since you said we should only call it once:

This means, you can have more activities in your Android application, but the (TapLinx)registerActivity() must be called only once, for instance in your main activity.

and the method belongs to a single instance (singleton of NxpNfcLib), then a global object (NxpNfcLib) is storing a local reference (the activity), for this reason I can surely tell you: that is a design flaw since it doesn't make any sense.

Finally I am so sure that there's a problem (or at least it isn't well explained how to use the SDK) that I modified the demo application of the SDK found here ( ), added a new activity and as you'll experience it will crash with the same error.

Here is the link:

+ 0  |  - 0