Making a free version of your app: Linking to the AppStore

I'm currently creating a free version of an exising app (already for sale on the AppStore).

The free version will include a link to the full version on the AppStore

What is the best way to link to the AppStore from a Corona app? If I use a standard http: request to the AppStore URL, does that necessitate the extra step of opening Safari on the device, and then opening the AppStore? Is there a better way to go directly to the AppStore, bypassing the intermediate step of opening Safari?

FYI -- I found the answer to this question on StackOverflow. It looks like the solution is to use the protocol "itms" rather than "http".

"A tip is to use itms:// instead of http://, then it'll open in the app store directly. On the iPhone, it will make 2 (!) redirects when using http, and 1 when using itms."

http://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store

Just to continue this thread, on Android, you use:

system.openURL("market://details?id=com.name.games.yourgamename");

You could additionally try to access the respective market directly to avoid one page switch. In my apps I'm using (use at your own risk :)):

1
2
3
4
5
function self:showReviewPage()
    local countryCode = system.getPreference('locale', 'country') -- e.g. 'us'
    local appUrl = 'itms://itunes.apple.com/' .. countryCode .. '/app/' .. misc.toName(app.title) .. '/id' .. app.id
    system.openURL(appUrl)
end

I'm still a little confused by all this. I have a button that I would like to open the app store on an iphone to a specific app. I am using the code below, but I can't tell on the simulator if it will work or not. ( It goes to grey, spins, and then comes back to the running app usually. ) Can someone explain to me how I can check if it will work?

Thank you!

function button5:tap( event )
media.stopSound()
native.showWebPopup( "http://itunes.com/apps/ask-some-zombies")
end

Rjd, do you have an iPhone or iPad for testing? I think it's an important part of the testing? (Not just for the things which will run differently in the simulator, e.g. in-app payments, keyboard usage, opening app store links...)

I have an iphone, and I have registered it with the developer center, but haven't yet figured out how to get an app on it without uploading it to apple, getting it approved, and then paying to get it! Do you know where i can find simple instructions on this process?

Thanks.

OK, I figured out how to get it to my iphone for testing. Now I know that code doesnt work. SO, can any one tell me what code to use?

Thanks.

RJD

I just submitted the lite version of my app. Here's the exact code I used...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
local buyit = display.newImage ("linkButton.png")
buyit.x = 130
buyit.y = 410
buyit.xScale = 1.3
buyit.yScale = 1.3
localGroup:insert(buyit)
 
local function buymee(event)
 
system.openURL( "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=445521008&mt=8" )
 
end
 
buyit:addEventListener("touch", buymee)

Forgot, you might also want to change the location and the scale :)

Thanks! I already had the button part working, but it was the link that just wasn't working. But now it does when I changed it to the system.openURL and the URL you suggested with my app ID in it. That was a big help. In the end, my function looks like this...

function button4:tap( event )
media.stopSound()
system.openURL( "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=440781323&mt=8" )
end

views:1880 update:2011/9/28 9:01:40
corona forums © 2003-2011