0

Hi,

I am currently writing a class that sends device diagnotic information to a server.

My Android device will be installed somewhere else and it should send its status to the server.

I did
1. current battery level
2. if the battery is charging

Whatelse can I diagnose? Is there a way to diagnose its physical parts such as screen too?

3
Contributors
4
Replies
23
Views
4 Years
Discussion Span
Last Post by 9tontruck
0

Thanks Peter.

Would you tell me about display metrics little bit please? how can I diagnose the device using screen density value?

0

Well,the DisplayMetrics under Andorid.util package is a class which provides a display general information i.e display size, resolution and font.

Initialization of the displa metrics follows:
DisplayMetrics metrics = new DisplayMetrics ();
getWindowManager (). getDefaultDisplay (). getMetrics;

The existing Activity handle after.... one more thing constructor DisplayMetrics do not need to pass any parameters; call getWindowManager(), the getDefaultDisplay() method in order to obtain the width and height dimensions, at this time, it is stored in the the DisplayMetrics object and the width and height dimension is in pixels.

toString() method by DisplayMetrics can to the most of DisplayMetrics the fields, as at the resolution of 480x320 output: Its density is the logical resolution, width and height of the screen resolution, consistent with the the fields widthPixels heightPixels, scaleDensity density consistent, xdpi ydpi the accurate physical pixel.

Now to compare Android DIP, dp, px, sp:

DIP: Device Independent pixels,different devices have different display, and the device hardware. In order to support WVGA, HVGA and QVGA recommended to use DIP which means you can't rely on pixels.

px: pixels, there are different devices display the same general HVGA on behalf of 320x480 pixels.

Pt: Point it's a standard unit of length i.e 1pt = 1/72inch.

SP: Scaled pixels is used for font which is best for the textsize and is recommended by the google, TextView font size is best to use sp units. The main problem is that this treatment is in dots-per-inch (dpi) means the need of higher new monitor to run the program and it also results in small user interface,small interface means difficulty to see the content.

Well, I guess I have talked enough about the DisplayMetrics rest I'll leave over to the Mods to complete it out.

Edited by peter_budo: Code formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.