Java tutorial
//package com.java2s; //License from project: Apache License import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import android.util.Log; public class Main { private static final String TAG = "CalligraphyBackupUtil"; private final static String SIMCARD_PATH = "/sys/devices/platform/simcard/info"; public static String getSimID() { // TODO Auto-generated method stub Log.v(TAG, "getSimID() called"); String simID = ""; try { FileInputStream is = new FileInputStream(SIMCARD_PATH); DataInputStream dis = new DataInputStream(is); simID = dis.readLine(); simID = simID.trim(); is.close(); dis.close(); return simID; } catch (FileNotFoundException e) { // TODO Auto-generated catch block Log.v(TAG, "getSimID exception: do not have a SIM Card!", e); return "123456"; } catch (IOException e) { // TODO Auto-generated catch block Log.v(TAG, "getSimID exception: read IOException", e); return ""; } } }