IONIC Application showing no internet connection - android

I have successfully installed cordova network plugin and no errors so far from the code side.
When I use ionic serve to get the app to run on my browser, it detects my wifi and the plugin recognizes a connection, and if i disable wifi on my computer, it again recognizes that there is no internet connection.
The problem now comes when I install the app onto an android phone after building. I even have Bluestacks on my computer but the app does not get the network from there too. Has anyone run into this problem? How did you go through it?
I do not think it is an issue with my code, so I am not posting code, unless someone will need it for clarification.
I hope someone is able to help.
Permission in androidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
config.xml do include:
<access origin="*" />

Problem Solved : As Permission Issue Held Due to Permission Was Listed in Dangerous Permission.
I Lowered my TargetSDKVersion

Related

Unable to resolve host "mydomain.com": No address associated with hostname

Error
UPDATE: Solved, it was a configuration error in Samsung Knox.
Here is another question about
SocketException: Failed host lookup: 'mydomain.com'
(OS Error: Unable to resolve host "mydomain.com": No address associated with hostname, errno = 7)
Background
My app calls my API:s, plain and simple. It used to work the other day, but after an update it stopped working and I got the error above. (The update had minor changes, should not affect this)
Flutter app.
Android device, Samsung Tab A (SM-515).
The device has internet connection.
The app has all the permissions needed to access internet.
I am able to visit a site on the same domain using the browser.
Restarting Wi-Fi does not help.
Disabling Wi-Fi and using mobile network does not help.
Restarting device does not help.
Uninstalling the app and reinstalling it does not help.
Uninstalling the app and installing the debug version helps, it can now access the API.
Uninstalling the debug version and reinstalling the release version does not help, same error again.
The exact same release version work on a different, but identical device.
Requests are sent with package:http/http.dart, get method.
The API does not have any authentication, anonymous access allowed.
I replaced http.dart with package:dio/dio.dart, same result.
I've updated flutter and all packages and done a complete rebuild, same result.
I've seen this error before, but only temporarily. The errors are logged to Sentry, but no errors from this device are logged, implicating that the app does not have internet access at all.
It is extremely frustrating. I've spent two days on this, my last option is to factory reset the device. I don't want to do that because I want to know what the cause is and how I can prevent it from happening again.
I need help on how to debug. What can I look for in adb logcat?
Edit:
Here are the permissions set in android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Edit 2: More info in list.
Edit 3:
So I was going to try to get DNS info in the app using package:dns_client/dns_client.dart, but as I suspected the app does not access internet at all. I got the same error for the domains cloudflare-dns.com and dns.google.com.
Using InternetAddress.lookup("google.com") I got the error SocketException: Failed host lookup: 'google.com' (OS Error: No address associated with hostname, errno = 7).
Edit 4:
I created a new Flutter app from scratch. And it works when adding the permissions. The error is most likely related to the permissions, but somehow the app don't get it on one specific device. Is there a permission cache on Android that persists through uninstalls and restarts?
The info about the app says it has all the permissions needed. Is it a bug in Android?
Edit 5:
Running the command adb shell dumpsys package package.name to list permissions and got this result, which shows that network access is granted.
install permissions:
android.permission.INTERNET: granted=true
android.permission.ACCESS_NETWORK_STATE: granted=true
android.permission.ACCESS_WIFI_STATE: granted=true

No internet connection - Android Firebase Flutter RTD

When building an .apk of my flutter app and installing on my android device the data created is only locally saved not saved online. When using in the android emulator it works perfectly with no errors, even when switching the signing configs to use debug.
There are no firebase rules set, everyone can read and write. There is no fingerprint/sha1 hash set. All android settings have stayed the same since the build version has worked on android correctly.
If there is anything code etc. i can give please ask, not sure what is helpful here as all settings were the same when it was working.
You have not granted internet permission to access the application
Open the AndroidManifest.xml file located at ./android/app/src/main and add the following line:
<manifest xmlns:android="...">
<uses-permission android:name="android.permission.INTERNET"/> <!-- Add this -->
</manifest>
Refer here

Can a Phonegap app run with out NETWORK permission

I had develop an app which is not using any Internet settings and not accessing network state in phonegap version 1.7 but the app is not running with our using below permission
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
in the manifest
if you have tried searching you might got your answer a bit earlier than this
Are all those permissions needed by PhoneGap on Android?

Android application using phone gap

I successfully completed my application in android and is running in real device and simulator .My app requires internet access hence given access in manifest.xml file.
The code is like this:
uses-permission android:name="android.permission.INTERNET" />
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Now the problem is my app is running only when the wifi is ON but not running through the internet connection in mobile. I have to run the application with out wifi in my device.
I am using Apache 2.2.0 version. okay, no problem my issue is solved I added code lane super.setIntegerProperty("loadUrlTimeoutValue", 100000); and now it's running.

Is it possible to upgrade Android firmware programatically?

I need to write Android application which looks for firmware in internet and allows to automatically download selected firmware and perform update on device. Is it possible?
Thanks
It should be possible. I am trying to do the same thing. I posted a question about this as another user. It almost works for me, but my device can't apply the new image on boot time.
Basically you use the RecoverySystem.installPackage(context, packageFile) method to do this. You will also need the following permissions:
<uses-permission android:name="android.permission.REBOOT" />
<uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM" />
<uses-permission android:name="android.permission.DELETE_CACHE_FILES" />
Also, your app must run as a system app. I don't know if you're using the whole Android SDK with Eclipse and the SDK tools, but what I did for that was basically connect my device to my machine and used it for debuggin, then ran the app through the IDE so it gets uploaded and run on the device. And finally use the adb shell command to open up a shell on my device and moved the apk package file from /data/app to /system/app and rebooted.
Check out my post here. It might help you out.
Android development RecoverySystem.installPackage() cannot write to /cache/recovery/command permission denied
You need root, and it won't be automatically applied, but like with cyanogen updater, it reboots to recovery where the user will apply the update by itself
It is possible. Take a look at Clockwork Mod - http://www.clockworkmod.com/rommanager
They have an app which will check for the latest version of the firmware and update it - available on Google Marketplace https://market.android.com/details?id=com.koushikdutta.rommanager&hl=en

Categories

Resources