Comments (8)
How large are the files you are trying to upload?
from android-upload-service.
The one that I am testing with right now is 368MB.
from android-upload-service.
Something helpful that I have found and am testing right now is using the setFixedLengthStreamingMode on the httpUrlConnection.
http://developer.android.com/reference/java/net/HttpURLConnection.html
More info...
To upload data to a web server, configure the connection for output using setDoOutput(true).
For best performance, you should call either setFixedLengthStreamingMode(int) when the body length is known in advance, or setChunkedStreamingMode(int) when it is not. Otherwise HttpURLConnection will be forced to buffer the complete request body in memory before it is transmitted, wasting (and possibly exhausting) heap and increasing latency.
from android-upload-service.
Great feedback! So, please try the following temporary patch. If it works I'm going to integrate it in the trunk.
Open UploadService.java and paste the following statement:
conn.setFixedLengthStreamingMode(getTotalBytes(filesToUpload));
right after:
setRequestParameters(requestStream, requestParameters, boundaryBytes);
after that clean and build the library, test it again and tell me if it works for you.
from android-upload-service.
Works :) No more out of memory errors. Thanks for the quick turnaround. Again, great library.
from android-upload-service.
I've read the docs more carefully, and I think the best would be to use
conn.setChunkedStreamingMode(0);
This way there's not the 2GB upload size limit and the best buffer length will be automatically set.
from android-upload-service.
Can confirm that setChunkedStreamingMode(0) also worked well.
from android-upload-service.
Thank you @derekentringer for reporting the issue and for testing the solution, that I just committed: f51a585
Update your working copy and you're good to go ;)
from android-upload-service.
Related Issues (20)
- Initial notification ignores custom notificationHandlerFactory HOT 7
- Stop Observing from RequestObserver using unregister causing a crash. HOT 3
- Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. HOT 6
- Google Play will soon require that apps target API level 33 or higher. This will be required for new apps and updates starting on August 31, 2023. HOT 4
- Single notification about all ongoing uploads HOT 3
- Please add support for Android 34 HOT 4
- Java Code Samples? HOT 1
- How to get uploaded file infomation that returned by service api
- Question: Is it possible to send a HTTP request once an upload task finishes? HOT 5
- Question on crash message when closing the app: Unable to create service net.gotev.uploadservice.UploadService HOT 16
- Missing default constructor for SchemeHandler classes HOT 3
- Incompatible version of Kotlin error after upgrading to 4.9.2 HOT 3
- register gotev receiver HOT 2
- Result of uploading file HOT 1
- Bitrise CI Build Failing with New Version HOT 1
- Re-implementation using WorkManager HOT 2
- Android Upload Service for KMM (Koltin Multiplateform) HOT 2
- Add contentType to addParameter HOT 3
- SDK 34 Play Store Rejected without video of FOREGROUND_SERVICE_DATA_SYNC functionality HOT 4
- duplicate uploadID HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-upload-service.