cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Learn all about apps and Dropbox integrations to make working from home easy here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dropbox login fails in android webview

Dropbox login fails in android webview

venu g.
Explorer | Level 3

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 7

Re: Dropbox login fails in android webview

Greg-DB
Dropboxer

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.

Re: Dropbox login fails in android webview

venu g.
Explorer | Level 3

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.

Re: Dropbox login fails in android webview

venu g.
Explorer | Level 3

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. 

Re: Dropbox login fails in android webview

Greg-DB
Dropboxer
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 )

Re: Dropbox login fails in android webview

venug
Explorer | Level 3

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());

 

Re: Dropbox login fails in android webview

Greg-DB
Dropboxer
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-telepho...
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

Re: Dropbox login fails in android webview

venu g.
Explorer | Level 3

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.

Poll
How do you get refocussed while working from home? Do you find any of these options keep you from getting distracted?
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?