network download mp3 fail in android

(GUYS I AM TRYING TO IMPLEMENT THIS CODE TO THE ANDROID TO LET IT DOWNLOAD AND PLAY IT WITH AUDIO BUT IT FAILS, AND IT WORKS IN IOS CAN U GUYS HELP ME OUT PLS…)

local function networkListener( event )

    if ( event.isError ) then

        print( “Network error - download failed” )

    elseif ( event.phase == “began” ) then

        print( “Progress Phase: began” )

    elseif ( event.phase == “ended” ) then

        print( “Displaying response image file” )

      

local sound = audio.loadSound(“uptownfunk.mp3”,system.DocumentsDirectory)

local soundchannel = audio.play(sound)

    end

end

local params = {}

params.progress = true

network.download(

   " http://mp3for.me/assets/songs/393000-393999/393160-uptown-funk-feat-bruno-mars-mark-ronson–1422369580.mp3",

    “GET”,

    networkListener,

    params,

   “uptownfunk.mp3”,

    system.DocumentsDirectory

)

(GUYS THE CODE FOR THE URL IS THIS: http://mp3for.me/assets/songs/393000-393999/393160-uptown-funk-feat-bruno-mars-mark-ronson--1422369580.mp3)

Are you seeing any errors in your console log?   For more information on debugging your code, see: http://docs.coronalabs.com/guide/basics/debugging/index.html

You may want to print out additional information in your network.download listener.  Right now you only print that you had a download error, but you don’t print out the reason.  Without that information, your’e guessing in the dark.

I put the URL above into my browser and it didn’t download the image, it took me to the page to download the song.  Android’s networking code doesn’t handle redirects all that well, but i this case, there isn’t a downloadable file and whatever I got redirected too.

Rob

rob the url is a mp3 song url is not a image file 

Sorry I meant sound file instead of image.  Still, I put the URL in my browser and ended up on a web page, not a link downloading the page. 

It’s possible they are doing some type of detection for people trying to download the file without going through a web page to get to it.

Rob

Are you seeing any errors in your console log?   For more information on debugging your code, see: http://docs.coronalabs.com/guide/basics/debugging/index.html

You may want to print out additional information in your network.download listener.  Right now you only print that you had a download error, but you don’t print out the reason.  Without that information, your’e guessing in the dark.

I put the URL above into my browser and it didn’t download the image, it took me to the page to download the song.  Android’s networking code doesn’t handle redirects all that well, but i this case, there isn’t a downloadable file and whatever I got redirected too.

Rob

rob the url is a mp3 song url is not a image file 

Sorry I meant sound file instead of image.  Still, I put the URL in my browser and ended up on a web page, not a link downloading the page. 

It’s possible they are doing some type of detection for people trying to download the file without going through a web page to get to it.

Rob