How to get minimum freespace required by Android? - android

In android, whenever we copy/write large file(s) on to internal storage we get a notification:
Device storage is full
Although there is some amount of space left but still android shows the notification. I want to know how can i get programmatically get that amount for any android(min jellybean api 16). I need to know free space on a device excluding that amount of space. Devices like samsung stores that value somewhere else and i need a solution that works on all (because i have samsung and my app needs to work on other devices as well) devices.

Related

Will all android devices display the same length app name?

I wonder if all Android devices display the same length app name. I made an app and can see it's full 27 characters name on my Galaxy S4. How will the same name look on older phones/versions of Android? Will they display less characters of the app name than my S4? If so, how many will they display and is there an amount of characters all phones will display?
I don't think the name of the app length has changed with different releases of Android. But different sized devices might struggle more depending on how you're displaying your text. There are a couple threads on this subject.
Here's one: how much long can be a android application name
EDIT: You could test with an emulator on a very old device.

Updating an old pre-tablet Android app to a tablet version

So here's the scenario: we have an old app on the Play Store that was published before there were any tablets (it runs on tablets using the phone interface.) We want to release an update to that app (because it has >150K users) instead of a new app but because the design for the phone UI won't be ready in time for our deadline we want to release an update that targets only tablets for now while the existing users continue to use the old phone-only app. Later, when the design and implementation of the phone UI is complete, we want to release another update that adds support for phones.
Ideally what should happen is if a user is using the old app on a phone, they will not get the first upgrade notification but a user running it on a tablet will get the update notification (and a new user installing it for the first time will get the the old apk if, for example, they're running a Gingerbread phone while a user using, say, a Nexus 7 will get the new apk.) Eventually, all users will get the update notification to the second release no matter what Android version/device type they are running.
If we do this, what will the experience be for the current users that are using the old version on phones? Will they be prompted to upgrade to an app version they cannot run or will they get no update notification at all? Later, when we release the second upgrade that does support phones will they then get the update notification?
To make your app look great on tablets, just add specialized layout types, just like
layout-large or layout-sw600dp. Then copy your existing layout-xml files from your layout folder to these and modify them as required.
I suggest reading Supporting Different Screen Sizes.
This way, you add tablet-optimization without throwing away phone compatibility.
I'm not quite sure what you mean by having an update only available to a certain device. Tablets and phones work quite differently and the Google Play market is capable of differentiating what will run on the user's current device and what won't.
Like the previous answer you WILL be required to construct different layouts specifically for tablets.
However if you only want an update to tablets to take place on tablets - You need to get as much information about the screen size, density, device version and maybe even the current users android OS version to really help you narrow down whether the current device is a tablet or large screen device or not.
For example:
Get screen dimensions in pixels
shows you how to get screen dimensions.
How can I check the system version of Android? Gives you more information about the current android version.
getting the screen density programmatically in android?
will allow you to find out the screen density of the current screen.
Using all of the above, or some similar combination, you can determine if the user is running your app on the tablet, if they are, provide them with an update, if not, the app continues with its regular layouts as normal.
I'm not quite sure if this is the answer you were looking for, but I hope it helps.
Take care

How to make sure that your application will be compatible with range of devices?

In Google play (app market), if an application is not compatible to your device (for some reason, say small screen size, etc). Then it is not even shown in the list.
Now, as an app developer I never want to unintentionally add a limitation in my app that forbids it from a range of devices.
So, while developing how can I make sure that the application will be able to run on atleast the type of devices that I intend.
Also, right now I'm developing an app & testing it in on my phone with version 2.3.5. And every now & then Google changes some method names & flags.
For newer android releases, I CAN test it on emulator, but testing it on phone/tabs/etc. is a different thing.
Please suggest.
how can I make sure that the application will be able to run on atleast the type of devices that I intend.
In manifest file you can mention, which type of device you want to run your app. And for testing you can create emulators for different devices to test your app. Try to make app UI such that it runs on all devices.
Google changes some method names & flags
Whenever Android changes any thing it will always be upward compatible means if you have made app for 2.2 it will run on 2.2 and above (screen size or resolution is other thing)
Regarding UI see my answer here
Layout for 720*1280 devices
By default apps will be available to as wide a range of users as possible.
There are certain limitations you can define in your manifest file, such as not being available on small screen sizes, but they are at your discretion.
The only limitation Google imposes on you is that any user who has a lower Android version than your minimum SDK version cannot see your app. To get around this, you can either design the app for lower SDK versions (I believe building for 2.2 and up gives you access to about 95% of the user base) or maintain multiple versions of the APK.
Read this. It will really help. Next Eclipse will help you a lot, firstly you can define what you wish to support (screen sizes and hardware requirements or even if they're not necessary but may be used) in the manifest. You can run a version check and implement APIs dependent on which version of Android you're running on. That's personally what I do, I check the API level and if it's greater than or equal to the API I wish to run I run it, otherwise I attempt to find compatible code (often using the compatibility library) or alternatively drop support for that feature, for example JellyBean notifications there's not really any work around for expanded notifications but I can use the NotifcationCompat builder.

How to test android application?

Developed a application of size 40MB. I need to test it for all screen support but the android emulator really a bad choice(I feel... ). It gives Insufficient memory error almost every time). How developer test their application?
One more Question
I have designed app for four different layout(normal,small,large and xlarge). Will every device(In future) satisfy these layout params?
And i faced a real problem that i tested my app in Sony xperia minpro(Small screen 240*320 2.4inch) and in Samsung galaxy 5(smallscreen 240*320, 2.8inch) but the layout is overlapping in samsung device. This can be a serious problem , actually we cant check our app in every device.. that is impossible too.
TIA
40MB is way too big for an Android application. Many users will have problems installing the app on their devices. You should consider moving some resources out of the application and downloading them either on demand or on first app run.
The list of layout types (normal, small, large, xlarge) is definitely not final, for there quite possibly will be even larger screens (xxlarge) or tiny ones (xsmall?).
Developed a application of size 40MB. I need to test it for all screen
support but the android emulator really a bad choice(I feel... ). It
gives Insufficient memory error almost every time). How developer test
their application?
You can configure the emulator with any amount of memory you wish, including an emulated SD card so memory shouldn't be a problem. However, 40MB is quite big so you may be hitting the package size limit.
One more Question I have designed app for four different
layout(normal,small,large and xlarge). Will every device(In future)
satisfy these layout params?
You're asking us to predict the future - there's no way we can know what Google are planning if they haven't already announced it though I would suggest that there will never be a commitment to keep screen sizes or resolutions static - technology constantly evolves and specs that are OK for today, will not be OK for tomorrow.
I have seen dictionaries weighing in at 40Mb, best practise is to download the database as a separate file. Some graphically intensive games approach that size. If you want to emulate many Android devices make sure your PC is up to snuff and you have the latest SDK.
How developer test their application?
You do not have so many choices: you have to use as many (and different) physical devices as you can, from different vendors and technical specifications (screen, etc), to try to detect as many specific bugs as possible.
This is difficult, as you are often limiten to a few physical devices.
To give you examples, I recently struggled with the Camera, for a bug happening with Motorola Defy only. I am currently struggling with the Camera, but only for Samsung Galaxy this time.
When you find a specific bug, try to fix it "the general way": instead of detecting the vendor/version of the device to write specific code for it, try to enhance your code in a way it will work for all tested phones. So far, I never had to write anything specific to a given device. The bugs I encountered were always tied to a permissivities or particular cases that could be handled by making the common code more complete or resiliant. Let's say by "making as less assumptions as possible" knowing that we tend to make assumptions without meaning it.
On top of testing on as many physical devices as possible, create emulators. You can parameter them to have different screen layouts, different embedded hardware, memory, etc. And on top of the default emulator that comes with the Android distribution, you also have emulators provided by the devices vendors and that reproduce the specificity of these devices. For example, Samsung released a Galaxy Tab emulator. Sony Ericsson released a EDK Cellphone emulator. You can get them thru the regular android distribution update workflow.
Will every device(In future) satisfy these layout params (normal,small,large and xlarge)?
Yes, as Android distributions are backward compatible. Any of these layout will still be supported in the future, but may become 'deprecated' (so not recommended, but still working), and new layout types will certainly be created.

we have Android Application Size more than max Size?

What should we do if the size of our Android application is more than max size? Currently the acceptable size for Android applications (i.e. <App>.apk) on the Android market is 50 MB.
If our <Application>.apk size is more than 50 MB then what's the alternative to follow on?
Try removing the resources from the project and changing the app so that the resources will be downloaded upon first app opening to the SD card...
It will take some time to develop the changes, but I don't think you really have a choice...
Note that Samsung devices have an even smaller size limit...
The first reason for .apk size growth is resources. The more specialized application gets on each configuration (screen sizes, orientations, densitites etc) the more .apk size grows. Usually .apk still has size much less then 50 mb limits, but even with 20mb users may perceive your application as heavy.
Android Market added support for multiple .apk per application. This feature was designed to specifically address the issue of .apk size growth due to many different configuration. You can read more about it in Multiple APK Support in Android Market post from official Android blog. Though this is considered as last resort.
If you .apk size is large due to other reasons, then you're most likely doing something wrong. If its some embedded video/audio file (or even files!), consider moving them to web and download when user needs them for the first time. This will save internal memory space which is might be critical to users (especially on older devices).
I can't image why an application would be more than 50 mb from just the source code alone. If alot of the size is in design elements(images, etc) or data(database files), you could always have the user download this info when the application is first run.
if you are using Android 2.3.3 version then minimum size of the application must be minimum 9MB and maximum size is depend upon the device,the capacity of memory of the device. but if you take it 50 MB then no problem, its disadvantage is only that the AVD takes time to start.i don't know the Android Market place current application size.

Categories

Resources