Forum › MIFARE general topics and applications › What does registerActivity do? › Reply To: What does registerActivity do?
I am sorry but seems that we aren't on the same page, let me quote myself here:
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():
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:
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 (https://www.mifare.net/wp-content/uploads/2016/08/SrcsampleNxpNfcLib-1.0.zip ), added a new activity and as you'll experience it will crash with the same error.
Here is the link: https://expirebox.com/download/4467168ea746a1f78f07a91742e3c15c.html
Regards
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 (https://www.mifare.net/wp-content/uploads/2016/08/SrcsampleNxpNfcLib-1.0.zip ), added a new activity and as you'll experience it will crash with the same error.
Here is the link: https://expirebox.com/download/4467168ea746a1f78f07a91742e3c15c.html
Regards
+ 0
|
- 0