当用户单击小部件图标时,我需要打开和关闭 wifi...
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if(wifiManager.isWifiEnabled())
wifiManager.setWifiEnabled(false);
else
wifiManager.setWifiEnabled(true);
我如何使用 pendingIntents 来实现它?