[android-developers] Re: Market:// links in WebView

2010-09-06 Thread Lance Nanek
WebView should be asking the system to open any links by default
anyway. A normal URL should open the Browser app, a market URL should
open the Market app, provided you are testing on a phone with the
Market app installed.

Are you sure the phone you are testing on has the Market app
installed? If so, are you sure you aren't calling setWebViewClient
with something that overrides shouldOverrideUrlLoading to have some
alternative behavior, like to load all URLs in the WebView?

If you are doing the later, it is pretty trivial to check if the URL
passed to that method starts with the market protocol, and just
startActivity for an ACTION_VIEW intent for that URL instead of
loading it in the WebView.

On Aug 28, 6:01 am, jgclifton jgclif...@gmail.com wrote:
 Hi guys.I've created a web view app, the page that is displayed
 featuresmarket:// links but upon clicking them I get the 404 screen
 along with the error that the protocol is not supported. I've tried
 looking through documentation but was unable to find anything relating
 to this. Any help is much appreciated.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Market:// links in WebView

2010-08-28 Thread Maps.Huge.Info (Maps API Guru)
What you'll need to do is create a link from your webview into your
app by using a JavaScript command. Inside your app you create an
intent that opens the market app:

JavaScript:

// Launch Market App... (appid is package name)

function launchMarket( appId ) {
  webViewClass.launchMarket( appId ) ;
}

Java:

public void launchMarket(String appId) {
 Intent intent = new Intent(Intent.ACTION_VIEW);
 intent.setData(Uri.parse(market://details?id= + appId));
  startActivity(intent);
  finish() ;
 }

You'll also need the requisite code to allow all this to happen, I
assume you know how to do that already. If not, Mark Murphy has an
excellent book that details all this out.

-John Coryat

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Market:// links in WebView

2010-08-28 Thread jgclifton
Thanks for the response! The other problem I have with this is I'm
showing ads with admob but within the webview rather than using the
android native code (theres a good reason for this) but would this
sort of code be scaleable to work with admob too? I'm not very
familiar with JavaScript.

On Aug 28, 2:45 pm, Maps.Huge.Info (Maps API Guru)
cor...@gmail.com wrote:
 What you'll need to do is create a link from your webview into your
 app by using a JavaScript command. Inside your app you create an
 intent that opens the market app:

 JavaScript:

 // Launch Market App... (appid is package name)

 function launchMarket( appId ) {
   webViewClass.launchMarket( appId ) ;

 }

 Java:

 public void launchMarket(String appId) {
  Intent intent = new Intent(Intent.ACTION_VIEW);
  intent.setData(Uri.parse(market://details?id= + appId));
   startActivity(intent);
   finish() ;
  }

 You'll also need the requisite code to allow all this to happen, I
 assume you know how to do that already. If not, Mark Murphy has an
 excellent book that details all this out.

 -John Coryat

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Market:// links in WebView

2010-08-28 Thread Maps.Huge.Info (Maps API Guru)
It would depend on the code admob uses. If the point of your question
is because of admob, then you may be able to figure out their call to
start the market and wrap that in a function that starts the intent
within your app. There may be other ways as well. The example I used
was how I do it.

-John Coryat

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en