Foursquare authentication dialog join now link customization for Amazon App Store

206 views Asked by At

Hi I have an android app that authenticates and uses the foursquare v2 api. The problem I'm having is the following.

When I hit load the following url to initiate authentication:

https://foursquare.com/oauth2/authenticate?response_type=code&client_id=XXXXXXXXX&redirect_uri=myapp://xxxxxx

the join button links to the android market to download the foursquare android app.

This is perfectly well and fine except Amazon App Strore approval process forbids linking to other markets in apps published in their App Store.

Is there a way to control this and have it link to a web mobile signup page? Or maybe I can try grabbing the html and replacing the target link. This sounds really complex and am not sure how to do it if possible. Any thoughts would be greatly appreciated.

1

There are 1 answers

0
Aaron Dancygier On

I hate to answer my own question but I figured it out. First off you should know I am using a class that inherits from WebViewClient. I override shouldOverrideUrlLoading check for a match on the url i want to override, replace it with the new url and finally call view.loadUrl(url).

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            if (url.startsWith(FoursquareApp.CALLBACK_URL)) {
                String urls[] = url.split("=");

                mListener.onComplete(urls[1]);

                FoursquareDialog.this.dismiss();

                return true;                    
            } 
            else if (url.equals("https://market.android.com/details?id=com.joelapenna.foursquared")) {
                url = "http://www.amazon.com/gp/product/B004U7AKJK?ie=UTF8&ref=mas_dl";
                Log.v(TAG, "in onShouldOverrideUrlLoading replacing url with: " + url);
                view.loadUrl(url);
            }

            return false;
        }