2013-09-08 2 views

답변

8

이것은 피어와의 연결을 끊는 데 사용하는 방법입니다. 나는 로그에서 앱에 내장 된 안드로이드도 같은 방법으로 피어를 연결 해제했다는 사실을 알게되었습니다.

public static void disconnect() { 
    if (mManager != null && mChannel != null) { 
     mManager.requestGroupInfo(mChannel, new GroupInfoListener() { 
      @Override 
      public void onGroupInfoAvailable(WifiP2pGroup group) { 
       if (group != null && mManager != null && mChannel != null 
         && group.isGroupOwner()) { 
        mManager.removeGroup(mChannel, new ActionListener() { 

         @Override 
         public void onSuccess() { 
          Log.d(TAG, "removeGroup onSuccess -"); 
         } 

         @Override 
         public void onFailure(int reason) { 
          Log.d(TAG, "removeGroup onFailure -" + reason); 
         } 
        }); 
       } 
      } 
     }); 
    } 
} 
+8

그룹 소유자가 아닌 경우 연결을 끊는 방법이 있습니까? – Doronz

관련 문제