diff --git a/android/app/build.gradle b/android/app/build.gradle index 9cd8b0e..7792554 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -44,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.cloudSolutions.mohemmtest" + applicationId "hmg.cloudSolutions.mohem" minSdkVersion 21 targetSdkVersion 32 versionCode flutterVersionCode.toInteger() diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 30555e1..10d72b4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -9,9 +9,9 @@ { isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool; if (!kReleaseMode) { // username.text = "15444"; // Maha User - // username.text = "15153"; // Tamer User - // password.text = "Abcd@1234"; + username.text = "15153"; // Tamer User + password.text = "Abcd@12345"; // username.text = "206535"; // Hashim User // password.text = "Namira786"; @@ -224,6 +225,14 @@ class _LoginScreenState extends State { Navigator.pushNamed(context, AppRoutes.forgotPassword); }), ), + 20.height, + DefaultButton( + "Connect HMG Network", + () async { + SystemChannels.textInput.invokeMethod('TextInput.hide'); + connectWithHmgNetwork(); + }, + ), ], ), ) @@ -239,4 +248,30 @@ class _LoginScreenState extends State { ), ); } + + void connectWithHmgNetwork() async { + try { + bool isConnected = await WiFiForIoTPlugin.connect("MOHEMM-CONNECT", password: "0987654321", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false); + + if (isConnected) { + await WiFiForIoTPlugin.forceWifiUsage(true); + // if (Platform.isIOS) { + // await closeWifiRequest(); + // await Future.delayed(Duration(seconds: 6)); + // } else { + // await WiFiForIoTPlugin.forceWifiUsage(true); + // } + } + } catch (e) { + print("----------------o----"); + print(e); + } + } + + Future closeWifiRequest() async { + if (Platform.isAndroid) { + await WiFiForIoTPlugin.forceWifiUsage(false); + } + return await WiFiForIoTPlugin.disconnect(); + } }