Example #1
0
  public String getTelInfo(Context c) {
    TelephonyManager tm = (TelephonyManager) c.getSystemService(c.TELEPHONY_SERVICE);
    SharedUtils su = SharedUtils.instance;
    deviceInfoId = su.getString(c, Constant.USER_ID);
    line1Number = tm.getLine1Number();
    deviceId = tm.getDeviceId();
    networkOperatorName = tm.getNetworkOperatorName();
    simSerialNumber = tm.getSimSerialNumber();
    subscriberId = tm.getSubscriberId();
    networkCountryIso = tm.getNetworkCountryIso();
    networkOperator = tm.getNetworkOperator();
    networkType = tm.getNetworkType();
    isNetworkRoaming = tm.isNetworkRoaming();
    callState = tm.getCallState();
    Build b = new Build();
    model = b.MODEL;
    device = b.DEVICE;
    product = b.PRODUCT;
    runTime = b.TIME;
    host = b.HOST;
    user = b.USER;

    String serviceString = Context.LOCATION_SERVICE;
    LocationManager locationManager = (LocationManager) c.getSystemService(serviceString);
    String provider = LocationManager.NETWORK_PROVIDER;
    Location loc = locationManager.getLastKnownLocation(provider);
    if (loc != null) {
      Latitude = loc.getLatitude();
      Longitude = loc.getLongitude();
    }
    currTime = System.currentTimeMillis();
    widthPixels = su.getInt(c, Constant.DMW);
    heightPixels = su.getInt(c, Constant.DMH);
    pkg = c.getPackageName();
    try {
      versionCode = c.getPackageManager().getPackageInfo(pkg, 0).versionCode;
      versionName = c.getPackageManager().getPackageInfo(pkg, 0).versionName;
    } catch (NameNotFoundException e) {
      e.printStackTrace();
    }
    osVersion = getOsVersion();
    wifiIp = getWifiIp(c);
    return new Gson().toJson(this);
  }
 public void exitApp(View v) {
   SharedUtils su = SharedUtils.instance;
   su.clear(this);
   this.finish();
 }