UPDATED with 7 new functions, all of which are usefull when dealing with Android os <6. This extension gets write settings permission and brings up the wifi Hotspot settings box so your players can use your game or app when within wifi hotspot range of each other. You must have Gamemaker Studio 1x or 2x and the android module to use, minimum sdk setting for your projects is 14. (icecream sandwich)
There are 12 functions available. Some functions are only usefull, or work differently depending on weather the android OS is <6 or >= version 6 (marshmallow)
1. hotspotInit(); //Call at game start to check for write settings permission. - ALL OS VERSIONS 2. checkOnOff() //Returns real, 0 = hotspot NOT on, 1 = hotspot IS on. - ALL OS VERSIONS 3. setHotspot(); //Toggle hotspot on/off - brings up settings to user (android os 6+), or silent on/off toggle (Android < os 6). 4. hotspotFinal(); // Call at game end. Brings up settings box if hotspot is on (android 6+) or silently shuts it off (under os 6) 5. exitTheApp(); // Bug fix for GMS 1.4.1408. to correctly shut down app with the back button, also brings up settings box if hotspot is on (android 6+) or silently shuts it off (under os 6) 6. checkWifi() //Returns real, 0 = Wifi is off, 1 = Wifi is on. - USEFULL FOR < OS 6 (but works in all os), check if wifi is on because you cannot turn hotspot on if wifi is on. 7. setWifiOn(); //Switches wifi on. -ALL OS VERSIONS 8. setWifiOff(); //Switches Wifi off - ALL OS VERSIONS 9. getWifiName(); //Gets the name of the wifi network when connected. - ALL OS VERSIONS 10. openWifiMenu(); //Opens the wifi menu on the Android device. - ALL OS VERSIONS 11. setUpHotspot(String "new name", String "new password"); //Silently creates a mobile hotspot with name and password, if "" is entered as the password an OPEN hotspot is created with no password needed. - <6 OS ONLY, for android os>=6 it must be manually configured by the player using the setHotspot(); function. 12. getAndroidOS(); //Returns real, 0 is < Android os 6, 1 is >= Android os 6. - ALL OS VERSIONS
There is a small example project included in the extension asset package.
here is some example code on how to quickly implement it into your game or app: create event: status=0; back_pressed=0; hotspotInit();
///button 1 - open hotspot - left mouse pressed event: status = checkOnOff(); if status == 0 setHotspot();
///button 2 - close hotspot - left mouse pressed event: status = checkOnOff(); if status == 1 setHotspot();
///game end event can be used to make sure the hotspot settings come up if the player unexpectedly exits the game if back_pressed=0 hotspotFinal();
///back button pressed event, Closes your app and if hotspot is still on brings up the hotspot settings: back_pressed=1; exitTheApp();
End User Licence Agreement (EULA).