Zfinix / carrier_info

📱 Carrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCountryCode, e.t.c from both android and iOS devices.
MIT License
34 stars 48 forks source link

PlatformException (PlatformException(no_carrier_name, No carrier name, #31

Open Imesh7 opened 1 year ago

Imesh7 commented 1 year ago

PlatformException (PlatformException(no_carrier_name, No carrier name, java.lang.SecurityException: getDataNetworkTypeForSubscriber, null))

got above issue

onghuisheng commented 1 year ago

try adding a READ_PHONE_STATE permission in your AndroidManifest.xml

Imesh7 commented 1 year ago

@onghuisheng I have tried with the permission , you have mentioned. Still got the same error

aakashBodhi commented 1 year ago

@Imesh7 did you find any solution?

Imesh7 commented 1 year ago

@aakashBodhi Still not,

but I have integrate the previous version of this package to my apps.

onghuisheng commented 1 year ago

I can't repro the issue without any more details

tolzlz commented 1 year ago

@Override public CellIdentity getCellLocation(String callingPackage, String callingFeatureId) { mApp.getSystemService(AppOpsManager.class) .checkPackage(Binder.getCallingUid(), callingPackage); LocationAccessPolicy.LocationPermissionResult locationResult = LocationAccessPolicy.checkLocationPermission(mApp, new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) .setCallingFeatureId(callingFeatureId) .setCallingPid(Binder.getCallingPid()) .setCallingUid(Binder.getCallingUid()) .setMethod("getCellLocation") .setMinSdkVersionForFine(Build.VERSION_CODES.Q) .build()); switch (locationResult) { case DENIED_HARD: throw new SecurityException("Not allowed to access cell location"); case DENIED_SOFT: return (getDefaultPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) ? new CellIdentityCdma() : new CellIdentityGsm(); } WorkSource workSource = getWorkSource(Binder.getCallingUid()); final long identity = Binder.clearCallingIdentity(); try { if (DBG_LOC) log("getCellLocation: is active user"); int subId = mSubscriptionController.getDefaultDataSubId(); return (CellIdentity) sendRequest(CMD_GET_CELL_LOCATION, workSource, subId); } finally { Binder.restoreCallingIdentity(identity); } } When reading the Android source code, tell us that you need to authorize the loction permission Permission.storage, Permission.phone, Permission.location ,I get status Success

arlakay commented 1 year ago

same issue with version 2.0.8

error log: I/flutter ( 8201): │ 💡 Couldn't check carier status = PlatformException(no_carrier_name, No carrier name, java.lang.SecurityException: isMultiSimSupported: uid 10288 does not have android.permission.READ_PHONE_STATE., null)

manifest `<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" >

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name="android.permission.CAMERA" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<uses-permission android:name="android.permission.READ_BASIC_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />

<application
    android:label="@string/app_name_sales"
    android:name="${applicationName}"
    android:icon="@mipmap/ic_launcher">
    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:requestLegacyExternalStorage="true"
        android:launchMode="singleTask"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />

        <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

    </activity>

    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />

    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/app_icon" />
    <!-- <meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="high_importance_channel" /> -->

</application>

`