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?
4 Answers
-
Accepted Answer
Try
Ti.Platform.openURL('market://search?q=pname:com.package.name');
-
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.
-
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!
-
you can also make a "more apps" button with
market://search?q=developername