user2269748
user2269748

Reputation: 43

Carrier Privileges not provided to the app

I am working on an application that is supposed to gain Carrier Privileges . We have an eSIM card, that already has a SHA-1 and fingerprint of a keystore used to sign application written to it, but the application not able to get the privileges.

Is there anything the application suppose to call in order to get the access?

I have the Service that extends CarrierService running, but it seems to not call onLoadConfig method at all.

Upvotes: 4

Views: 2101

Answers (1)

James Moore
James Moore

Reputation: 9026

I believe the documentation here is incorrect. It says to use:

<service android:name=".SampleCarrierConfigService"
android:label="@string/service_name"
android:permission="android.permission.BIND_CARRIER_SERVICES">
      <intent-filter>
      <action android:name="android.service.carrier.ConfigService"/></intent-filter>
</service>

but I think you need to use <action android:name="android.service.carrier.CarrierService"/> instead.

At least when we use the documented version, our onLoadConfig isn't called, and when we use android.service.carrier.ConfigService we do get the callback.

One other thing you can do is call something like this in your application (just in a regular activity, not in the service):

    val telephonyManager =
        context?.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
    val haspriv = telephonyManager.hasCarrierPrivileges()
    Log.d(TAG, "priv: $haspriv")

If telephonyManager.hasCarrierPrivileges() returns true, you know the signature checking is correct. This has nothing to do with the service; you can have an application that has carrier privileges without implementing android.service.carrier.ConfigService. (I don't know why you'd do that, but it's possible.)

Upvotes: 1

Related Questions