wifidirectplugin 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -140,6 +140,32 @@ public class WifiDirectPlugin extends Plugin {
140
140
  call.reject("Device address is required");
141
141
  return;
142
142
  }
143
+
144
+ manager.requestConnectionInfo(channel, info -> {
145
+ if(info != null && info.groupFormed) {
146
+ // 기존 그룹 해제
147
+ Log.d(TAG, "Existing Wi-Fi Direct group found. Removing group.");
148
+ manager.removeGroup(channel, new WifiP2pManager.ActionListener() {
149
+ @Override
150
+ public void onSuccess() {
151
+ Log.d(TAG, "removeGroup success, proceed to connect.");
152
+ // 그룹 해제 성공 시 연결 계속 진행
153
+ initiateConnect(deviceAddress, pin, call);
154
+ }
155
+ @Override
156
+ public void onFailure(int reason) {
157
+ Log.w(TAG, "removeGroup failed: " + reason + ". Proceed anyway.");
158
+ // 그룹 해제 실패 시에도 연결 시도(혹은 call.reject로 실패 처리 가능)
159
+ initiateConnect(deviceAddress, pin, call);
160
+ }
161
+ });
162
+ } else {
163
+ Log.d(TAG, "No existing group, proceed to connect directly.");
164
+ initiateConnect(deviceAddress, pin, call);
165
+ }
166
+ });
167
+ }
168
+ private void initiateConnect(String deviceAddress, String pin, PluginCall call) {
143
169
  WifiP2pConfig config = new WifiP2pConfig();
144
170
  config.deviceAddress = deviceAddress;
145
171
 
@@ -173,7 +199,6 @@ public class WifiDirectPlugin extends Plugin {
173
199
  call.reject("Connection exception: " + e.getMessage());
174
200
  // unload();
175
201
  }
176
-
177
202
  }
178
203
 
179
204
  @PluginMethod
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wifidirectplugin",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "HT-Installer Wifi Direct Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",