I posted a question about this a couple weeks ago but got no response. So Im posting again with a clearer issue/question.
My issue:
1.) I run:
$ ionic cordova build android --release --prod
2.) Then I sign it.
3.) Then I upload to google play.
4.) Then I download it from google play and the app hits the splash screen, then gets stuck on a white screen after the splash screen closes on lower versions of android (So far anything under version 6.0.0).
To verify that it is my app that is the issue, I created a new app through the ionic cli using the "super" template. Then I built, signed, and uploaded it all the exact same way. I downloaded it from google play, and it worked. I made it into the app, including versions lower then 6.0.0.
So, my question is
How do I see what is causing the issue if it only happens in a release/production build?
Is there a way to debug?
Are there known functions (pipes, masks, modules, etc...) that angular/ionic uses that don't work in older browsers found in older versions of android that could be causing this?
Project information:
#ionic/cli-plugin-cordova : 1.6.1
#ionic/cli-plugin-ionic-angular : 1.4.1
#ionic/cli-utils : 1.7.0
ionic (Ionic CLI) : 3.7.0
global packages:
Cordova CLI : 7.0.1
local packages:
#ionic/app-scripts : 2.1.3
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.6.0
System:
Node : v6.11.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
npm : 3.10.10
Config file:
<preference name="android-minSdkVersion" value="16" /> // This is the same as the default value generated by ionic-cli
// I use the hide() function in platform.ready() of my app.component to hide the splash screen. Did the same in the test generated app. Shouldnt be the issue.
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="500" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="30000" /> // Arbitrary time. platform.ready() should be called way before this.
<preference name="loadUrlTimeoutValue" value="700000" /> // Added this because it was recommended for larger app sizes..?
My Plugins (I saw that someone else had a similar issue caused by a module import..?):
<plugin name="cordova-plugin-console" spec="^1.0.5" />
<plugin name="cordova-plugin-contacts" spec="^2.3.1" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-fingerprint-aio" spec="^1.2.1" />
<plugin name="cordova-plugin-geolocation" spec="^2.4.3">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value=" " />
</plugin>
<plugin name="cordova-plugin-googlemaps" spec="^1.4.3">
<variable name="API_KEY_FOR_ANDROID" value="AIzaSyBbYqJI-CZfV8_Zmj3laEGMbHsQenYo3V4" />
<variable name="API_KEY_FOR_IOS" value="AIzaSyBbYqJI-CZfV8_Zmj3laEGMbHsQenYo3V4" />
<variable name="NSLOCATIONWHENINUSEUSAGEDESCRIPTION" value="Show your location on the map" />
<variable name="NSLOCATIONALWAYSUSAGEDESCRIPTION" value="Trace your location on the map" />
</plugin>
<plugin name="cordova-plugin-http" spec="^1.2.0" />
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-nativegeocoder" spec="^1.0.2" />
<plugin name="cordova-plugin-nativestorage" spec="^2.2.2" />
<plugin name="cordova-plugin-screen-orientation" spec="^1.4.3" />
<plugin name="cordova-plugin-secure-storage" spec="^2.6.8" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="cordova-sqlite-storage" spec="^2.0.4" />
<plugin name="ionic-plugin-deploy" spec="^0.6.7" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^3.2.2" />
I ended up removing android and iOS platforms, reinstalling them, and installing crosswalk again. Not 100% sure if it was crosswalk that fixed it It could have been some small code change I made.
Generally, when the loading screen is infinite, it's an issue with your code.
Related
I am developing (and near to the release) of a Cordova App for iOS and Android.
I am trying to use cordova-plugin-ionic-webview in order to use the latest WebView engines.
I am able to use this plugin on iOS but on Android the App crashes on launch.
MY CONFIG.XML:
<allow-navigation href="cordovaios://*" />
<allow-navigation href="cordovaandroid://*" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<preference name="Hostname" value="my-backend-url-to-avoid-CORS.com" />
<preference name="iosScheme" value="cordovaios" />
<preference name="Scheme" value="cordovaandroid" />
<preference name="ScrollEnabled" value="true" />
<preference name="MixedContentMode" value="0" />
<preference name="AllowBackForwardNavigationGestures" value="true" />
<preference name="Allow3DTouchLinkPreview" value="false" />
<preference name="WKSuspendInBackground" value="false" />
<preference name="KeyboardAppearanceDark" value="false" />
LOGS:
5726-5770/mycertificate.enterprise D/SERVER: Handling local request: cordovaandroid://my-backend-url-to-avoid-CORS.com/static/js/10.601e7973.chunk.js
5726-5773/mycertificate.enterprise E/chromium: [ERROR:render_process_host_impl.cc(4070)] Terminating render process for bad Mojo message: Received bad user message: Origin is invalid
5726-5773/mycertificate.enterprise E/chromium: [ERROR:bad_message.cc(23)] Terminating renderer for bad IPC message, reason 123
NOTE:
This config works fine on iOS. On Android I can't use this plugin due to this Hostname/Origin issue.
That custom scheme does not appear to be supported (just try to find something alike that in the source code). It is also beyond my understanding, for what one even would even need to register a custom protocol handler, while never leaving that WebView? The usual purpose is: to open another application.
<preference name="Scheme" value="https" />
<allow-navigation href="https://my-backend-url-to-avoid-CORS.com/*"/>
Unfortunately there is a lot of mismatching between the Cordova Android Platform version and plugins versions, which lead to some waste of time for nothing. Said so, for similar problemas I had like this I simply fixed them downgrading the version of Cordova or Android or the Plugin (or use the same version of android the plugin is using in their code example).
I am trying to build an offline app using cordova, I am using the sqlite plugin for storage. In my config.xml file i have added an entry, but when i build apk i am getting the error Error - The following plugin, plugin version or a dependancy of this plugin is not on npm: SQLitePlugin
how can i resolve this?
here is my config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.plusminus.example"
versionCode = "10"
version = "1.0.0" >
<preference name="orientation" value="portrait" />
<name>DAPP</name>
<gap:plugin name="org.apache.cordova.camera" source="npm" />
<gap:plugin name="org.apache.cordova.device" source="npm" />
<gap:plugin name="cordova-plugin-whitelist" source="npm" />
<gap:plugin name="SQLitePlugin" value="io.liteglue.SQLitePlugin"/>
<author href="https://build.phonegap.com" email="aadd#xxxxxx.com">
xxxxxxxx
</author>
<icon src="/lib/images/AppIcon.png" />
<gap:platform name="android" />
<access origin="*" />
</widget>
I think you have to installed sqlite plugin via CLI.
Installed plugin by Just Open command prompt and go to your project path and install plugin using CLI
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin.git
For more helps to check here & If you want add the customized plugin used plugman for that please look to here..
Hopes this will help you !!.
I have something like this in my cordova app
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
window.location.href = 'https://mobile.xxx.com';
}
Now I need to use webRTC in this website. And works fine when I run it in mobile browser (chrome 54.0.2840.85).
However, when I use the apk, the webview will not load the webRTC features like camera or micro.
So, in mobile browser it works fine, in webview the rtc will not work.
This is what I have in config.xml
<content src="index.html" />
<access origin="https://mobile.xxx.com" />
<allow-navigation href="https://mobile.xxx.com" />
<allow-intent href="https://mobile.xxx.com" />
<plugin name="cordova-plugin-network-information" version="1.3.0" source="npm" />
<plugin name="cordova-plugin-splashscreen" version="4.0.0" source="npm" />
<plugin name="cordova-plugin-whitelist" version="1.3.0" source="npm" />
<plugin name="cordova-plugin-dialogs" version="1.3.0" source="npm" />
<plugin name="cordova-plugin-statusbar" version="2.2.0" source="npm" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="phonegap-version" value="cli-6.3.0" />
<preference name="permissions" value="none"/>
<preference name="target-device" value="universal"/>
<preference name="fullscreen" value="true"/>
<preference name="show-splash-screen-spinner" value="true" />
<preference name="stay-in-webview" value="true" />
<preference name="orientation" value="portrait" />
<preference name="loadUrlTimeoutValue" value="700000" />
Already tried crosswalk but same problem. How can I have webrtc in cordova webview?
To clarify, I am just looking for a functional demo.
I'm not sure what WebRTC specific features you're using but it isn't fully supported yet for most mobile browsers. See here.
As far as I understood from https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Taking_still_photos , to access media we are supposed to make navigator.mediaDevices.getUserMedia
Similarly for mobile app, you will have to specify the permissions in config.xml related to camera or microphone that you are using.
For media access
<plugin name="cordova-plugin-media-capture" spec="1.4.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="To take videos"/>
<variable name="MICROPHONE_USAGE_DESCRIPTION" value="To record voice while taking videos"/>
<variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="To provide photo browsing."/>
</plugin>
For camera access
<plugin name="cordova-plugin-camera" spec="2.3.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="To take photos"/>
</plugin>
For more details of using the above plugins in mobile app, refer :
https://github.com/apache/cordova-plugin-camera
https://github.com/apache/cordova-plugin-media-capture
I'm having issues trying to schedule local notifications on an Android app (using PhoneGap build).
I'm trying to schedule a local notification at a set date and time (e.g. September 23rd 2016 at 12:00pm).
I've tried using the following plugin:
https://build.phonegap.com/plugins/2081
My config.xml file looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id = "****"
versionCode = "292000"
version = "2.9.2" >
<gap:config-file platform="android" parent="/manifest">
<application android:debuggable="true" />
</gap:config-file>
<!-- versionCode is optional and Android only -->
<name>****</name>
<description>
****
</description>
<author href="****" email="****">
****
</author>
<icon src="icon.png" />
<allow-navigation href="*" />
<access origin="*" />
<preference name="phonegap-version" value="cli-5.2.0" />
<preference name="android-minSdkVersion" value="14" />
<preference name="android-targetSdkVersion" value="23"/>
<gap:plugin name='cordova-plugin-whitelist' source='npm' />
<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.1" source="pgb" />
</widget>
I then schedule the notification using the code below:
cordova.plugins.notification.local.schedule({
title: $title,
text: $message,
at: $date
});
When building for the latest PhoneGap version (cli-6.3.0), I get the following error on the build.phonegap.com site:
Error - Some official plugins have to be updated if using PhoneGap >= 4.0.0. Please upgrade the version of any plugins that may include the following file: LocalNotification.java
It seems that the plugin has not been updated for the latest version of PhoneGap causing the build to fail.
I've tried building for the latest supported version of the plugin (PhoneGap 3.7.0). The build completes successfully and when installed directly on an Android device, everything works correctly. The notifications fire as scheduled.
However, when trying to submit this build to the Google Play store, the build is rejected with the following error:
Your APK has been rejected for containing security vulnerabilities, which violates the Malicious Behavior policy. The Alerts page has more information about how to resolve the issue. If you submitted an update, the previous version of your app is still live on Google Play.
The build now needs to use v4.1.1 of Apache Cordova to be accepted by the Google Play .
I've looked around but can't find a solution anywhere. Is anyone aware of a fix, or alternatively, a different plugin that allows scheduling of local notifications on Android supporting Apache Cordova v4.1.1 or above?
Change
<gap:plugin name='cordova-plugin-whitelist' source='npm' />
<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.1" source="pgb" />
to
<plugin name='cordova-plugin-whitelist' source='npm' />
<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.4" source="npm" />
I have fixed myself.
Changing the plugin name will work.
We need to find an appropriate plugin and replace older version in config.xml.
In my case, I have changed
<plugin name="de.appplant.cordova.plugin.local-notification" spec="0.8.4" source="pgb" />
to
<gap:plugin name="trunk.plugin.local-notification" />
Environment: This is the only cross-platform app I've worked on. I did not build it. It's about 5 years old. Targets: Android 4.4 and above, iOS is not limited. I'm developing on a Mac, using Phonegap Build- specifically 3.7.0. I am getting this error on my Android emulator- API 23 and 19.
I am trying to access imageURI to check for file size. My FileTransfer limit is about 10 mb. Here is my code for that:
resolveLocalFileSystemURI(this.pageContainer.items.items[0].imageURI, function(fileEntry){
fileEntry.file(function(fileObj){
if (maxSize <= fileObj.size){
Ext.Msg.alert("Error", "Chosen image is too large. Submit a different image.");
return;
}
else {
Ext.Msg.alert("You are here:", "file size accepted "+ fileObj.size);
}
})
})
Problem is that it's unable to get down past resolveLocalFileSystemURI. The adb log says:
E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading
com.android.externalstorage.ExternalStorageProvider uri
content://com.android.externalstorage.documents/document/1A03-
3B0B%3ADCIM/Camera/elevation.jpg from pid=2921, uid=10080 requires
android.permission.MANAGE_DOCUMENTS, or grantUriPermission()
I know that you can add this permission to AndroidManifest, and go from there, but I am actually just using the PhoneGap build 3.7.0. I have to edit config.xml, which is currently using these settings:
<plugin name="org.apache.cordova.camera" source="pgb" spec="0.3.2" />
<plugin name="org.apache.cordova.device" source="pgb" spec="0.2.12" />
<plugin name="org.apache.cordova.file" source="pgb" spec="1.3.3" />
<plugin name="org.apache.cordova.file-transfer" source="pgb" spec="0.5.0" />
<plugin name="org.apache.cordova.geolocation" source="pgb" spec="0.3.10" />
<plugin name="org.apache.cordova.network-information" source="pgb"
spec="0.2.12" />
<preference name="phonegap-version" value="3.7.0" />
<preference name="android-minSdkVersion" value="19" />
<preference name="orientation" value="portrait" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="prerendered-icon" value="false" />
<feature name="http://api.phonegap.com/1.0/network" />
<feature name="http://api.phonegap.com/1.0/camera" />
<feature name="http://api.phonegap.com/1.0/geolocation" />
<feature name="http://api.phonegap.com/1.0/media" />
<feature name="http://api.phonegap.com/1.0/contacts" />
<feature name="http://api.phonegap.com/1.0/file" />
<feature name="http://api.phonegap.com/1.0/device" />
Previously, I did not include the <feature>, but in an attempt to remidiate added it to my config.xml which resulted in no change in behavior. What do I need to add to my config.xml to do the same as MANAGE_DOCUMENTS?
The solution for this was to upgrade my PhoneGap Build version to cli-5.2.0 (among other versions, I'm sure). My build was too old to support granting Android access to the file when coupled with my Android target of 19+.