Search code examples
pythonnfcopen-nfc

Is it possible to open the messenger on the phone using NFC


Is it possible to open a messenger (telegram) on android using the pynfc library? Open url or write sms it turns out!

clf = nfc.ContactlessFrontend('usb')

def on_connect(llc):
    threading.Thread(target=llc.run).start() 
    return False
    
llc = clf.connect(llcp={'on-connect': on_connect})

snep = nfc.snep.SnepClient(llc)
snep.put_records([ndef.UriRecord("http://nfcpy.org")])
snep.put_records([ndef.UriRecord("sms:5555555555?body=Hello World!")])

Solution

  • You could send an Android Application Record (AAR) to open a specific App (see https://developer.android.com/guide/topics/connectivity/nfc/nfc#aar ) and some details of the actual NDEF message at https://stackoverflow.com/a/25573943/2373819

    But as you seem to be using SNEP, then after Android 9 an Android phone won't respond to this as the SNEP (Android Beam) functionality has been removed.