Problems getting IMEI and Operator Name

0

I'm developing an application and needed to handle TelephonyManager, but every time I use it, it gives me some trouble. For example:

  

E / MPlugin: Unsupported class:   com.mediatek.common.telephony.IOnlyOwnerSimSupport

I've 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 Operator's name:

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

But always some error, sometimes permission error even granting the permission in Manifest.xml ... Thank you in advance! Thanks!

    
asked by anonymous 16.06.2018 / 02:05

0 answers