Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Ghost Mjrm
3 years agoExplorer | Level 4
my android app not uploading photo directly to Dropbox app folder using API
i have created android app and i add the API and the SDK to it to contact with my Dropbox app folder to automatically uploading photo but its tell me that the photo uploaded successfully but when i ...
- 3 years ago
More details about that error would be useful. It's not clear what doesn't work for you actually. The refresh token will just 'extend' your authentication 'life' (if could be said so), nothing more.
Ghost Mjrm
3 years agoExplorer | Level 4
thank you so much to noticing me one more once but every time should i update my access token to make the app working again ? is there any solution for that i want to give this app to employer to use it and give me photo every time 24 hours per day
one more question i have edit my access token but the problem is still when i take photo it tell me error uploading to dropbox:null
i have checked my app Dropbox folder and i cannot find anything
Best Regards
Greg-DB
Dropbox Community Moderator
3 years agoGhost Mjrm Здравко is correct; for long-term access, you can request "offline" access, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. Refresh tokens do not expire automatically and can be used repeatedly. You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.
The official Dropbox Java SDK can actually handle the process for you automatically, as long as you supply the necessary credentials, e.g., as shown retrieved in the examples here. For instance, for a client-side app, such as a desktop app, you should use the PKCE flow, e.g., as shown here. That allows you to make and save a DbxCredential with a refresh token as shown here. With that, you can make API calls like shown here.
- Ghost Mjrm3 years agoExplorer | Level 4
one more thing i got error upload to Dropbox:null and i didn't find the solution yet so i considered that if i make the refresh token doesn't expire it could fix my problem
- Здравко3 years agoLegendary | Level 20
More details about that error would be useful. It's not clear what doesn't work for you actually. The refresh token will just 'extend' your authentication 'life' (if could be said so), nothing more.
- Greg-DB3 years ago
Dropbox Community Moderator
Ghost Mjrm As Здравко said, it's unclear what the issue is from the information you've provided. If you're having trouble with the Dropbox API, please troubleshoot the issue in your environment and if you need help, share the relevant specific details.
For example, I see you are calling uploadAndFinish to upload a file. I suggest adding some more logging and/or stepping through with a debugger to inspect what is happening. For example, check if uploadAndFinish is returning a value, and if so, what it is, or if it's raising an exception, and if so, what it is.
- Ghost Mjrm3 years agoExplorer | Level 4
using logcat i got this system error
W/System.err: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1513)
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:117)
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:105)
at java.net.InetAddress.getAllByName(InetAddress.java:1154)
at com.android.okhttp.Dns$1.lookup(Dns.java:39)
at com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress(RouteSelector.java:196)
at com.android.okhttp.internal.http.RouteSelector.nextProxy(RouteSelector.java:144)
at com.android.okhttp.internal.http.RouteSelector.next(RouteSelector.java:89)
at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:190)
at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:142)
at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:104)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:392)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:325)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:488)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:131)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:262)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:26)
at com.dropbox.core.http.StandardHttpRequestor.getOutputStream(StandardHttpRequestor.java:132)
at com.dropbox.core.http.StandardHttpRequestor.access$000(StandardHttpRequestor.java:29)
at com.dropbox.core.http.StandardHttpRequestor$Uploader.<init>(StandardHttpRequestor.java:141)
at com.dropbox.core.http.StandardHttpRequestor.startPostInStreamingMode(StandardHttpRequestor.java:81)
at com.dropbox.core.http.StandardHttpRequestor.startPostInStreamingMode(StandardHttpRequestor.java:29)
at com.dropbox.core.v2.DbxRawClientV2.uploadStyle(DbxRawClientV2.java:286)
at com.dropbox.core.v2.files.DbxUserFilesRequests.upload(DbxUserFilesRequests.java:3795)
at com.dropbox.core.v2.files.UploadBuilder.start(UploadBuilder.java:154)
at com.dropbox.core.v2.files.UploadBuilder.start(UploadBuilder.java:20)
at com.dropbox.core.v2.DbxUploadStyleBuilder.uploadAndFinish(DbxUploadStyleBuilder.java:92)
at com.example.decamera.MainActivity.uploadToDropbox(MainActivity.java:277)
at com.example.decamera.MainActivity.access$300(MainActivity.java:57)
at com.example.decamera.MainActivity$2.onImageSaved(MainActivity.java:173)
at androidx.camera.core.imagecapture.TakePictureRequest.lambda$onResult$1$androidx-camera-core-imagecapture-TakePictureRequest(TakePictureRequest.java:192)
at androidx.camera.core.imagecapture.TakePictureRequest$$ExternalSyntheticLambda0.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7078)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
About 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!