Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Open android market from within an app

I want to open up android market from within my app. To open android market you enter "market://search?q=pname:com.package.name" as the URL in the browser.

Sadly, the webView cant handle that adress and gives an error "Web page not available".
Is there any workaround for this?

— asked November 5th 2010 by André Bosäter Kindwall
  • android
  • market
  • mobile
  • webview
0 Comments

4 Answers

  • Accepted Answer

    Try Ti.Platform.openURL('market://search?q=pname:com.package.name');

    — answered November 5th 2010 by Don Thorp
    permalink
    0 Comments
  • I know this is an old thread, but we are using

    Ti.Platform.openURL('market://details?id='+Ti.App.id);
    

    to go directly to our app's listing using the Market app (not the web browser). The "search" method will search by name and is capable of showing multiple apps in a listing, but the "details" method goes straight to a single app.

    — answered October 6th 2011 by Shawn Lipscomb
    permalink
    1 Comment
    • That did it, thanks

      — commented May 5th 2012 by Dario Marcelino
  • We had a requirement to launch the market from html in an Android webview and had problems with the link not working (works in a separate browser in app but not in webview).

    Problem was the webview was restricted and you can fix it natively be overriding something http://samstewartapps.com/blog/2010/10/12/open-the-android-market-from-an-app/

    Our workaround was to have a listener on beforeload and then do the right thing there e.g.,

        webview.addEventListener('beforeload', function(e){
            var url = e.url;
    
            //market links dont work in a webview without native override , see http://samstewartapps.com/blog/2010/10/12/open-the-android-market-from-an-app/
            //sooo we intercept it here  
            if (url.indexOf('market')!=-1){
                Ti.API.info('detected market link, launching');
                webview.stopLoading();
                webview.goBack();
                Titanium.Platform.openURL(url);
            }
        });
    

    Hope this helps someone!

    — answered August 23rd 2012 by nigel taylor
    permalink
    0 Comments
  • you can also make a "more apps" button with

    market://search?q=developername

    — answered May 12th 2013 by harry t
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.