Android: How to get all the displays of a device - android

Is it possible to enumerate all the displays supported by an Android device? The APIs currently support getting the default display, but don't appear to support getting any other displays.

I did not find any official API for multiple device displays, even if it looks like it will support it in the future.

No, it is not, I think you're confused about what getDefaultDisplay does, it gets the display of the current device, not the global Android default, which does not exist! For information about screen sizes/densities look at the documentation.

Related

Check whether battery level is displayed on Android

I have a question whether it is possible to check if the battery level is currently displayed on screen on Android device. Is there a property in SDK that allows to get this information?
Not a standard one, no. It's up to the OEM how they want to display it, which means they don't have to use the AOSP version.
Anything near-AOSP is probably using status_bar_show_battery_percent in Settings$System.
Samsung uses display_battery_percentage in Settings$System.
LG seems to use power_save_battery_indicator in Settings$System.
You can use Settings.System.getInt() to retrieve the value.

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.

Two screens/monitors with Android?

I want to develop an Android application which uses two screens to display information. For example: One screens shows the app, the other screen some information about the current app status.
My question: Does android support two monitors/screens? How would you build up such a device and project?
From API level 17, android supports this
Here is the link
https://developer.android.com/reference/android/app/Presentation
It is now possible for an APP to independently draw different content on primary and secondary displays. Secondary displays can be an HDMI screen or a wireless display.
Some devices do. For example the HTC Evo has a micro-HDMI output that you can send to a TV but the functionality is not built into the Android core so you would need to use the proprietary extensions.
You can only do it using widgets.
There is no other way. I have researched on this and there happens to be lot of problems. One company has successfully done it but they could not port two opengl instances.
Look at Kyocera Echo and Dual-screen SDK for Gingerbread!

How to take a screenshot on android 4.0+

I heard that Android 4.0+ support user to capture screenshot without root. So, I think that It must provide some APIs that help developers build this feature to their app, Right? If it have, Could you please tell me what they are?
There is no API for an app to take a screenshot. The screenshot is placed into a standard folder, but some devices use different folders, and there is no API to get the correct folder name.
Users can take screenshots by pressing volume-down and power on most phones. On Some devices it is done by power+home, on some by hand swipe. There is no API to tell how to take a screenshot on the current device.

Possible to limit Android app by device, not by OS version?

If I want a certain application to be available for certain devices only or for tablets only, is there any way to make limitations by device (like I can limit the min/max Android OS version)?
I say it is impossible. Do you agree?
I understand that you are trying to limit the devices that can see the application in the Market but, like you, I do not think that is possible. You can, however, limit it within the app using details from and Build class. Build.PRODUCT looks like it would fit your needs - if the phone that has the app installed in not in a pre-set list of "products", tell the user that they have the wrong version and exit.
A similar idea for tablets is to check the screen size - if they are under a certain threshold, then display that same message.
It is possible, starting in june this year. Please take a look at this Google I/O session:
http://youtu.be/GxU8N21wfrM

Categories

Resources