您的位置:首页 > 其它

获取手机CCID号

2016-01-27 17:30 435 查看
gradle-wrapper.properties是这样的
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

而build.gradle是这样的
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
String imei = tm.getDeviceId(); //取出IMEI
String tel = tm.getLine1Number(); //取出MSISDN,很可能为空
String imei =tm.getSimSerialNumber(); //取出ICCID
String imsi =tm.getSubscriberId(); //取出IMSI

new Handler().postDelayed(new Runnable() {

@Override
public void run() {
PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat("alpha", 1f, 0f);
ObjectAnimator oProValHolder = ObjectAnimator.ofPropertyValuesHolder(container, pvhX);
oProValHolder.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
container.setVisibility(View.GONE);
}
});
oProValHolder.setDuration(DURATION).start();
}
}, 80);

public static InputStream getStringStream(String sInputString) {
  if (!Tools.isEmpty(sInputString)) { // !=null equals("")
    ByteArrayInputStream tInputStringStream = new ByteArrayInputStream(
    sInputString.getBytes());
    return tInputStringStream;
  }
  return null;
}

public static String read(InputStream inStream) throws Exception {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  byte[] buffer = new byte[1024];
  int len = 0;
  while ((len = inStream.read(buffer)) != -1) {
    outputStream.write(buffer, 0, len);
  }
    inStream.close();
    byte[] arry = outputStream.toByteArray();
    String result = "";
    if (arry != null) {
    result = Arrays.toString(arry);
  }
  return result;
}

/**
* 从jar包中读取资源
*
* @param file
* @return
*/
public static InputStream getStream(Context context, String file) {
InputStream is = null;

try {
is = Tools.class.getResourceAsStream("/" + file);
} catch (Exception e) {
e.printStackTrace();
}
return is;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: