Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

venu g.'s avatar
venu g.
Explorer | Level 3
9 years ago

Dropbox login fails in android webview

I am using dropbox-android-sdk-1.6.2.jar but after successful oauth login, webview is showing "Webpage not available" error page. I have observed this behaviour on android OS 4.0.3, 4.3, 5.0.1, 6.0. Please refer this for screenshot of webview.

 

Thanks

7 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    The error is reporting that the db-<app_key> URL was not available. This is the redirect URI that the SDK uses to receive the user after they go through the app authorization flow. 

     

    Did you set up your db-<app_key> URL in your AndroidManifest.xml as instructed for the Android Core SDK?

     

    In any case, I should note that the SDK you're using is for API v1 anyway, which is deprecated. You should migrate to API v2 whenever possible. For Android, you should use the API v2 Java SDK. There's an Android sample app for that to refer to.

  • venu g.'s avatar
    venu g.
    Explorer | Level 3
    9 years ago

    I will migrate to API V2 later but the app is already in production and facing this error. I have already specified db-<api_key> [api_key is my apps API key] in AndroidManifest.xml. It was working before but suddenly stopped working. Do you want me to share the exact value of api_key.

  • venu g.'s avatar
    venu g.
    Explorer | Level 3
    9 years ago

    Forgot to tell you, my app has been developed for android based device which doesn't have a browser. We have created an activity with webview to be invoked by dropbox API instead of browser and it was working fine. 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    Thanks for following up. Yes, please share the relevant portions of your AndroidManifest.xml as well as the code snippet(s) that reproduce this so we can look into it. (Your app key isn't considered secret, so it's safe to share, but you can open a ticket privately if you'd prefer: https://www.dropbox.com/developers/contact )
  • venug's avatar
    venug
    Explorer | Level 3
    9 years ago

    Thanks Greg.

     

    I want to proceed with this ticket. Below are the declarations of AuthActivity from Dropbox and my own LoadUrlActivity to render Dropbox URLs inplace of Browser. Also, you can find WebView initialization.

     

    <activity
    android:name="com.dropbox.client2.android.AuthActivity"
    android:screenOrientation="sensorPortait"
    android:configChanges="orientation|keyboard"
    android:launchMode="singleTask" >
    <intent-filter>
    <!-- Change this to be db- followed by your app key -->
    <data android:scheme="db-exi3o02y0ss2wn5" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    </activity>

    <activity
    android:name=".activities.LoadUrlActivity"
    android:screenOrientation="sensorPortait"
    android:exported="true"
    android:label="@string/app_name" >
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
    android:host="www.dropbox.com"
    android:scheme="https" >
    </data>
    </intent-filter>
    </activity>

    webview = (WebView) findViewById(R.id.webview);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    webview.loadUrl(getIntent().getData().toString());

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    Thanks! I just tried this and I was able to reproduce the problem. (For me, it specifically gave the error ERR_UNKNOWN_URL_SCHEME.) It works properly for me in the system browser.

    Note that the Java SDK doesn't officially support this WebView technique though (it normally either uses the official Dropbox app or the system browser). That being the case, I'm afraid I can't offer much help on this specific issue, as it's specific to your WebView setup. I highly recommend just using the normal provided flow.

    If you want to further debug this though, there are some similar looking posts with potential solutions:

    https://stackoverflow.com/questions/24697429/getting-neterr-unknown-url-scheme-while-calling-telephone-number-from-html-pag
    https://stackoverflow.com/questions/37773131/android-webview-tel-link-err-unknown-url-scheme
    https://stackoverflow.com/questions/4338305/android-webview-tel-links-show-web-page-not-found
  • venu g.'s avatar
    venu g.
    Explorer | Level 3
    9 years ago

    Hi Greg.

     

    App is working fine on my device after fresh installation but it is not working on normal android devices. I don't know where is the problem. 

     

    Thanks for your time.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!