'This functions is called when the application receives a
new intent, for the ones the application has registered previously,
either in the manifest or in the foreground dispatch setup in the
nfc_init function above.'

def on_new_intent(self, intent):

    action_list = (NfcAdapter.ACTION_NDEF_DISCOVERED,)
    if (intent.getAction() not in action_list):
        print 'unknow    action,    avoid.'
        return
    rawmsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)
    if (not rawmsgs):
        return
    for message in rawmsgs:
        message = cast(NdefMessage, message)
        payload = message.getRecords()[0].getPayload()
        print 'payload:    {}'.format(''.join(map(chr, payload)))
