Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

media.selectPhoto problem on Android
Started by YouHome Apr 19 2016 10:50 AM

15 replies to this topic
media selectphoto
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

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.

 

 

Attached Files



[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

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



[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

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



[TOPIC: post.html]
#4

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

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",
        },
    },


[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

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

 

Rob



[TOPIC: post.html]
#6

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

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.



[TOPIC: post.html]
#7

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

Any idea? It's a bug?



[TOPIC: post.html]
#8

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

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



[TOPIC: post.html]
#9

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

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.



[TOPIC: post.html]
#10

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

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



[TOPIC: post.html]
#11

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

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?



[TOPIC: post.html]
#12

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

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



[TOPIC: post.html]
#13

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

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?



[TOPIC: post.html]
#14

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,201 posts
  • Enterprise

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



[TOPIC: post.html]
#15

YouHome

[GLOBAL: userInfoPane.html]
YouHome
  • Observer

  • 18 posts
  • Corona SDK

Case 45808.



[TOPIC: post.html]
#16

apps638

[GLOBAL: userInfoPane.html]
apps638
  • Enthusiast

  • 35 posts
  • Corona SDK

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




[topic_controls]
[/topic_controls]