info.whitebyte.hotspotmanager.WifiApManager Java Examples

The following examples show how to use info.whitebyte.hotspotmanager.WifiApManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From Android-Wifi-Hotspot-Manager-Class with Apache License 2.0 5 votes vote down vote up
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    textView1 = (TextView) findViewById(R.id.textView1);

    wifiApManager = new WifiApManager(this);

    // force to show the settings page for demonstration purpose of this method
    wifiApManager.showWritePermissionSettings(true);

    scan();
}
 
Example #2
Source File: APWidget.java    From Android-Wifi-Hotspot-Manager-Class with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    // TODO: Implement this method
    lg("on recev");

    WifiApManager apMan = new WifiApManager(context);
    state = apMan.isWifiApEnabled();
    lg("state: " + state);

    if (WIFIAP_STATE_CHANGED.equals(intent.getAction())) {
        lg("ap changed");
    }

    if (intent.getBooleanExtra(STATE, false)) {
        state = !state;
        apMan.setWifiApEnabled(null, state);
        lg("Widget button click");
    }

    if (intent.getBooleanExtra(STATE, false) || (WIFIAP_STATE_CHANGED.equals(intent.getAction()) && !intent.getBooleanExtra(STATE, false))) {
        AppWidgetManager awm = AppWidgetManager.getInstance(context);
        ComponentName cn = new ComponentName(context, this.getClass());
        int[] ids = awm.getAppWidgetIds(cn);
        onUpdate(context, awm, ids);
    }

    super.onReceive(context, intent);
}
 
Example #3
Source File: HotspotManager.java    From react-native-wifi-hotspot with ISC License 4 votes vote down vote up
public HotspotManager(Context context) {
    wifi = new WifiApManager(context);
}
 
Example #4
Source File: WifiIotPlugin.java    From WiFiFlutter with MIT License 4 votes vote down vote up
private WifiIotPlugin(Activity poActivity) {
    this.moActivity = poActivity;
    this.moContext = poActivity.getApplicationContext();
    this.moWiFi = (WifiManager) moContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    this.moWiFiAPManager = new WifiApManager(moContext.getApplicationContext());
}