So this should be stupidly easy, and I followed the tutorial, but when I press the button, nothing happens. no errors no nothing (simulator AND S3)
I have this code :
local function button\_directions\_release() system.openURL("comgooglemaps://?saddr=" .. urlencode(current\_address) .. "?daddr=" .. urlencode(storyboard.detail\_data[3]) .. "?directionsmode=transit") return true end
and this from the tutorial :
function urlencode(str) if (str) then str = string.gsub (str, "\n", "\r\n") str = string.gsub (str, "([^%w])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") end return str end
I tried replacing my variables with manually written address’ but still nothing happens. I tried copying in the example URL from the tutorial and have system.openURL call that directly but again, nothing happens.
So I am assuming that this method is only for iphones? I cannot find a tutorial on how this is achieved on an android device.
Anyone feel like helping me out here?
button code :
local tempx = display.contentWidth - storyboard.side\_padding - 30 local tempy = display.contentCenterY + 140 local button\_directions = buildbutton("button60x24.png", "button60x24.png", "Directions", storyboard.secondaryfontcolor, native.systemFont, 10, button\_directions\_release, group, tempx, tempy)
Custom function used above
local function buildbutton(mainimg, overimg, text, color, textfont, fontsize, releasefunction, dispgroup, xpos, ypos) local temp = widget.newButton { defaultFile = mainimg, overFile = overimg, label = text, labelColor = { default = color, }, font = textfont, fontSize = fontsize, emboss = false, onRelease = releasefunction, } dispgroup:insert( temp ) temp.x = xpos temp.y = ypos return temp end