eeadev
eeadev

Reputation: 3852

WebView and Nexus Chrome browser works differently than my Chrome browser on PC

when I try and load this URL http://www.shazam.com/music/web/track?id=45759675 My activity load this other http://www.shazam.com instead

This is my android code:

public class SingleMenuItemActivity extends Activity {

    public void onCreate(Bundle savedInstanceState) {

        WebView mWebView;

        super.onCreate(savedInstanceState);
    setContentView(R.layout.single_list_item);
    final ProgressDialog pd = ProgressDialog.show(this, "", getResources()
            .getString(R.string.loading), true);
    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setBuiltInZoomControls(true);
    mWebView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            if (pd.isShowing() && pd != null) {
                pd.dismiss();
            }
        }
    });
    mWebView.getSettings().setLoadWithOverviewMode(true);
    mWebView.getSettings().setUseWideViewPort(true);
    String weblink = getIntent().getStringExtra("link");

    mWebView.loadUrl(" http://www.shazam.com/music/web/track?id=45759675 ");
}

  }

the same behavior happens with my browser on my smartphone but no when i connect to this URL from my PC. All the browsers are G Chrome. questions:

  1. Why does it happen
  2. how to avoid it and connect to the proper URL

Upvotes: 0

Views: 180

Answers (1)

Tchoupi
Tchoupi

Reputation: 14691

It looks like Shazam.com doesn't allow mobile browers to browse the Music section. Unless you change the user-agent, there is not much you can do. They obviously have their own reason to disallow mobile browsing. If you wish to include shazam content in your application you should contact them first.

Upvotes: 2

Related Questions