When I upload an image from a mobile device you have two options:
reduce the size on the device and upload the result
upload the full image and reduce the size on the server
Which one is better?
For the user experience, it is better to do all the work you can server-side, minimising the processing time and the transfer time.
I would recommend doing all the work on image on the server if you want the application to be fast, and if the transformation make the image heavier.
Now you may have problem in the future if you have mutliple upload in the same time with a low performance server. If it is the case, choose to do the work on device to devide the work on each device.
I think The "1" is best,because This way of consuming less flow;this option is very important for android app
I always use the 1st approach. You never know how fast your user's internet is, so I prefer doing it locally and save time on the upload.
That is specially true in 3d world countries where 3G speeds are generally very slow and unreliable.
Related
With respect to mobile development, I'd like to know whether the rate at which something is downloaded from the internet can be affected by the app making the http request. I assume that download speed is most affected by hardware. If code can affect download speed, what are some performance tips to download something as fast as possible most of the time?
In all communications, you are limited by your bandwidth. Mobile platforms tend to be much slower than wired connection. So the solution is simple, make the download amount as small as possible.
This is, of course, easier said than done. It tends to take some creativity to get a network bound application unbound. However when you are able to, you can see very impressive/unbelievable gains in performance.
I'm your case, it is good to think about it up front, but also consider it as the app is developed.
Ps: some general rules of thumb
Network accesses: on the order of 10 millisecond
Disk access: on the order of 10 microseconds
Memory access: on the order of 10 nanoseconds
Cpu cache: on the order of 100 picosec
This is a little bit more than you asked for, but you can clearly see why it would be faster to compress data, send it and uncmpress it then to just send it.
As Robert said, it's more likely than not the network that's limiting you, rather than the code itself. It IS possible to intentionally throttle download speed in multiple languages, but I doubt the code is the cause.
Think instead about how you might cut down your application's size. Think hard about reusing assets, pulling some data from a webserver if possible, etc etc.
My app needs to store mpg4 files on a server and be able to quickly grab them and stream them via the MediaPlayer. I have been using AWS S3 to store them after recording from my app but when I go ahead and grab them to stream them through the MediaPlayer it is sometimes fast but often slow. I was just hoping for a little guidance on the best approach to this. The videos need to be streamed back rather fast but S3 seems to be a bit slow and can be costly. What are the alternatives or best solutions?
S3's key selling point is high availability storage, rather than speed of access, especially if you need to access the content in many different geographic locations.
For reliable low latency distribution of video (i.e. minimum stops for buffering) you want a Content Distribution Network solution (CDN). In very simple terms, this creates cached copies of your content at the edge of the network so it can be accessed quickly.
Amazon's CDN solution is Cloudfront and it is designed to integrate with content stored on S3. The link below gives a good walkthrough of setting up Cloudfront for some S3 content. Note it does have a cost so you will need to check it meets your budget (other CDN's are available - they are all similar in concept):
http://www.shootingbusiness.com/amazon-video-streaming-slow/
If you needs are small and localised, and you can test and confirm that performance is ok, you may be ok to simply host the Video on EC2/ECB, with a backup on S3 in case of issues. Again, you probably would need to run the different scenarios through the Amazon price calculator to decide the best approach for your needs.
I have never seen performance issues with this EC2/ECB approach for a small user base, certainly for users in the same general geographic area as the AWS availability zone, but it does not necessarily scale well, especially with a more distributed user base.
I have an Android application with which user can share posts with images on the server.
Images are taken by the camera - therefore I change the size to a smaller one and compress it.
I also need the image to be in 2 formats - regular and thumbnail.
I guess better to create 2 versions on the device and U/L both?
I also do it in BG, so user will not be blocked for long time...
Is it a good behaviour?
Should I block the user for 10-20-30 seconds (depending on the network speed?)
What is the common use?
Recommnedations?
No ... it would be a better experience if you just upload the large image, and have the server take care of thumbnail generation. That way, you can minimize the user's data usage, and also the time it takes to upload an image.
Also, definitely don't block the user ... do the upload in the background, and let the user continue using the app.
Sending your images using the multipart content type.
If you have an additional step where the user start typing additional information (like a title, description etc.) you can start uploading your image so that the user won't notice the delay (do it asynchronously). That's what Instagram does.
Speaking of the size of your BitmapI think you should consider sending only one normal version of it and let the thumbnailing be done by the server. However you have to compress it (JPEG/PNG) and you can also scale it down by a factor of 2 otherwise you might experience memory errors.
On a side note (not really related to your question) be careful of how much memory is left for your app to use when displaying a large amount of Bitmap. Before Honeycomb, Bitmapwere allocated on the native heap but accounted on the VM Heap (if I'm not wrong) so don't count simply on how much memory is left on the VM heap. This talk is worth a watch if you haven't yet.
The title says most of it. I believe packaging the basic data set into the app will result in a better user experience, rather than have people download files before they can start using the app. This is where one can start losing users. At the same time, 20MB is considered kind of a lot for Android,so I wonder if this will cause issues for some users in using the app.
I am not sure if this will cause an issue. I am an android developer who uses android phone and facebook app in my fone is almost 21MB. It does not cause any issue...However, as a developer a better approach would be to do an app that does not exceed 10MB space(Unless your app is outstanding like Facebook). You can do this by using images of smaller size,making sure you do not have any resources that you are not using(classes,layouts etc)
The size never causes issue but you may consider more:
I am a android developer and a long time Android user too. Not All Android phones have high-end processors to run app faster.
A lot of Android Phones have phone memory of 100-250MB. And the old versions of Android doesn't allow user to install app on SD card. So the user may hesitate to install your App.
Unless it is necessary try to reduce the App size.
As per my personal experience, If you are designing something astonishing and it costs even few hundred MBs on my phone, so i really wouldn't mind to give a try. Since new phones, processors and high storage capacities are continuously evolving and appearing in consumers' hands, so how can we expect applications to remain the same (tiny) in size? Let them grow (but not without any valid reason), and people would still try/buy it. There are no fixed rules or guidelines for limiting the app size, but a directly proportional relationship explains it well:
High-end graphics and feature-rich application ∝ Extra size/memory
What I think is :
The size of the app never creates issue. Again if its an extraordinary app. then surely user will surely get attracted and download your app..
But on the other side just think about the Internal Memory of the phone. There are lots of phone available that has very low internal memory(many have 150 or 180MB as internal memory). May be because of too low internal memory, they wont be able to use your application and hence you may not get big traffic.
You've got a lot of answers here so I'm just going to give you my perspective.
I would be frustrated to say the least if I downloaded a 10MB app and then opened it to find I needed to download another 10MB of necessary materials. Just make the app 20MB so I know what I'm getting into when I start the download.
Only put the bear essentials into the app if it's going to be that big. Don't require users to download high res images, language packs, etc. Just publish the bare minimum that your app requires to run if it's going to be larger than 10MB. You could even publish two versions of your app, the bare minimum at 7MB or the HOLY SH*T package at 20MB, at least users would have a choice when they went to download your app.
Spend some time looking up common practices when it comes to saving space when making an app, every little bit counts and if you can make the same app and save 5MB, your users will appreciate it. If it comes down to a lot of images, consider using this tool; http://www.getpaint.net. However I would suggest reducing the JPEG quality) rather than compress them. JPEGs aren't very squishy.
Going along with #3. Think about universally accepted methods of communication; a sideways triangle for a play button, and X for a delete button, be sneaky...save space. User's love that crap :]
I'm developing a small social networking app that makes use of something like profile pictures. Images are stored on a server and I have scripts set up that will send the image for each user to the app, which then displays it in an image view for each user, and then saves the image to external storage. The way I have it implemented now is that anytime the app needs the image after it downloads it from the server, the app will get the image from external storage unless a user has uploaded a new image (I thought this would be faster than redownloading it from the server every time). However, it seems to be taking longer to get the file from external storage than it does to get it from my server (and the server is pretty slow, running on wifi from 3 floors away...budget constrains :) ).
My question is what is the fastest way to get these images if the user hasn't uploaded a new one. Should I just downlaod it from the server everytime (I'm assuming not) or is there a better place in the filesystem to store the images that makes for faster retrieval?
Loading images from the SD card should be very fast. Some strategies:
Do it only once - Load the images into memory asynchronously when your activity or application starts. You don't want to be hitting the SD card every time your view updates.
Make them small - If you're having performance problems displaying thumbnails in a list, try saving your thumbnails as smaller images using inSampleSize to put less pressure on the decoder.
Use internal memory - I think that internal memory is faster, but it tends to be in short supply. You could certainly store some number of thumbnails in your cache directory to help speed up step 1.
Responsiveness over performance - The golden rule is to remember that absolute performance does not always correlate with responsiveness. Even if the images take a long time to load, choosing cleverly when to load the images can have a great impact on the user's perception of speed.