Add Suffix to name of WiFi Direct Group name. (similar to what PDANet does)
Asked Answered
M

0

6

I am trying to create a WiFi Direct Group with a custom name. But after exploring all the options I came to know that we cannot change the name and Android OS decide itself about the name of WiFi Direct Group

I even tried Reflection to achieve the same but it didn't worked on Android Nougat and above.

I am using the following code to create the WiFi Direct Group:

WifiP2pManager manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
WifiP2pManager.Channel channel = manager.initialize(this, getMainLooper(), null);
 manager.createGroup(channel, new WifiP2pManager.ActionListener() {
                @Override
                public void onSuccess() {
                    Toast.makeText(getApplicationContext(), "Group Created", Toast.LENGTH_SHORT).show();
                }

                @Override
                public void onFailure(int i) {
                    Toast.makeText(getApplicationContext(), "Group Creation Failed", Toast.LENGTH_SHORT).show();
                }
            });

But when I tried PDANet+ app they were able to create a WiFi Direct Group Name with a suffix PDANet.

For example:

My app generates the following Group name : DIRECT-mq-ONEPLUS

While PDANet generates: DIRECT-Dj-ONEPLUS A6000-PdaNet

So I was wondering how they are adding the Suffix to the WiFi Direct Group name. If anyone can help me on this that will be much help.!

Thanks.!

Methionine answered 24/12, 2018 at 6:18 Comment(3)
Did you try this solution? https://mcmap.net/q/1060769/-how-change-the-device-name-in-wifi-direct-p2pForbear
@Forbear Already tried this but getting a NoSuchMethodException in my Android P device.Methionine
What is your compileSdkVersion number? I have this method on 28Forbear

© 2022 - 2024 — McMap. All rights reserved.