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?

14. December 2016 at 15:21
Hi Francisco,

Please have a look into one of the code snippets which comes with the application note. Please use the snippet below to implement the required methods. You will never need the method isApplicationRegistered(). The library instance should be used like the snippet below:

public class MainActivity extends AppCompatActivity
{
// The package key you will get from the registration server
private static String m_strPackageKey = "00112233445566778899aabbccddeeff";

// The TapLinX library instance
private NxpNfcLib m_libInstance = null;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// more code...

initializeLibrary();
}

@Override
protected void onResume()
{
m_libInstance.startForeGroundDispatch();
super.onResume();
}

@Override
protected void onPause()
{
m_libInstance.stopForeGroundDispatch();
super.onPause();
}

private void initializeLibrary()
{
m_libInstance = NxpNfcLib.getInstance();
m_libInstance.registerActivity(this, m_strPackageKey);
}

// ...
}

If you app still crashes, please send me a Logcat log file.

Regards,
The TapLinx Team
+ 0  |  - 0