Deside the host before connecting with WiFi Direct

133
August 16, 2019, at 6:20 PM

How can you decide which phone would be the Group Owner of the Direct Network before connecting to it in Android Studio?

Or would it just be the first device to connect when al history of previous connections is deleted, and if so how do you delete the history of previous connections in Android Studio?

How I currently disconnect where I assumed removeGroup removed the history of having that group but probably not as no matter on which phone I click connect on only a specific one becomes the GroupOwner:

@Override
public void disconnect() {
        manager.removeGroup(channel, new ActionListener() {
            @Override
            public void onFailure(int reasonCode) {
                Log.d(TAG, "Disconnect failed. Reason :" + reasonCode);
            }
            @Override
            public void onSuccess() {
                fragment.getView().setVisibility(View.GONE);
            }
        });
    }

How I currently Connect:

@Override
public void connect(WifiP2pConfig config) {
        manager.connect(channel, config, new ActionListener() {
            @Override
            public void onSuccess() {
            }
            @Override
            public void onFailure(int reason) {
                Toast.makeText(WiFiDirectActivity.this, "Connect failed. Retry.",
                        Toast.LENGTH_SHORT).show();
            }
        });
    }

What calls the connect function:

WifiP2pConfig config = new WifiP2pConfig();
                config.deviceAddress = device.deviceAddress;
                config.wps.setup = WpsInfo.PBC;
                if (progressDialog != null && progressDialog.isShowing()) {
                    progressDialog.dismiss();
                }
                progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel",
                        "Connecting to :" + device.deviceAddress, true, true           );
                ((InterfaceListener) getActivity()).connect(config);
Rent Charter Buses Company
READ ALSO
Java reference to activity

Java reference to activity

i have non-Activity class QtAdMobBanner that store reference to main Activity (simplified code below), why reference that set once at initialization still valid after activity created/destroyed (ActivityLifecycleCallbacks still work)?

176
How Do I add attendees to a Calendar intent?

How Do I add attendees to a Calendar intent?

I'm creating an intent to share and open with the default calendar appI want to add an attendee email, but can't find how it's done

156
Android Studio don't showing Build Variants

Android Studio don't showing Build Variants

Im recently struggling with a problem where my Build Variants is not working properlyI can't select variants, there is just a ----- on the selection row

116
I am trying to Navigate optimize route but getting Error in Logcat

I am trying to Navigate optimize route but getting Error in Logcat

"Using the default milestones requires the directions route to include the route options object"

121