Android examples for Hardware:Device Feature
Get device's build info.
//package com.java2s; import android.os.Build; import android.text.TextUtils; import java.util.HashMap; public class Main { /**//w w w . j av a2 s. c om * Get device's build info. * * @return A map that contains the device's build info. */ public static HashMap<String, String> getBuildInfo() { HashMap<String, String> map = new HashMap<String, String>(); try { map.put("device_model", TextUtils.isEmpty(Build.MODEL) ? "" : Build.MODEL); map.put("os", "Android"); map.put("os_version", TextUtils.isEmpty(Build.VERSION.RELEASE) ? "" : Build.VERSION.RELEASE); map.put("device_board", TextUtils.isEmpty(Build.BOARD) ? "" : Build.BOARD); map.put("device_brand", TextUtils.isEmpty(Build.BRAND) ? "" : Build.BRAND); String manutime = String.valueOf(Build.TIME); map.put("device_manutime", TextUtils.isEmpty(manutime) ? "" : manutime); map.put("device_manufacturer", TextUtils .isEmpty(Build.MANUFACTURER) ? "" : Build.MANUFACTURER); map.put("device_manuid", TextUtils.isEmpty(Build.ID) ? "" : Build.ID); map.put("device_name", TextUtils.isEmpty(Build.DEVICE) ? "" : Build.DEVICE); } catch (Exception e) { e.printStackTrace(); } return map; } }