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.
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="http://schemas.android.com/apk/res/android" package="com.bengr.musicmetadateforlegacydevices" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="19" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" 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."/> </application> </manifest>