how to check first time loading internet available on Flutter? - dart

Above GitHub code is working well. Problem is before the app starts I turn off internet connection(mobile or wifi). but the output is showing Connected. After turn on the internet, showing Connected also and again turn off the internet showing Not-Connected. The first time is not the correct result after working well. How to fix this issue?
This how explains this code
https://stackoverflow.com/a/53855326/8822337
I used this GitHub code
https://github.com/dennmat/flutter-connectiontest-example

Related

Burpsuite proxy troubleshoot issue

I am working on mobile pentests currently. At first, using my home network I was able to intercept traffic on burpsuite for both iOS and Android versions of “Test App”. Then the next day, I still am able to intercept traffic but the behaviour of this “Test App” for both iOS and Android seem like it has certificate pinning as I was just stuck on the pre-auth page and getting errors when trying to log in. Without proxy though I am still able to login OK and proceed with the app normally so I don’t think my home network got blacklisted? (For context, the binaries does not have any certificate pinning).
But when I tried to change my network to my mobile hotspot, I could intercept the traffic and app behaves normally again.
Anyone encountered the same previously? Any ideas on what could be causing this? Thanks
This does seem odd. I would wager one of three things is happening here:
You accidentally left "Intercept" on in Burp Suite Proxy. This holds the response in Burp Suite until you click Forward, which would cause behavior very similar to what you are describing here. I have done this more times than I am willing to admit.
There was a temporary outage in the application's API. Not unheard of, especially if this is an unreleased app.
There is some sort of issue on your home network, but this is unlikely. Maybe two devices have the same static IP address?
It's hard to say exactly what the issue might be based on the information you provided, but hopefully this was helpful, or at least gives you a place to start!

Cordova app, using remote website - How to handle connection issues?

My problem
I'm working on a project where Cordova is being used to display a remote website within the app. Cordova.js is being run from the remote server, etc., and this works pretty well.
I do have one issue though, especially on iOS devices.
If the device lose connection at the same time as I press a link on the website, the page will turn blank, as if to load the next page - but since the connection is lost nothing will be loaded into this blank page. Given iOS devices lack of back-buttons or such there's no way to navigate from this blank page except by closing the app and re-opening it.
My attempted, and failed, sollution
So, given that I can use Cordova.js to check for connection issues, I figured that I could use an iframe to display the remote website. If the connection goes bye-bye I'd just display a simple error message inside the iframe.
And well, this does work.
BUT. And this is a big but. InAppBrowser will not run from an iframe. And I can't live without the InAppBrowser, since it's used to display quite a few important features within the app.
So
Does anyone know a way to either:
a) Handle connection issues when running only remote content in the Cordova app?
b) Run the InAppBrowser from within an iframe? (I suppose I could use PostMessage etc. between the frames, but since I'm already sending/receiving data from the InAppBrowser I would love to avoid this in order to limit complexity).
c) Solve this issue in another fancy manner?

appcache not working any more - not loading offline

I have tested my website thoroughly offline (just using localhost). And I have never had a problem with appcache - such that I could load my website, disconnect my phone from the wi-fi, reload the website and I could still view it.
Now I have put my website online (ie. http://subdomain.example.com) - the code is exactly the same - and I try the same thing.
It will just not work. Chrome on my phone says wi-fi and mobile are unavailable and the page can't be loaded.
I just don't understand. Is there anything that anyone can think of that is different about working locally to working on a remote server?
If anyone else has this problem in the future, check your paths in .appcache
In turned out that the change between local and online (ie. 10.0.0.10/myapp/Symfony/mobile vs subdomain.example.com) meant that the / I had in the first line of my manifest was pointing to different locations on both local and online.

Facebook Open Graph Share from iOS not working without hitting Open Graph Debugger first

I am trying to get Open Graph share actions to work on iOS. It's working some what, if I request the open graph url using the Open Graph Debugger first everything works as expected. However if I don't do this the preview in the share dialog is displayed for a seconds or so and then fades out. The post button is also disabled.
What I am seeing in the backend is that if I use the Open Graph Debugger or paste the object url into my own status I am getting requests from a Facebook server (69.171.234.117). However when I share directly from the application I am seeing a request from another Facebook server (173.252.74.115) this server doesn't seem to be able to read the Open Graph data correctly.
Has anyone seen anything like this before or know what's causing it?
EDIT: I've filed a bug with Facebook for this issue. Will updated here if it changes.
EDIT2: Facebook has confirmed this bug and is working on it. The suggested workaround for now is to trigger an initial scrape by using https://graph.facebook.com/?id={url}&scrape=true when the object is created.
EDIT3: Facebook closed the bug report and claimed the issue is solved in there latest SDK. I will verify this and report back.
EDIT4: This seems to be resolved now from my testing.
I encountered this issue before, it turns out that instances of custom open graph objects that are hosted on your server are instantiated only when they are related to for the first time.
Only when the first edge in the FB graph is assigned to your object is it that it obtains an Identifier and it exists in FB's records.
This first edge can only be created using the FB app or the open graph application.
After that's done you will be able to get a unique identifier for your object
GET https://graph.facebook.com/?ids=YOUR_OBJECT_URL
Then you could perform the share using the returned ID
Also see this SO post which supports my claim.

What is the best way to make my iOS app works when the user has internet ONLY

I am working on an iOS/iphone app where I want users to actually have internet for the app to work.
I have some data fetched from the internet, so the app won't work as expected if the user is not connected.
I have many views, where I want to integrate a solution for this.
I thought of many ways to solve that, but I am not sure if there's a better 1.
Adding check for internet in the app delegate, didfinihlanchingwithoptions.
Issue -> the check will only happens when the user 1st open the application and not when he returns after a call for example, and will only happen on the rootviewcontroller.
Adding the check in viewwillappear of each view.
This works, and I put the checks in a way that the view won't block during trying to connect.
But, what if the view was loaded, and then the user got disconnected.
Should I implement an NSTimer that keeps checking for internet? If yes, won't this be too heavy on the app? If No, what should I do?
Thank you.
following link explains everything what you need to know for checking the internet availability, Reachability is provided by Apple with the sample code, You basically don't have to do much for checking the internet availability, just see the sample code provided by the apple and you will get what you are looking for. here is the link http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

Resources