My application only works if it's on the campus network in order to access campus data. When running the application on public wifi or 3g network, the application will hang then force close. How do I program my application to check for that private network/wifi or check what connection android is currently using, if not equal to "campus wifi" then....?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
From what you are saying i think you want to enforce application to use only Campus wifi.
So here you go
Create WifiConfiguration instance:
Then, for WEP network you need to do this:
For WPA network you need to add passphrase like this:
For Open network you need to do this:
Then, you need to add it to Android wifi manager settings:
And finally, you might need to enable it, so Android conntects to it:
Note that In case of WEP, if your password is in hex, you do not need to surround it with quotes.