0

I'm trying to change the carrier name (the one displayed at the top left border).

I'm kinda new to Android Studio, so every tip will be useful to me...

public void enviar(View v)
{
// Get System TELEPHONY service reference
TelephonyManager tManager = (TelephonyManager) getBaseContext()
        .getSystemService(Context.TELEPHONY_SERVICE);

tManager.hasCarrierPrivileges();
// Get carrier name (Network Operator Name)
String nom = "DESIRED CARRIER NAME";
tManager.setOperatorBrandOverride(nom);
String carrierName = tManager.getSimOperatorName();

//TESTING THE CARRIER NAME
TextView tv = (TextView) findViewById(R.id.textView);
tv.setText(carrierName);

}}

"enviar" is set on a button, in the XML

android:OnClick="enviar"

I need to set the APN too, just clicking this button. It seems simple. A button that defines my own APN and Carrier name. I don't know if Root Access is required...

Thank you guys!

Fran B.
  • 5
  • 4
  • `I'm trying to change the carrier name ...` What for?! Any practical use, or are you just wasting your time? – Phantômaxx Nov 15 '16 at 16:13
  • Because we are a company, and we use different providers, so I want to display our own company name. – Fran B. Nov 15 '16 at 16:14
  • So, let's say you are Budweiser. Instead of displaying (say) AT&T, you would like to display Budweiser? How silly is that? – Phantômaxx Nov 15 '16 at 16:16
  • 1
    I doubt you will be able to change this unless you are creating Android builds of the OEMs source code. – ichthyocentaurs Nov 15 '16 at 16:18
  • Well, if we are talking about beer it would be dumb, but we are actually a telephony company. We just use dynamic providers, to assure the best and the fastest signal. – Fran B. Nov 15 '16 at 16:19
  • 1
    So, you want to HIDE the **real carrier name** and FAKE yours instead? Sounds kinda **illegal**, to me. – Phantômaxx Nov 15 '16 at 16:20
  • Let's be imaginative. You hire our service (we are actually from Spain). So let's say that you live in X. In X, the best signal you get is Movistar, so we will provide you with Movistar's signal. Then you move to Y, and in Y the best signal you get is Vodafone. So as before, we will provide you with Vodafone's signal. Basically I want to display the service name you paid for. – Fran B. Nov 15 '16 at 16:25
  • 1
    @FranB. does your company sell the phones? Do you provide updates? If so, then you should be able to configure this. If not, you'll have to talk to "the" carrier of the devices to get your signing certificate into their ROMs as a registered carrier certificate. – Bryan Herbst Nov 15 '16 at 16:27
  • You'd then better write something like "Movistar (by X)" or "Vodafone (by X)". Or "Whatever (by X)" – Phantômaxx Nov 15 '16 at 16:30

2 Answers2

3

The first problem is that you aren't actually using the result of tManager.hasCarrierPrivileges(). That method returns a (very important) boolean that tells you whether or not you will actually be able to perform any carrier operations like changing the operator brand.

The second problem is that you have to actually be the carrier to have carrier privileges. This is checked by verifying that your app's signing certificate is in the phone's UICC. I'm assuming that you aren't the carrier, since you are asking this question.

Since the UICC is configured at the ROM level, it is unlikely that you could insert your own key even with sudo access.

See also: Sign App with UICC Carrier Privileges Certificates

Community
  • 1
  • 1
Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
1

The problem is that you need to have carrier privileges in your app (Carrier App) or you need compile your own AOSP.

To modify the apn you need to install the app as a system application.

eapo
  • 11
  • 4
  • Can you explain a bit – Mathews Sunny Jan 11 '18 at 17:40
  • There are different installation directories for an app depending on the level of access it will have. If you need to modify parameters such as brand or apn your app should be installed in the directory /system/app or /system/priv-app/ but for this you must be the owner of the source code or have root access on the phone where the application will be installed . Another way to make changes to default parameters is to create a carrier app but the process is even longer. – eapo Jan 15 '18 at 15:15
  • You should also use permissions like android.permission.READ_PHONE_STATE or android.permission.WRITE_APN_SETTINGS – eapo Jan 15 '18 at 15:24