外部アプリからはどうですか?Android ビルドを作成し、最後の状態でアプリを実行して Android デバイス名を変更できますか?
IBluetooth.aidl -> setName を使用して Bluetooth 名を変更できます。
チュートリアルは、ここで見つけることができます。
つまり、src でパッケージ android.bluetooth を作成し、その中に IBluetooth.aidl と IBluetoothCallback.aidl をコピーして貼り付けます (前のリンクで見つけることができます)。
コードで、パッケージをインポートします。 import android.bluetooth.IBluetooth;
次に、このメソッドを実装して Bluetooth オブジェクトを取得します。
@SuppressWarnings("rawtypes")
private IBluetooth getIBluetooth() {
IBluetooth ibt = null;
try {
Class c2 = Class.forName("android.os.ServiceManager");
Method m2 = c2.getDeclaredMethod("getService", String.class);
IBinder b = (IBinder) m2.invoke(null, "bluetooth");
Class c3 = Class.forName("android.bluetooth.IBluetooth");
Class[] s2 = c3.getDeclaredClasses();
Class c = s2[0];
Method m = c.getDeclaredMethod("asInterface", IBinder.class);
m.setAccessible(true);
ibt = (IBluetooth) m.invoke(null, b);
} catch (Exception e) {
Log.e("flowlab", "Erroraco!!! " + e.getMessage());
}
return ibt;
}
次に、このオブジェクトをインスタンス化します。 IBluetooth ib =getIBluetooth();
おそらく ib.setName("something"); を使用します。