Intents are Android's means of inter-process communication. Consequently, being notified about actions external to your applications typically involves notifications through intents. A user scanning an NFC tag is an action that happens outside of your application, so you want your application to be somehow notified about that event. In general, the NFC service does this by sending an intent, and your application registers to receive that intent.
On Android < 4.4, intents were the only way of receiving a notification on NFC tag events. While your app is running, you can either receive them through onNewIntent
(intent filters in manifest, foreground dispatch) or through onActivityResult
(foreground dispatch).
Starting with Android 4.4, there is a new reader-mode API. THis API permits you to register for a specific callback onTagDiscovered
to be triggered upon tag detection.
So yes, you can be notified about tag discovery through other callback methods than onNewIntent
. But no, the onCreate
method will be the first method invoked when your activity is created. onStart
and onResume
immediately follow that method. So there is no way to scan that tag in between starting your activity manually and invokation of these methods.
However, if you activity has been started by an NFC intent, you can get that intent with the activity's getIntent
method. This also works in any of the methods onCreate
, onStart
and onResume
.