Ionic InAppBrowser issue - android

I have an Ionic App where I use AR.js and i have access to the camera. The web version works fine. I build an Android version with capacitor and I use InAppBrowser to access the site where i host the web app. But when i try to run the AR inside of the inappbrowser, I get an error of 'Permission denied' and it won't work. I've tried the plugin 'AndroidPermissions' as well as adding <use-permission> in the AndroidManifest.xml but still nothing. Any help would be appreciated!

Related

Ionic Webpage error after Android apk

I just started Learnig Ionic and after a successful deploy of myapp (generate apk and install in my phone), i still get a web page error on my android device 'Could not connect to server (http://localhost:8080/)'
I believe the app should be offline because i haven't used any web service. check out the error here
The url http://localhost:8080/ would only work on the emulator but not on an actual android device.
Find the method webview.loadUrl() most likely on the MainActivity.java and change to something like webview.loadurl("file:///android_asset/www/index.html") instead of webview.loadurl("http://localhost:8080/");
Your app is offline.
A plugin that all Ionic apps have been using for ages, cordova-plugin-ionic-webview, released a new version 2.x on July 23rd 2018. This added a webserver into the Android app that is used to deliver your app files to the webview displaying your app. It runs on localhost:8080.
Unfortunately version 2 of cordova-plugin-ionic-webview does not support Android 4.x any more which you seem to be using. This is the eason why you are getting that error message.
You can probably fix your problem by downgrading to the last version of the plugin that supported Android 4.x:
ionic cordova plugin add cordova-plugin-ionic-webview#1.2.1
More elaborate information and alternative solutions:
https://ionic.zone/debug/ionic-and-android-4

ionic2 API Call issue

I am working on an Android application using Ionic framework version 2. The app makes an http request to an url, gets the json and displayes the data on the screen. Its a very simple and basic application. With CORS plugin on my chrome, things went smooth. But once i build the apk and run on the device, it doesn't seem to work. I have followed all the suggestions provided in various URL's for the cordova whitelist plugin. But nothing seem to resolve my issue and it is very annoying. Things i did on my end
Step1:
cordova plugin add cordova-plugin-whitelist
Step2:
cordova prepare
config.xml
index.html
While executing the step 1, i got an error unexpected token. But i could see the plugin files are added in the project. Could that be a proble?
In the App Debug log i see this -
SystemWebViewClient: URL blocked by whitelist: http://.com

ionic android build succeeded but app stopped working

When I am trying to run app on android device using ionic run android, it is showing the build and launch as successful.
On device, it is showing
app_name stopped working
I searched a lot and tried installing plugins again, not working. I'm not using ionic-keyboard plugin. Any help would be appreciated.
UPDATE: When I'm using ionic serve --lab, it is showing perfectly on browser with some of the plugins not working because browser doesn't support all the cordova plugins. That's fine.
ionic platform add android shows at the end
saving platform to package.json file
believe something to do with ionic-keyboard. can you try installing keyboard plugin once and checking the app if it works or not. Thus we will have some RCA.
Can't run Ionic on Android: class not found exception IonicKeyboard

Ionic Android apk no access to internet

I'm building an app for Android with Ionic/Cordova. The app works fine in the emulator and works fine in the Ionic view app.
The app connects to an API in our internal network and everything works fine.
The problem is, when I build the cordova app to Android and install the apk, it doesn't connect to the internet. I can't seem to find what the problem is and why it is not connecting, even though it does work in the emulator and Ionic view.
Does anyone know what the problem would be and why it doesn't work?
It seems I had to install the Ionic whitelist plugin: http://docs.ionic.io/docs/cordova-whitelist
Now it is working! Thanks for your help guys
This plugin saved my time:
cordova plugin add cordova-plugin-whitelist

Getting gap_init on new apache cordova install when viewing android app in browser

I just recently installed apache cordova and am trying to get it up and running properly. I'm using a macbook pro running 10.9.5. My android SDK is the latest (22, but android target build uses 21). The cordova version is the latest as well (4.3). This issue occurs with any example app that I've tried, including the basic app/page that gets installed when you create a new cordova project (i.e. cordova create...).
For the most part, everything seems to be working ok, with one exception. When I try to view the android version of the test app in a browser (any browser - tried chrome, firefox, safari), I get various prompts that show up on the init/load of the app. The first prompt window to popup up says "gap_init:2", which is generated from the androidExec function in the cordova.js file:
androidExec.init = function() {
bridgeSecret = +prompt('', 'gap_init:' + nativeToJsBridgeMode);
channel.onNativeReady.fire();
};
If I cancel thru these prompts (there are 3 prompt windows), then the app seems to load ok. If I 'ok' thru these prompts, then the app gets into an infinite cycle of processing empty messages, and I have to kill the browser processes to stop it.
The iOS version of the app loads fine in every browser. I've tried changing the android target to version 19, but the prompts still occur. There are no error messages during the build process.
Does anyone have any insight into what might be causing this? How is this prompt message supposed to be caught/handled?
Its simple, from visual studio, on running, it opens web pages for Android /iOS environment, you would have tried to cut-short the url to open for web version, this is when you will get dialog's as you mentioned.
To overcome this problem map the www folder to your local iis / iis express and open the url, page will open without any error.
This error you get when you use the following command directly as follows:
ionic serve
and then followed by
ionic cordova build android --prod --release
I SUGGEST TO FOLLOW THIS METHOD, IF YOU WANT TO RUN THE APP IN BROWSER
ionic serve
ionic build
ionic build --prod
This way you get www folder where you can upload to server and check the whole app in browser directly

Categories

Resources