How to start the app and connect to BLE after reading Android NFC

Asked 2 years ago, Updated 2 years ago, 150 views

I'm a beginner on Android.I have a question about using NFC to connect to BLE and launch the app.

When I read NFC tags in NDEF format on Android, I understand that the following 1,2 can be done respectively.

Therefore, I have two questions.

  • Did anyone check the BLE (not classic Bluetooth) pairing on the actual machine under the above conditions?
  • Is it possible to "Start Application → BLE Connection" or "BLE Connection → App Launch" with one NFC read?

If you have any information, please let me know.

android bluetooth

2022-09-30 21:23

1 Answers

I don't know if it's the answer I expected, but

In NDEF records, if AAR is included, your app is not foregrounded, or if you have not given startup priority in NfcAdapter#enableForegroundDispatches,
By default, the application (or Google Play Store) for the package specified in AAR will be launched.If this is the app you created, I think there is basically no problem.

Now, to take into account the main idea of "How to Connect ~BLE After NFC Reads",

■ "Application launch → BLE connection"
If the NDEF message when launched above contains mac-address-specific information to connect the specified terminal to the BLE, you can connect using BluetoothAdapter and so on.

■ BLE Connection → App Launch
Unlike iOS, Android is flexible for background processing, so I think it is possible to implement automatic connection of designated devices as Service and startActivity once the connection is confirmed.

I hope it will be helpful.


2022-09-30 21:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.