1

related Is there a way to share a link via Nearby Share & receive the link via a custom app on the second device using Nearby Connections API?

as @Xlythe's answer, using com.google.android.gms.nearby.sharing.EXTRA_REQUIRED_PACKAGE can launch a package from receiver by Nearby

Question is how can i send a file with intent extra to Nearby directly. guess i can use ACTION_SEND intent with Chooser dialog and make user select the Nearby button. But is there a way to send to Nearby bypassing the chooser dialog?

And one more, suppose that a file sent to a receiver device with EXTRA_REQUIRED_PACKAGE value. receiver would get notification from Nearby to accept it and system would launch the package from extra value? and is the package able to handle a file that was sent from Nearby?

jji9380
  • 42
  • 5

1 Answers1

2

Use the Intent action "com.google.android.gms.SHARE_NEARBY" and the package "com.google.android.gms" to directly launch Nearby Share.

Yes, the system launches the package with the action "android.intent.action.VIEW" and the intent extras from the received data.

Xlythe
  • 1,958
  • 1
  • 8
  • 12
  • thanks a lot! and can you check my next question? :) https://stackoverflow.com/questions/71890294/android-nearby-connection-send-payload-partially-wifi-aware-and-bluetooth – jji9380 Apr 16 '22 at 01:12