media.selectPhoto problem on Android

I have an app that the user select photo. The users report me that on android this function dont work.

I download de project sample in link https://www.dropbox.com/s/alw4e7wsww1s35x/PhotoVideo.zip and build for android. In attach print that show error. I build with version 2016.2866

In other android device dont do anything. Dont show de media Galery Screen and dont show any error message.

Hello,

To being helping diagnose this, we will need specific details about which Android devices are working, and which are not. This includes:

  1. Android device model (i.e. Samsung Galaxy S6).

  2. Android OS version

Thanks,

Brent

You need to add that permission to  your build.settings for devices Android 5 and earlier. For android 6 you have to request the permission.

You can look at the various sample apps in SampleCode/Media to see how to implement on demand permissions.

Rob

I test the App in Galaxy Tab 10 with Android 4.0.4 and in a Galaxy Tab 7 with Android 4.1.1.

In build.settings i request this premissions:

android = { usesPermissions = { "android.permission.CAMERA", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, },

What happens if you try and build the SampleCode/Media/PhotoPicker sample app?

Rob

I run the sample app SampleCode/Media/PhotoPicker in same Android Galaxy Tab 10. When i tap on screen the app show message “No Image Selected”. The app dont show any screen to select image.

Is the same with PhtoVideo and my app.

Any idea? It’s a bug?

Can you provide all the information about your test device?

Model

Android Version

Carrier

Our sample app was thoroughly tested when we released 2830. If you’re having issues with the sample app then either we’ve introduced a bug since, or its device related.

Thanks

Rob

Model: Sansung Galaxy X

Android Version: 4.0.4

Carrier: Sansung

I built the sample with version 2016.2871. I have tested this sample code in other android devices and the problem is same.

I looked at your sample app and  you do not have:

android.permission.READ_EXTERNAL_STORAGE

in the permission list. You have WRITE_EXTERNAL_STORAGE, but not READ_EXTERNAL_STORAGE

Still, It ran on my test device just fine, albeit you’re drawing the photo centered at 0, 0 rather than in the center of the screen. I also tested our sample app both on Android 4 and 6 and it worked as expected. If you try to pick a photo that’s not a JPEG (.jpg, .jpeg) or PNG (.png) it won’t select anything. It has to be a valid file type.

Rob

Hi Rob, i have change permission to make test, but dont work too.

When i click in button, the app dont show window to select image. But the listener associated with media.selectPhoto is fired and return event wit values:

table: 0x42bb08 {
  [name] => “completion”
   [completed] => false
 }

Has one alternative to solve this problem?

Are you getting any messages in your console log from the device? If you need to know how to see those, please read:

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

I build the same sample and run on LG phone with Android 4 and the app works perfect.

The problem is on Sansung devices. I read that Sansung modified android OS in theirs devices.

In older versions of Corona selectPhoto work in same Sansung device. I think that it’s a bug?

Go ahead and file a bug report using the link at the top of the page. You will need a small app that demos the problem. It must have a main.lua, config.lua and build.settings. Put it in a .zip file. When submitting the bug you will upload the .zip file. When filling out the form, make sure you provide the exact specs on the device that it’s failing. Also paste the link for this thread in as a reference.

You will get an email confirming the submission. It will have a CaseID in the subject. Please post that back here as a reference.

Rob

Case 45808.

I am also having a similar issue on some Android devices but not others. media.selectPhoto works the first time. But then it throws an error in logcat:

E/MediaPlayer-JNI(11391): QCMediaPlayer mediaplayer NOT present

After that media.selectPhoto stops working and subsequent calls don’t work.

I have this issue in 2015.2729 as well as the recent 2016.2906 build.

Not sure if it’s the same issue. Just in case I also submitted a bug report: case 46665.

thanks,

Ben

Hello,

To being helping diagnose this, we will need specific details about which Android devices are working, and which are not. This includes:

  1. Android device model (i.e. Samsung Galaxy S6).

  2. Android OS version

Thanks,

Brent

You need to add that permission to  your build.settings for devices Android 5 and earlier. For android 6 you have to request the permission.

You can look at the various sample apps in SampleCode/Media to see how to implement on demand permissions.

Rob

I test the App in Galaxy Tab 10 with Android 4.0.4 and in a Galaxy Tab 7 with Android 4.1.1.

In build.settings i request this premissions:

android = { usesPermissions = { "android.permission.CAMERA", "android.permission.WRITE\_EXTERNAL\_STORAGE", }, },

What happens if you try and build the SampleCode/Media/PhotoPicker sample app?

Rob