0

Using below: (Mentioned here):

ActivityResultLauncher<String> imageActivityResultLauncher = registerForActivityResult(
            new ActivityResultContracts.GetContent(),
            uri -> 
               //do something with uri (that needs an IPAddress specific for each request)
            });

and:

imageActivityResultLauncher.launch("image/*");

trying to select and upload a file. How can I pass the IP address that I want the file to be uploaded to and is specific for each request?

Thanks in advance...

AKTanara
  • 230
  • 1
  • 11
  • You do not pass that to `ActivityResultLauncher` you need to do it by yourself .. just look for how to upload a file in android .. – ADM Sep 18 '22 at 04:53
  • Thanks, I have already done so, but in none of them there was any way to "Select File" and then "Upload it". There is always either a fixed uri of the file or fixed upload address... I need user to select a device from list and then select a file to upload to that device. – AKTanara Sep 18 '22 at 05:10
  • What does 'select a device from a list' mean? There's no intent that does device discovery for you. – ianhanniballake Sep 18 '22 at 05:44
  • @ianhanniballake There is a recyclerView of devices, when user selects one of them, a file explorer opens for user to select a file and I should send the selected file to the address of the selected device... – AKTanara Sep 18 '22 at 05:54
  • Your question does not make sense. GetContent() lets the user select a file. Your app then gets an uri (in onactivityresult). What your app does with the uri is up to the app. GetContent() will not upload for you. – blackapps Sep 19 '22 at 06:13

0 Answers0