/**
* use for getting application Icon.
*
* @param mContext
* @return Icon as drawable from the application
*/
public static Drawable getAppIcon(Context mContext) {
Drawable icon = null;
final PackageManager pm = mContext.getPackageManager();
String packageName = mContext.getPackageName();
try {
icon = pm.getApplicationIcon(packageName);
return icon;
} catch (NameNotFoundException e1) {
e1.printStackTrace();
}
return null;
}
2.设备ID
/**
* Use for getting your device id if available.
*
* @param context
* @return your device id
*/
public static String getDeviceId(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
return telephonyManager.getDeviceId();
}