示例#1
0
  private void test11GetImei() {
    Log.i(TAG, "test11GetImei call getDeviceIdGemini()");
    String imei1 = null;
    String imei2 = null;
    long[] subIds = null;

    try {
      IPhoneSubInfo subInfo =
          IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
      // Sim 1
      subIds = SubscriptionManager.getSubIdUsingSlotId(0);
      if (subIds != null && subIds.length > 0 && subIds[0] > 0) {
        Log.i(TAG, "Find slot 0 with subId: " + subIds[0]);
        imei1 = subInfo.getDeviceIdForSubscriber(subIds[0]);
      }
      // Sim 2
      subIds = SubscriptionManager.getSubIdUsingSlotId(1);
      if (subIds != null && subIds.length > 0 && subIds[0] > 0) {
        imei2 = subInfo.getDeviceIdForSubscriber(subIds[0]);
        Log.i(TAG, "Find slot 1 with subId: " + subIds[0]);
      }
    } catch (RemoteException e) {
      Log.e(TAG, e.toString());
    }

    Log.i(TAG, "test11GetImei call getDeviceIdGemini() " + imei1 + " " + imei2);
    Bundle bundle = new Bundle();
    bundle.putString(KEY_IMEI1, imei1);
    bundle.putString(KEY_IMEI2, imei2);

    removeDialog(DIALOG_IMEI);
    showDialog(DIALOG_IMEI, bundle);
  }
 private IPhoneSubInfo getSubscriberInfo() {
   // get it each time because that process crashes a lot
   return IPhoneSubInfo.Stub.asInterface(ServiceManager.getService("iphonesubinfo"));
 }