Setting a manual wifi IP via a Flutter APP - flutter

I'm using Flutter to create an APP that connects to a WIFI access point. I have used WifiIot to connect to Wi-Fi routers before, but this access point doesn't have a DHCP client, so I need to set the IP manually (I already know how I'm going to manage IP clashes).
I want to do this programmatically - not by having the user set the IP, globally, via settings.
Target platform: Android.
I tried seeing if WifiIot had this capability - Not seeing that it does.
Also looked at other Dart libraries.
I'm in the process of seeing if I can do this with native Android (Kotlin) and maybe call this from Flutter (not my preferred method).

Related

How to use proxy in Wi-fi setting for the app in Flutter app?

Case:
I use Flutter to create an app, and the app will call Restful Api to backend server to get data.
However, the backend server only open to a selected host and port for security reason.
The app works well if it is under that network, but cannot works properly because of fail to get data if out of that network.
As a result, I would like to setup a proxy for the wi-fi I'm using, and run the app as normal.
Unfortunately, the flutter app still not working in both Android and IOS platform.
Question:
How to use proxy in Wi-fi setting for the app in Flutter app?
You may try using this package to apply the system's global proxy settings: https://pub.dev/packages/native_flutter_proxy
Dart's networking tools don't pick up these settings on their own.

Unable to connect Samsung S10 to charles proxy

With device manual proxy to my Charles IP address, not seeing any traffic or prompt to allow traffic in Charles Proxy. S10 device appears to load all traffic when navigating to various URLs.
Even charlesproxy.com/ssl loads website but doesn't initiate a certificate to download.
All other android devices tested on same setup works fine. Issue seems specific to Samsung S10
So what seemed to have worked for me just now, with my mac (I assume it would be something similar for Windows) I just opened a regular browser, went to chls.pro/ssl and download the certificate file.
From there I sent it to my S10+ and opened it, which then installed it properly.
If you're trying to hook up to Android devices then beware that Google introduced security measures to not allow proxy monitoring in I believe Android 6 or 7. If the other devices you had worked fine on Android then it's probably because you were using an earlier version of Android, or, you had a debug build that allowed for proxy monitoring. I know there's a SO post somewhere that talks about this "pinning" and I know our company does this as well with debug apk's. If neither of those solutions work then it's probably a matter of getting the Charles certificate installed correctly on that phone but without more information it is hard to diagnose. Hope this helps you

Install a progressive web application (PWA) on the phone without a network

Is it possible (e.g. when developing) to send a pwa to the phone someway e..g. via usb cable without the network and serving it in https?
The use case is development, when maybe a wifi network is not available or unpractical to set up.
If your APP is fully PWA compliant, the app added to home will be an installed APK, which you can extract using file explorer(I used ES File explorer) and put it in other devices using USB connection and adb install myapp.apk for installation.
After you load the apk, it would anyways make calls to your web-server which I'm not sure how it make sense to achieve without network connection though. I couldn't think of any reason to develop a mobile application as PWA without network. You can even have a pass though internet(sharing your desktops internet via USB) by connecting via USB if wifi is not available. But developing PWA with absolute no network mode is not practical.
Update: While you can generate the APK and side load it via USB in the above mentioned way, transferring the cached assets(HTML/CSS/JS/images) might be tricky. You may have to wrap your app as a plain cordova application or Ionic kind of PWA app which uses Cordova to wrap and build with your assets. This way, your APK will be having everything it needs to run for calculator kind of use case.

View localhost site on iPhone on OSX

I am building a .NET website with MonoDevelop on OSX Lion that is targeted for mobile devices.
On my desktop's browser, I am able to access the site via http://127.0.0.1:8080, but I would like to view it on my physical iPhone (I don't want to use the XCode simulator).
My iPhone and Mac are on the same network and I have enabled Web Sharing. I can actually get to the default Apache index.html (http://192.168.1.104:80) page, but I am not able to get to my site (http://192.168.1.104:8080).
I'm newer to the Mac and even less familiar with network management, so I hope I'm missing something very simple.
You may as well turn off web-sharing because web-sharing only operates the built-in Apache web-server.
What is happening is that the web-server that MonoDevelop is hosting your pages on has been set up to only allow connections coming from localhost. If this is the problem, entering in the lan IP of the OS X machine on the OS X machine will likely also not work (if the IP filtering work like it does on Apache).
You need to find the config files for the MonoDevelop server and allow access from addresses other than 127.0.0.1

android emulator net access stopped after some minutes of working

While working with my app that require network access...
The Android 2.2 emulator's network connection stop working...
The net was working properly but after some time it did not respond on emulator,
while it was working f9 on my system...
I have cross checked the net connections and restarted with the emulator(even created a new avd ). But the problem remains same my net is not working on emulator..
I have also checked the connection with F8 key on emulator...
My app manifest net permission is enabled....
Finally After all I have myself found the solution of to the problem:
It's very common problem that must have been faced by most of android developers....
Recently, while developing an Android Application, I was faced with a situation that wasted 2 hours of my time. The issue was simple, my app was not able to access internet from the Android Emulator.
Initially I thought fixing the issue should have been straight forward, but life is not always that simple.
So what was the real issue because of which my app was not able to access internet? There are multiple reasons because of which this issue could occur. Hence, I decided to document my findings so that other could benefit from it.
There are two main symptoms of no internet connection on android emulator.....
**Only your app is not able to access the internet
**None of the apps are able to access the internet
Lets look at what are the reasons behind each of them.
Only your app is not able to access the internet
If only your app is not able to access the internet on the emulator, check if any other apps are able to access the internet or not. For e.g. you could open up the browser application, visit http://news.google.com/. If the page opens up correctly then problem lies in your app itself and its simple to fix.
Basically, your app needs the Permission to access the internet. This can be done by adding the following line just before the end of tag in AndroidManifest.xml file of your application.
Compile and re-install the app in the emulator and try to access the internet from your app. It should work!
What is the use of uses-permission tag:
Android application can request certain permissions so that they can function properly. Some examples of permissions are, get users location, make a call, access the internet etc. App has to explicitly specify this in the AndroidManifest.xml.
When end users install such an app on their device, the android OS will notify the user that, app is requesting certain permissions. If users are fine with that, then only the app will be installed. Else users can deny the permission and the app will not be installed.
This mechanism is Androids way of implementing security and users privacy!
This is the more tricky situation:
None of the apps are able to access the internet
Now this situation is tricky. There are two reasons because of which this could happen
Proxy server is not configured on the emulator
Incorrect DNS used by the emulator
Setting Up the DNS Server:
emulator.exe -avd 'android1.6' -dns-server 8.8.8.8
The android1.6 is your avd name I created an avd with name android1.6
So just replace android1.6 with your avd name.
Run this code in command prompt after setting the path to tools & platform tools of your android sdk