Several people have asked questions regarding getting the SSID, all of them only partionly work. According to the Android API wifiInfo.getSSID() should return a string, but no matter what I do the if statement returns false. I want to check if my phone is connected to "DieKantankys"
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
//Log.d("wifiInfo", wifiInfo.toString());
//Log.d("NetworkId",wifiInfo.getNetworkId());
if(wifiInfo.getSSID()=="DieKantankys"){
setContentView(R.layout.group_choose_activity);
}else{
setContentView(R.layout.not_connected_to_scouting_wifi_error);
}
}
What am I doing wrong?