Reputation: 1
I want to share data using Nearby Share so I can avoid putting an app on device 1. Then I want to accept that data on a custom app on device 2 so I can transform it and do something else with it.
Is this possible?
Upvotes: 0
Views: 498
Reputation: 2033
If your app is initiating the share, use the intent extra com.google.android.gms.nearby.sharing.EXTRA_REQUIRED_PACKAGE
to pass an Android package name. This will prioritize launching your app on the receiving phone and will redirect to the Play Store if your app is not installed.
If your app is receiving the share, use a custom file extension and register your app as the default handler for that file type.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.insert_custom_file_extension_here" />
</intent-filter>
Upvotes: 1