ContriHUB / Just-Share

Android app that enables quick transfer of photos, videos, documents, and audio files using WiFiDirect and Bluetooth.
MIT License
0 stars 5 forks source link

Implement File Manager Integration for File Sharing via Implicit Intents with Bluetooth and Wi-Fi Direct Support #6

Open SaiDheerajPeketi opened 5 days ago

SaiDheerajPeketi commented 5 days ago

🚀Feature Request

Description

The requested feature is to integrate File Manager functionality into the app, enabling users to share files directly from their device’s file manager using an implicit intent. The app will declare support for file transfers in the manifest and handle incoming intents for file sharing using both Bluetooth and Wi-Fi Direct modes. This feature will enhance the app’s usability by allowing users to initiate file transfers seamlessly from other apps.

Expected behavior

Current behavior

The app does not currently support sharing files directly from the file manager, and there is no intent handling for external file transfers initiated by other apps.

Steps to reproduce

  1. Open the default File Manager on the device.
  2. Select any file(s) to share.
  3. In the share menu, the app should appear as an option.
  4. Select the app and proceed to transfer the file via Bluetooth or Wi-Fi Direct, based on user choice.

Possible Solution

  1. Declare File Sharing Support in the Manifest:

    • Add the necessary <intent-filter> in the Android manifest to declare the app as a file receiver for file transfer intents. This will enable the app to receive shared files using implicit intents.
      <intent-filter>
      <action android:name="android.intent.action.SEND" />
      <category android:name="android.intent.category.DEFAULT" />
      <data android:mimeType="*/*" />
      </intent-filter>
  2. Handle Incoming Intents:

    • In the main activity (or another relevant activity), handle incoming file intents using Intent.ACTION_SEND or Intent.ACTION_SEND_MULTIPLE. Extract the file URI(s) from the intent and process them accordingly.
      if (Intent.ACTION_SEND == intent.action && intent.type != null) {
      val fileUri: Uri? = intent.getParcelableExtra(Intent.EXTRA_STREAM)
      fileUri?.let {
      // Handle the file URI and proceed with transfer
      }
      }
  3. Prompt for Transfer Mode:

    • After receiving the intent, prompt the user to select the transfer mode (Bluetooth or Wi-Fi Direct).
    • Based on the user’s selection, initiate the respective file transfer method.
      • For Bluetooth, start the Bluetooth transfer activity.
      • For Wi-Fi Direct, initiate the connection and begin file transfer over Wi-Fi Direct.
  4. Handle File Transfer Logic:

    • Ensure that the file is transferred appropriately depending on the selected mode (Bluetooth or Wi-Fi Direct).
    • Provide feedback on the transfer status, including success or failure.

Why is this feature important to you?

This feature is essential because it streamlines the process of sharing files between devices, allowing users to initiate file transfers directly from the file manager or other apps. It enhances user experience by eliminating the need to open the app separately to share files, making the file transfer process more seamless and efficient.

Additional context (Bonus)

This integration will make the app more versatile by embedding it into the Android ecosystem’s sharing infrastructure, giving users a faster and more intuitive file-sharing experience.