Check the status of SIM cards 1 and SIM 2 on a Dual SIM device

1

The answer above answered the part of my problem, so now another question has arisen.

How do I check the status of SIM 1 and SIM 2 cards in a Dual SIM device?

At this point I have the solution implemented as follows:

if (phoneType == TelephonyManager.PHONE_TYPE_NONE) {
            Toast.makeText(MainActivity.this, "Cartão SIM não Disponível - Não e Possível Enviar SMS", Toast.LENGTH_SHORT).show();
        } else {
            if (!enabled) {
                // check if enabled and if not send user to the GPS settings
                Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                Toast.makeText(MainActivity.this, "Ative a Localização Por Favor...", Toast.LENGTH_SHORT).show();
                startActivity(intent);
            } else {
                if (telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY) {
                    if (Build.VERSION.SDK_INT < 23) {
                        //Do not need to check the permission
                        //getLocation();
                        sendSMS();
                    } else {
                        if (checkAndRequestPermissions()) {
                            //If you have already permitted the permission
                            //getLocation();
                            sendSMS();
                        }
                    }

                } else {
                    Toast.makeText(MainActivity.this, "Cartão SIM não Disponível - Não e Possível Enviar SMS", Toast.LENGTH_SHORT).show();
                }

            }
        }

With this implementation failed on some Dual SIM devices, how can I check and make conditions for SIM1 to have active card, or vice versa?

    
asked by anonymous 12.03.2017 / 16:48

0 answers