Android emulator: Set mobile device number?

后端 未结 6 592
北海茫月
北海茫月 2020-12-29 17:24

Does anyone know if its possible to set the emulator\'s mobile number? I have not been able to find information about this anywhere. Thanks.

相关标签:
6条回答
  • 2020-12-29 18:06
    TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    
                     // get IMEI
                     String imei = tm.getDeviceId();
                     System.out.println("gfvnchgjvbnvhjbbnvgjvbncghvmn ngvm"+imei);
    
                     // get SimSerialNumber
                     String simSerialNumber = tm.getSimSerialNumber();
                     System.out.println("854755745588954754855ngvm"+simSerialNumber);
    
                     //get SimCardNumber
                     String number = tm.getLine1Number();
                     System.out.println("gfch5652345651szdxfcgvhbjnfcgvh ngvm"+number);
    
    
    
    And Import :]->
    
    import android.content.Context;
    
    import android.telephony.TelephonyManager;
    
    0 讨论(0)
  • 2020-12-29 18:07

    Mostly full control of the phone number detailed at the end of this blog:

    http://blog.talosintel.com/2013/04/changing-imei-provider-model-and-phone.html

    First 7 are fully configurable, last 4 can be one of 16 allowed port numbers.

    It turns out that the phone number is stored on the SIM card. Since there is no actual SIM card, one is emulated. This emulated SIM is hard coded in the emulator-arm binary. The reason replacements for 1555521 failed is because SIM cards have a specification that does not store the MSISDN (Mobile Subscriber Integrated Services Digital Network-Number, AKA phone number) in plain text. Instead, each set of digits is swapped in some reverse nibbled endianness nightmare.

    ... A quick way to find the MSISDN is to search for %d%df%d in the binary (highlighted in red below). The corresponding source code is in external/qemu/telephony/sim_card.c on line 436 in the current repo. The following is the format string portion of that sprintf:

    "+CRSM:144,0,ffffffffffffffffffffffffffffffffffff0781515525%d1%d%df%dffffffffffff"
    

    The interesting part is 515525%d1 (highlighted in blue). Swapping each set of two digits produces 1555521%d (thanks again CodePainters). That looks like the prefix to our mobile number.

    Edit it in a hex editor.

    0 讨论(0)
  • I think this webpage will show you how to do it

    https://www.wikihow.com/Find-Your-Phone-Number-on-Android

    here instead of about phone try searching about the emulator device

    0 讨论(0)
  • 2020-12-29 18:12

    You can simulate incoming SMS and calls in the simulator (using the simulator's port) but that's all, you can not set a device number or anything like that. For that kind of thing you will need a real device.

    0 讨论(0)
  • 2020-12-29 18:19

    As I have found each emulator already has a phone number. If you run two emulators you can call from one emulator to another. To find out this phone numbers you can run in the terminal window:

    Path\To\Your\Android\Sdk\platform-tools>adb devices
    List of devices attached
    emulator-5554   device
    emulator-5556   device
    

    First phone number is +15555215554, second +15555215556, i.e. phone number is prefix +1555521 plus emulator suffix 5554 or 5556.

    0 讨论(0)
  • 2020-12-29 18:25

    The mobile number of an emulator is the port number of that emulator. For more details. please check this link:

    http://developer.android.com/guide/developing/devices/emulator.html#calling

    0 讨论(0)
提交回复
热议问题