Below you can find code which help you find if SIM card available in the device.
There two solutions. One for Android API less than 22 and for Android API greater than or equal to 22.

Problem that dualsim support added in API-22. And we should deal with devices which support dual sim and has API less than 22.

So solution for API less than 22.

You can ask why I’m not checking for phone number. I do this because the phone number is not 100% available. Sim card serial number always available.

Second solution for API greater than or equal to 22

And here is universal solution:

Let me know your solution in comments.


shekhar · 22 August, 2017 at 07:59

Thanks man,
How can i get both sim details for below version 22.

    Igor Khrupin · 22 August, 2017 at 09:45

    Hi Shekhar.
    I’d the same problem.
    You can’t get sim details but you can get if sim available in phone.
    Phone number detection not working stable for me.
    The best solution is asking user about phone number. This may always works.

    Damu · 16 July, 2018 at 06:55

    Hope there is no dual sim phones were introduced before version 22


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.