Disclaimer: this looks incredibly the same as Ionic Native HTTP does not work for Anroid 9 (Pie) and up? but it isn't!
We are facing an incredibly strange and hard problem after updating our app today.
We are mantaining an Ionic v1 app for Android. It uses Cordova-Android 7. Today when we were uploading a new update to the play store we found a restriction forcing us to target SDK starting from 28. We added <preference name="android-targetSdkVersion" value="28" /> to the config.xml file, re-built the app, tested on some smartphones and uploaded it. After distribution, we found that all network communication is failing on Android 9 devices. We were sure that this would be the popular cleartext error, so we changed all URLs to HTTPS. But the problem persisted. Then we build the app again but with the debuggable attribute on the manifest so we could inspect the app and see the errors, and we discovered that if we switch the debuggable feature on, the error doesn't happen - we are just adding it to the manifest, we are still building with the --release flag.
So, the final scenario is:
http requests fail only after targeting SDK 28, only on Android 9 devices, and only if the app is built with --release flag and we don't put the debuggable attribute on the manifest
if we change any point above error disappears so no way to debug
app is using https on all requests
when the app fails, requests don't reach the server, we already watched at that
So what the hell may be failing here?
Finally it seemed to be a somewhat kind of cleartext error teorically out of any specification. Our discovery was that adding
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
to the android platform tag on the config.xml file solved the problem. So we can assure that on our Ionic 1 + Cordova-Android 7 + Cordova CLI 8 + Ionic CLI 4 + HTTPS + non debuggable production build scenario, HTTPS requests were interpreted as cleartext requests and thus blocked until we statedly allowed them.
Related
I am using Ionic 4 from android version 9 api/webservices are not working. Even i change the config.xml edit-config file
And also changes done
domain-config cleartextTrafficPermitted="false" but not working
Android 8+ are now forced to use https requests for security reasons. Check that your link is https, and if it didn't work then for sure the problem is from your request and you don't have to change any thing in config or anywhere place, just change tour api from http to https.
I don't know if I ask this in the right place. I Ask it on global furum but didn't get any response.
I have an app that run well on an droid. I want to build it on UWP as well. I have been able to build the app and make it run but some plug-in that use native resource do not work.
For one, native storage,
the second I notice by now is network resource (HTTP request and websocket client).
Those was working well under android. e.i.:
getData(): Observable<AlarmData> {
return this.http.get<AlarmData>(this.server.url() + '/ajax_alarms');
}
I have seen that UWP need some certificate, I found in my app at least one related to network:
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
But I have not found if and how should I add more...
I tested it on a windows10 machine,
ionic 4.0.6
Take a look on MS own sample:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/HttpClient
You have to allow the app to use a resource before you have access.
I'm using ionic v1 for a project and I have some compatibility issues.
I must deliver on Android KitKat OS (on a tablet) an application and many things don't work on KK but work on browsers on my PC.
For example https://awe.media/static/drawimage/minimal.html I've simply tried to use this code to do some tests (it works on my PC's browsers).
- I adapted the code to ionic v1 to make it work on my PC's browser
- Once it works I build the APK and install the APK on my emulator KK + KK real device and it doesn't work anymore.
PS: I've tried with and without Crosswalk
I come to think that maybe it's a build issue.
Any idea?
Thanks for reading.
I think you need to check in yourprojectname\platforms\android\AndroidManifest.xml
First check your android:minSdkVersion and android:targetSdkVersion:
You can replace it with this line if its diffrent from this:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
I'm trying to authorize app-users via google in an ionic app based on angularfire. The complete flow is working fine on my workstation's chrome browser (using ionic serve) but fails when deploying on my android device:
$authWithOAuthPopup, when used on Android (via 'ionic run', i.e. installed as apk) results in browser getting stuck in auth.firebase.com/blank/page.html.
All is working fine in html (via 'ionic serve') so I assume, that firebase and google configuration are fine. cordova.js is included properly.
The cordova inapp browser is installed and can open other urls. I have whitelisted firebase(io) and google domains and also allowed everything else. I am using cordova-plugin-inappbrowser 1.0.2-dev "InAppBrowser" and
cordova-plugin-whitelist 1.0.0 "Whitelist". I have tried older versions of the inappbrowser as well.
I am not using ionic livereload to avoid any potential cross-domain/proxy issues
When remote debugging, no errors are being reported: after $authWithOAuthPopup control gets lost somewhere deep in the minified firebase.js code and never returns to angularfire level
The following traffic is generated (detailed urls below):
1) firebase code calls auth.firebase.com/v2//auth/google, 2) accounts.google.com returns to 3)auth.firebase.com/v2.... which transfers to 4) auth.firebase.com/blank/page.html.
On the blank page I can see cookies.
Thanks for any advice in advance...
Detailed URLs from the webflow:
Initiator: firebase.js:147:
https: //auth.firebase.com/v2/gastrohub/auth/google?&v=js-2.2.6&transport=redirect&suppress_status_codes=true&requestId=p2k757pm4hsjv5531z7045voxcyuelsi0wt3&redirectTo=https%3A%2F%2Fauth.firebase.com%2Fblank%2Fpage.html
https: //accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=https%3A%2F%2Fauth.firebase.com%2Fv2%2Fgastrohub%2Fauth%2Fgoogle%2Fcallback&scope=%20profile&state=%7B%22firebase%22%3A%22gastrohub%22%2C%22requestId%22%3A%22p2k757pm4hsjv5531z7045voxcyuelsi0wt3%22%2C%22redirectTo%22%3A%22https%3A%2F%2Fauth.firebase.com%2Fblank%2Fpage.html%22%2C%22transport%22%3A%22redirect%22%2C%22v%22%3A%22js-2.2.6%22%7D&client_id=434498505800-p5rjvl6basvlsf4fh3t1ta9ej4pt2i28.apps.googleusercontent.com
https: //auth.firebase.com/v2/gastrohub/auth/google/callback?state=%7B%22firebase%22:%22gastrohub%22,%22requestId%22:%22p2k757pm4hsjv5531z7045voxcyuelsi0wt3%22,%22redirectTo%22:%22https://auth.firebase.com/blank/page.html%22,%22transport%22:%22redirect%22,%22v%22:%22js-2.2.6%22%7D&code=4/vgz4uJ8SgIswewKQHcMiXZbwddU_F9llfWKaRfEhOMI
https: //auth.firebase.com/blank/page.html
I develop on an.. let's say: not ultramodern computer, and were doing fine so far developing with the emulator for API version 8. Now I try to use Admob (after meddling with "Adsense for Mobile Apps" which never displayed any ads for some reason), but it turns out that I need an API target of 13 to use it.
Is there any way to get it to run with 8?
In my Manifest file, I have defined
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
already. After my investigations and the tips I have read so far, I tried the 'reduced' set for the Android Manifest,
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
but running it on the v8 emulator produces a number of exceptions basically complaining that the required configChanges are not set.
I have read about a 'trick' of using an older Admob SDK, but also the warning of Google that from end of 2011, they won't display ads anymore and the new version must be used.
The worst thing is that I can't even run my own app on my connected mobile phone (HTC Legend, v2.3.7 / API 10) if I want to use Admob?!
Or maybe I am missing something, am quite frustrated right now.
There is a way. Check out this blog post, which applies to AdMob SDK 6.0 as well.
The TL;DR:
Set target in project.properties to android-13 or higher. You need the full set of configurations:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
As long as minSdkVersion is 8, you can still run on Android 2.2.