Selecting audio files using Intent.createChooser does not work with all phones

I am nearing the end of a project that I am working on using Android, but ran into a small hit on the road when we got a new device to test our application.

I am programming using Android 1.6, and my two devices are:

HTC Incredible - Verizon (Android 2.2)
Samsung Galaxy S - T-Mobile (Android 2.1 update)

One part of the application allows the user to select a recorded audio file using:

// Select a recording
i = new Intent();           
i.setAction(Intent.ACTION_GET_CONTENT);
i.setType("audio/*");
startActivityForResult(Intent.createChooser(i, "Select audio file"), Enums.REQUEST_CODE_SELECT_ATTACHMENT);

And onActivityResult is called after the selection.

if (resultCode == RESULT_OK && Enums.REQUEST_CODE_SELECT_ATTACHMENT == requestCode)) 
{
    // do something here
}
else
{
    //ResultCode comes back as RESULT_CANCELED
}

This works fine on the device on which I programmed my original application (HTC Incredible - Verizon).

Samsung Galaxy S (T-Mobile) (Music Player | Voice Recorder), .

Music Player, ( HTC, , ).

Voice Recorder, onActivityResult RESULT_CANCELED - " ".

- ? !

!

+3
1

Galaxy S, , 2.1. , Skype . , 2.2 .

, , AudioManager.setMode() MODE_IN_CALL . , - , , (., , Ringdroid).

, Galaxy S (, ).

!

+2

Source: https://habr.com/ru/post/1785473/


All Articles