Lollipop Leak for Sprint Galaxy S5, TWRP for Micromax Canvas Magnus – XDA TV

Android 5.0 Lollipop has been leaked for the Sprint … more

Velocity is Like OpenTable on Steroids

We all enjoy a night out with friends or our significant other from time to time. However, there is … more

Android Lollipop Lands for the Sony Xperia Z Ultra

The undisputed king of the beasts–at least in Sony’s current stable,is the … more

Android 5.0 Lollipop in 3D–EVO 3D, That Is!

It is that time of the year once again. Flowers bloom (or snow falls, depending on which … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] How to change carrier text on demand

OP benthe

7th August 2014, 04:29 PM   |  #11  
OP Senior Member
Thanks Meter: 70
194 posts
Join Date:Joined: Dec 2011
Originally Posted by GermainZ

I can't check the project right now, but just to make sure I understand correctly, you're doing something like this:
1- You're hooking the class in which the carrier text is set and registering a BroadcastReceiver there.
2- From your app, you're sending a broadcast whenever you want (possibly with the text you want in the extras).
3- In the BroadcastReceiver's onReceive method, you're setting the carrier text to the value you just received.

If that's what you're doing, it seems fine to me. For the permissions issue, I suppose adding the required permission to your manifest will fix that.

Not really. The carrier text has nothing to do with the issue anymore. Even if I removed all the code that has to do with the carrier text, and left the bluetooth part alone - the issue would persist.
What I'm doing is this:
1- Have a regular class (meaning it derives from Object directly, and doesn't implement any interfaces).
2- In the said class I set up a BroadcastReceiver (using the application context, which I got via AndroidAppHelper.currentApplication().getApplicati onContext(), which is static and can be called from anywhere).
3- When the BroadcastReceiver's onReceive() is called (again, in the previously mentioned class), I call BluetoothAdapter.getDefaultAdapter().setText with the text I want to set as the phone's BT name.
4- Error messages pop-up, and the error I attached in my previous reply shows up on the logcat. (this step occurs when the onReceive is called, which calls the setText).

When I comment out the setText() call, no errors occur (but the BT name doesn't change, obviously).

It's important to note that I did add the needed permissions to my manifest:
<manifest xmlns:android=""
    android:versionName="1.0" >

        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
        android:theme="@style/AppTheme" >
        <meta-data android:name="xposedmodule" android:value="true"/>
        <meta-data android:name="xposedminversion" android:value="50"/>
        <meta-data android:name="xposeddescription" android:value="Changes the device's carrier and bluetooth names to display the currently playing track."/>

7th August 2014, 04:46 PM   |  #12  
GermainZ's Avatar
Forum Moderator / Recognized Developer / XDA Portal Team
Thanks Meter: 7,229
5,875 posts
Join Date:Joined: Aug 2012
Donate to Me
So you're not using Xposed for anything anymore? Sorry but I'm a bit confused now.
7th August 2014, 04:50 PM   |  #13  
OP Senior Member
Thanks Meter: 70
194 posts
Join Date:Joined: Dec 2011
Originally Posted by GermainZ

So you're not using Xposed for anything anymore? Sorry but I'm a bit confused now.

For what I'm doing right now? Not really.
My module is composed of two parts - one for changing the BT name (which doesn't require private calls, and can be done via Android's public API), and one for changing the carrier name (which does require Xposed, as I'm doing some private calls etc).

The carrier name part of the module works perfectly right now.
However, the Bluetooth one doesn't; and crashes as mentioned before, and throws a permission error. However, on a side-project that's just a regular Android app, that also changes the BT name this works (keep in mind that in both the side-project and the Xposed module project I added both Android bluetooth permissions).
Post Reply Subscribe to Thread

carrier, xposed
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes