Problems in getting IMEI and Operator Name

Asked

Viewed 40 times

0

i am developing an app and needed to handle the Telephonymanager, however, every time I use it gives some problem. For example:

E/Mplugin: Unsupported class: com.mediatek.common.telephony.Ionlyownersimsupport

I tried to get the imei:

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        if (ActivityCompat.checkSelfPermission(this, READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            return;
        }
        String imei = telephonyManager.getImei();

I tried to get the name of the operator:

TelephonyManager manager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
            String nomeOperadora = manager.getNetworkOperatorName();
            printarImei.setText(nomeOperadora);

But it always gives some error, sometimes error of permission even granting the permission in Manifest.xml... Thank you already!! Thank you!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.