Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.net.wifi.WifiConfiguration;

import android.os.Build;

import java.util.UUID;

public class Main {
    public static final String SSID = "YDZS_" + Build.MODEL.replaceAll("\\s|-", "") + "00"
            + UUID.randomUUID().toString().substring(0, 4);

    public static WifiConfiguration createWifiCfg(String ssid) {
        WifiConfiguration wifiCfg = new WifiConfiguration();
        wifiCfg.SSID = ssid;
        //        wifiCfg.SSID = "\"" + ssid + "\"";
        wifiCfg.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
        //        wifiCfg.preSharedKey = "abcdefgh";
        return wifiCfg;
    }
}