1、 Requirement description
Recently, we need to make a requirement to determine whether the Android device is connected to the WiFi with the specified name before doing a certain business. If you are connected to the WiFi with the specified name, you can continue a service; Otherwise, skip to settings to connect to the WiFi with the specified name
Therefore, I need to obtain the WiFi name of the current Android device connection for business logic judgment
2、 Implementation method
Before implementation, you need to add corresponding permissions
First of all, it’s necessary to obtain permissions. Those above 8.0 should be added in Android manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission