Merge "Use app context to init WifiP2pManager."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d75a692793
@@ -186,7 +186,8 @@ public class WifiP2pSettings extends DashboardFragment
|
|||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
mWifiP2pManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
|
mWifiP2pManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
|
||||||
if (mWifiP2pManager != null) {
|
if (mWifiP2pManager != null) {
|
||||||
mChannel = mWifiP2pManager.initialize(activity, getActivity().getMainLooper(), null);
|
mChannel = mWifiP2pManager.initialize(activity.getApplicationContext(),
|
||||||
|
getActivity().getMainLooper(), null);
|
||||||
if (mChannel == null) {
|
if (mChannel == null) {
|
||||||
//Failure to set up connection
|
//Failure to set up connection
|
||||||
Log.e(TAG, "Failed to set up connection with wifi p2p service");
|
Log.e(TAG, "Failed to set up connection with wifi p2p service");
|
||||||
|
Reference in New Issue
Block a user