The direct Wi-Fi name is the name of the device, you can change it as follows:
public void changeWiFiDirectName(final String newName){ Method m = null; try { m = mManager.getClass().getMethod("setDeviceName", new Class[]{mChannel.getClass(), String.class, WifiP2pManager.ActionListener.class}); } catch (NoSuchMethodException e) { e.printStackTrace(); } try { if (m != null) { m.invoke(mManager, mChannel,newName, new WifiP2pManager.ActionListener() { @Override public void onSuccess() { Log.d(TAG, "Name changed to "+newName); } @Override public void onFailure(int reason) { Log.d(TAG, "The name was not changed"); } }); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); }
source share