«

android设备信息获取

时间:2024-3-2 17:37     作者:韩俊     分类: Android


android设备信息获取

权限:<uses-permission android:name="android.permission.READ_PHONE_STATE" />

import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

public class MainActivity extends Activity {


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showBuild();

}
// 根据打印出来的行数就可以找到你要的获取参数的方法 这些是一般用到的
private void showBuild() {
System.out.println("ssssss1s" + android.os.Build.BOARD);
System.out.println("ssssss2s" + android.os.Build.BOOTLOADER);
System.out.println("ssssss3s" + android.os.Build.BRAND);
System.out.println("ssssss4s" + android.os.Build.CPU_ABI);
System.out.println("ssssss5s" + android.os.Build.CPU_ABI2);
System.out.println("ssssss6s" + android.os.Build.DEVICE);
System.out.println("ssssss7s" + android.os.Build.DISPLAY);// 软件版本
System.out.println("ssssss8s" + android.os.Build.FINGERPRINT);
System.out.println("ssssss9s" + android.os.Build.HARDWARE);
System.out.println("ssssss10s" + android.os.Build.HOST);
System.out.println("ssssss11s" + android.os.Build.ID);
System.out.println("ssssss12s" + android.os.Build.MANUFACTURER);
System.out.println("ssssss13s" + android.os.Build.MODEL);// 型号
System.out.println("ssssss14s" + android.os.Build.PRODUCT);// 设备名称
System.out.println("ssssss15s" + android.os.Build.VERSION.RELEASE);
System.out.println("ssssss16s" + android.os.Build.SERIAL);
System.out.println("ssssss17s" + android.os.Build.TAGS);
System.out.println("ssssss18s" + android.os.Build.TIME);
System.out.println("ssssss19s" + android.os.Build.TYPE);
System.out.println("ssssss20s" + android.os.Build.UNKNOWN);
System.out.println("ssssss21s" + android.os.Build.USER);
TelephonyManager TelephonyMgr = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
String szImei = TelephonyMgr.getDeviceId();
System.out.println("sssssss22s" + szImei);// IMEI
}

}


标签: android

热门推荐