I am creating a login screen in Ionic. The problem is that when I click on the input field to open the Keyboard, it's not opening.
Then I click outside on the input field and then click on the input field then the keyboard is visible OR I click on the input fields 3 to 4 times and after that the Keyboard is visible.
I want to open the keyboard when I click on the input field for the first time. I've implemented the focusing code but it is not working. Does anyone have any suggestions?
Here is the code
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example" version="1.0.21" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>App Name </name>
<description>App Name</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashScreenDelay" value="0" />
<preference name="loadUrlTimeoutValue" value="60000" />
<preference name="android-windowSoftInputMode" value="adjustResize" />
<preference name="SplashScreen" value="screen" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="FadeSplashScreen" value="true" />
<preference name="UseSwiftLanguageVersion" value="4.2" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-targetSdkVersion" value="28" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
</platform>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
<string>To scan barcodes</string>
</edit-config>
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-device" spec="1.1.4" />
<plugin name="cordova-plugin-statusbar" spec="2.2.2" />
<plugin name="cordova-plugin-sslcertificatechecker" spec="5.1.0" />
<plugin name="cordova-plugin-certificates" spec="^0.6.4" />
<plugin name="cordova-plugin-http" spec="1.2.0" />
<plugin name="cordova-plugin-file" spec="^6.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.0" />
<plugin name="cordova-plugin-ionic" spec="^2.0.4">
<variable name="APP_ID" value="e363211c" />
<variable name="CHANNEL_NAME" value="Production" />
<variable name="UPDATE_METHOD" value="background" />
<variable name="UPDATE_API" value="https://api.ionicjs.com" />
<variable name="MAX_STORE" value="2" />
</plugin>
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.0" />
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-datepicker" spec="0.9.3" />
<allow-navigation href="http://192.168.2.26:8100" />
<engine name="ios" spec="5.0.0" />
<engine name="android" spec="6.3.0" />
<engine name="browser" spec="5.0.4" />
</widget>
Package.json
{
"name": "App Name ",
"version": "1.0.21",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"preinstall": "./cordovaOverride.sh",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build --prod",
"lint": "ionic-app-scripts lint",
"ionic:serve": "ionic-app-scripts serve"
},
"config": {
"ionic_source_map": "source_map"
},
"dependencies": {
"#angular/common": "4.1.3",
"#angular/compiler": "4.1.3",
"#angular/compiler-cli": "4.1.3",
"#angular/core": "4.1.3",
"#angular/forms": "4.1.3",
"#angular/http": "4.1.3",
"#angular/platform-browser": "4.1.3",
"#angular/platform-browser-dynamic": "4.1.3",
"#ionic-native/app-preferences": "4.7.0",
"#ionic-native/barcode-scanner": "4.7.0",
"#ionic-native/core": "4.7.0",
"#ionic-native/date-picker": "4.7.0",
"#ionic-native/file": "4.7.0",
"#ionic-native/printer": "4.7.0",
"#ionic-native/social-sharing": "4.7.0",
"#ionic-native/splash-screen": "4.7.0",
"#ionic-native/sqlite": "4.7.0",
"#ionic-native/status-bar": "4.7.0",
"#ionic/pro": "1.0.16",
"#ionic/storage": "2.1.3",
"#zxing/library": "0.5.0",
"amazon-cognito-identity-js": "1.26.0",
"angular2-signaturepad": "2.6.1",
"aws-sdk": "2.156.0",
"cordova-android": "6.3.0",
"cordova-browser": "5.0.4",
"cordova-ios": "5.0.0",
"cordova-pdf-generator": "^2.0.8",
"cordova-plugin-add-swift-support": "^1.7.2",
"cordova-plugin-android-permissions": "^1.0.2",
"cordova-plugin-barcodescanner-browser-support": "7.1.22",
"cordova-plugin-certificates": "^0.6.4",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-http": "^1.2.0",
"cordova-plugin-ionic": "^2.0.4",
"cordova-plugin-printer": "^0.7.3",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-sslcertificatechecker": "^5.1.0",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "^5.6.2",
"es6-promise-plugin": "^4.2.2",
"eslint-plugin-html": "2.0.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"moment": "^2.24.0",
"node-sass": "^4.9.4",
"phonegap-plugin-barcodescanner": "^7.1.2",
"rxjs": "5.4.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.3",
"#types/node": "8.5.1",
"json-loader": "0.5.7",
"typescript": "2.3.4",
"webpack": "3.8.1"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-sslcertificatechecker": {},
"cordova-plugin-certificates": {},
"cordova-plugin-http": {},
"cordova-plugin-file": {},
"cordova-pdf-generator": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic": {
"APP_ID": "e363211c",
"CHANNEL_NAME": "Production",
"UPDATE_METHOD": "background",
"UPDATE_API": "https://api.ionicjs.com",
"MAX_STORE": "2"
},
"ionic-plugin-keyboard": {},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-plugin-printer": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-whitelist": {},
"cordova-plugin-datepicker": {}
},
"platforms": [
"ios",
"android",
"browser"
]
}
}
login.html
<!-- Page content inputs -->
<ion-content padding class="background">
<ion-list>
<!-- logo on top of page -->
<ion-item no-lines justify-content-center align-items-center>
<ion-row justify-content-center align-items-center>
<ion-col>
<div style="text-align: center">
<img align='center' src="assets/icon/logo.png" height="140px" width="180px">
</div>
</ion-col>
</ion-row>
</ion-item>
<ion-item no-lines
style="height:40px; user-select: auto; padding-right:16px;border-style: solid; border-width: 1px;border-radius:3px;border-color: #E3e3e3">
<ion-label color="dark" item-left>
<ion-icon name="md-mail"></ion-icon>
</ion-label>
<ion-input style="user-select: auto" class="text_style" type="email" placeholder="Email"
[(ngModel)]="userEmail" name="userEmail"></ion-input>
</ion-item>
<!-- Password Field with show/hide option controls-->
<ion-item no-lines
style=" user-select: auto; padding-right:16px; border-style: solid; border-width: 1px;border-radius:3px;border-color: #E3e3e3">
<ion-label color="dark" item-left>
<ion-icon name="md-lock"></ion-icon>
</ion-label>
<ion-input style="user-select: auto" class="ion-input" [(ngModel)]="password" type="{{type}}"
placeholder="Password" name="password"></ion-input>
<button class="ion-input-button" *ngIf="!showPass" ion-button clear color="dark" type="button" item-right
(click)="showPassword()">
<ion-icon name="md-eye-off"></ion-icon>
</button>
<button class="ion-input-button" *ngIf="showPass" ion-button clear color="dark" type="button" item-right
(click)="showPassword()">
<ion-icon name="md-eye"></ion-icon>
</button>
</ion-item>
<!--Forgot Password Link -->
<ion-row>
<ion-col>
<!-- <ion-item> -->
<ion-row>
<ion-checkbox [(ngModel)]="rememberLogin" (ionChange)="keepMeLogin()"
style="margin-top:13px; margin-right:5px; margin-left:16px"></ion-checkbox>
<ion-label style="text-align:left; font-size: 12px; padding-top:4px">Remember Me</ion-label>
</ion-row>
</ion-col>
<ion-col>
<button ion-button clear color="button-color" style="text-align:right; font-size: 12px"
(click)="forgotPassword()" float-right>Forgot Password
</button>
</ion-col>
</ion-row>
<!--Login Button -->
<button style="height:48px" ion-button full color="button-color" (click)="onLogin()">Log in</button>
</ion-list>
<!-- </ion-card-content>
</ion-card> -->
<!-- Create New Account Link -->
</ion-content>
<!--End content -->
Related
I'd like to ask for some help with an Android issue my team is having with our Signed Build (.apk/.aab).
TL/DR:
The issue is that when we run our app locally un debug mode using ionic serve or Android Studio, we are able to login fine. But when we "Generate a Signed Bundle/APK" the app via a java keystone, we are unable to login. It seem the login process cannot find the AuthToken on the phone, and so just quits.
Details:
We have a mobile app built using ionic 5/Angular 8. We are using the AuthConnect Enterprise plugin as well ("#ionic-enterprise/auth": "^3.9.2").
We are using Android studio (2021.1 Patch 1).
Package.json (Below)
{
"name": "xxx",
"description": "xxx xxxxxxxx Mobile Version",
"version": "0.0.2",
"author": "support#xxxx.app",
"homepage": "https://www.xxxx.app",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "npx jetifier"
},
"private": true,
"dependencies": {
"#angular/common": "~8.2.14",
"#angular/core": "~8.2.14",
"#angular/fire": "^5.4.2",
"#angular/forms": "~8.2.14",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"#googlemaps/js-api-loader": "^1.12.9",
"#ionic-enterprise/auth": "^3.9.2",
"#ionic-enterprise/camera": "^6.0.0",
"#ionic-enterprise/geolocation": "^4.1.0",
"#ionic-enterprise/inappbrowser": "^5.0.1",
"#ionic-native/camera": "^5.36.0",
"#ionic-native/core": "^5.25.0",
"#ionic-native/document-viewer": "^5.31.1",
"#ionic-native/file": "^5.25.0",
"#ionic-native/file-opener": "^5.25.0",
"#ionic-native/geolocation": "^5.36.0",
"#ionic-native/google-analytics": "^5.25.0",
"#ionic-native/google-maps": "^5.5.0",
"#ionic-native/http": "^5.27.0",
"#ionic-native/local-notifications": "^5.36.0",
"#ionic-native/native-geocoder": "^5.36.0",
"#ionic-native/network": "^5.36.0",
"#ionic-native/open-native-settings": "^5.36.0",
"#ionic-native/splash-screen": "^5.25.0",
"#ionic-native/status-bar": "^5.25.0",
"#ionic/angular": "^5.1.0",
"#ionic/storage": "^2.3.1",
"#types/google.maps": "^3.46.1",
"capacitor-pdf-viewer-plugin": "^1.0.0",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-advanced-http": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-buildinfo": "^4.0.0",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-document-viewer": "^1.0.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-google-analytics": "^1.9.0",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-nativegeocoder": "^3.4.1",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2",
"cordova-sqlite-storage": "^6.0.0",
"core-js": "^2.5.4",
"d3-hierarchy": "^1.1.9",
"file": "^0.2.2",
"firebase": "^7.14.3",
"hawk": "^7.0.10",
"jetifier": "^2.0.0",
"jquery": "^3.5.1",
"jquery-sparkline": "^2.4.0",
"moment": "^2.25.3",
"ngx-ionic-image-viewer": "^0.7.0",
"ngx-logger": "^4.1.9",
"rollbar": "^2.15.2",
"rxjs": "^6.5.5",
"tslib": "^1.11.2",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/architect": "~0.803.2",
"#angular-devkit/build-angular": "~0.803.2",
"#angular-devkit/core": "~8.3.23",
"#angular-devkit/schematics": "~8.3.23",
"#angular/cli": "8.3.23",
"#angular/compiler": "~8.2.14",
"#angular/compiler-cli": "~8.2.14",
"#angular/language-service": "~8.2.14",
"#ionic/angular-toolkit": "^2.2.0",
"#types/googlemaps": "^3.43.3",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/jquery": "^3.3.38",
"#types/node": "~8.9.4",
"codelyzer": "^5.2.2",
"cordova-android": "^10.0.0",
"cordova-ios": "^6.2.0",
"cordova-open-native-settings": "^1.5.5",
"cordova-plugin-camera": "git+https://github.com/apache/cordova-plugin-camera.git",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.3",
"protractor": "^5.4.4",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"cordova": {
"plugins": {
"cordova-plugin-file": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-network-information": {},
"cordova-plugin-google-analytics": {
"GMS_VERSION": "11.0.1"
},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-buildinfo": {},
"cordova-plugin-advanced-http": {},
"#ionic-enterprise/auth": {
"AUTH_URL_SCHEME": "com.response.app",
"OKHTTP_VERSION": "3.10.0"
},
"cordova-plugin-document-viewer": {},
"cordova-plugin-googlemaps": {
"LOCATION_WHEN_IN_USE_DESCRIPTION": "This app wants to get your location while this app runs only.",
"LOCATION_ALWAYS_USAGE_DESCRIPTION": "This app wants to get your location always, even this app runs in background."
},
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-ionic-webview": {},
"#ionic-enterprise/inappbrowser": {},
"cordova-sqlite-storage": {},
"cordova-plugin-camera": {
"ANDROIDX_CORE_VERSION": "1.6.+"
},
"cordova-plugin-file-transfer": {},
"cordova-plugin-nativegeocoder": {
"LOCATION_WHEN_IN_USE_DESCRIPTION": "Use geocoder service"
},
"cordova-open-native-settings": {}
},
"platforms": [
"ios",
"android"
]
}
}
I am also attaching our config.xml file
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="1" id="app.response" ios-CFBundleVersion="1" version="3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>xxxx</name>
<description>xxxx.app Mobile Application</description>
<author email="support#reponse.app" href="https://response.app">xxxx Development Support Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="https://firebasestorage.googleapis.com/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="22" />
<preference name="android-compileSdkVersion" value="30" />
<preference name="android-targetSdkVersion" value="30" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="AndroidXEnabled" value="true" />
<preference name="WKWebViewOnly" value="true" />
<preference name="GOOGLE_MAPS_ANDROID_API_KEY" value="AIzaSyAm2VD_ypzfNZ1muaUirSXtOsplMft6O-0" />
<preference name="GOOGLE_MAPS_IOS_API_KEY" value="AIzaSyBoWBCEoKbAXNffdYfC8-0nZcrHgIfxEH0" />
<preference name="hostname" value="localhost" />
<preference name="AndroidInsecureFileModeEnabled" value="true" />
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
<application android:networkSecurityConfig="#xml/network_security_config" />
</edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<allow-intent href="market:*" />
<preference name="loadUrlTimeoutValue" value="700000" />
<preference name="SplashScreenDelay" value="3000" />
</platform>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
<string>Camera usage needs to be enabled on the device in order to upload photos of an incident.</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryAddUsageDescription">
<string>Required to access the user’s photo library.</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryUsageDescription">
<string>Required to access the user’s photo library (iOS 14+).</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>Location/GPS services are required in order to pinpoint your location on the map during an incident.</string>
</edit-config>
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-sqlite-storage" spec="^6.0.0" />
<plugin name="cordova-plugin-network-information" spec="^2.0.2" />
<plugin name="cordova-plugin-file" spec="^6.0.2" />
<plugin name="cordova-plugin-geolocation" spec="^4.0.2" />
</widget>
What could be going wrong?
Update: I managed to figure out the issue. We identified that our authentication API was not being hit. This lead us to look at the Resources/android/xml/network_security_config.xml file.
I found this link very helpful:
https://developer.android.com/training/articles/security-config
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">http://xxxx-prod.xxxx.com</domain>
</domain-config>
<debug-overrides>
<trust-anchors>
<certificates src="system"/>
</trust-anchors>
</debug-overrides>
</network-security-config>
For my app requires auto-refresh for every 5 sec. I have implemented in Ionic with angular. Initial page is loading the image URL ,but when I refresh the page automatically ,image is loading but it is flickering and again it is flickering after 5 sec and it is repeating for every 5 sec. but in android it is working fine flickering is not happening for every 5 sec image is replacing with new image or existing image without flickering. but for IOS only when I’m trying to refresh it is flickering.
example code:
1. Html file: tab1.page.html
<ion-grid class="dashgrid" *ngIf="roomApp != 0">
<div class="col-12">
<div class="row">
<div *ngFor="let item of roomApp">
<div class="box" style="width:155px;" [ngClass]="{
'redBorder':item.current_status == 0,
'greenBorder':item.current_status == 1,
'amberBorder':item.current_status == 2
}">
<div class="text-right">
<ion-icon (click)="editName(item.id,item.custom_appliance_name);" name="create"></ion-icon>
</div>
<p *ngIf="!item.custom_appliance_name" class='data font12 hometitle'>{{item.appliance_name}}</p>
<p *ngIf="item.custom_appliance_name" class='data font12 hometitle'>{{item.custom_appliance_name}}</p>
<img src="{{item.off_icon}}" *ngIf="item.current_status == 0" alt="" class="cardimg" />
<img src="{{item.on_icon}}" *ngIf="item.current_status == 1" alt="" class="cardimg" />
<img src="{{item.off_icon}}" *ngIf="item.current_status == 2" alt="" class="cardimg" />
<div class="d-flex justify-content-between">
<div *ngIf="item.current_status == 1 || item.current_status == 0">
<ion-toggle color="primary" style="padding-bottom: 4px;"
(click)="checkStatus(item.id,item.current_status)"
[checked]="item.current_status == 1 ? 'true' : 'false'"></ion-toggle>
<div *ngIf="item.current_status == 1" class="font10">On</div>
<div *ngIf="item.current_status == 0" class="font10">Off</div>
</div>
<div *ngIf="item.current_status == 2" class="d-flex align-items-center">
<div *ngIf="item.current_status == 2" class="font10 p-2"
style="background-color:red; color:#fff;border-radius:6px;">FAULTY</div>
</div>
<div>
<ion-toggle class="custom-toggle" (click)="checkNotification(item.id,item.notification_status)"
[checked]="item.notification_status == 1 ? 'true' : 'false'" style="padding-bottom: 4px;">
</ion-toggle>
<div class="font10">Notification</div>
</div>
</div>
</div>
</div>
</div>
</div>
</ion-grid>
<ion-grid *ngIf="roomApp== 0" class="d-flex justify-content-center align-items-center red">
No Appliances found
</ion-grid>
2. TS file: tab1.page.ts
doRefresh() {
this.apiService.rooms(this.uid).subscribe(response => {
if (!response[‘error’]) {
localStorage.setItem(“appliances”, JSON.stringify(response[‘appliances’]));
this.allAppliance = response[‘appliances’];
this.roomApp = this.allAppliance[this.room_id];
}
else {
this.resError = response[‘error’];
}
},
(err) => {
console.log("error==> ", err);
if (err[‘status’] == 401) {
this.navController.navigateForward(’/login’);
localStorage.setItem(‘loginValue’, ‘logout’);
}
})
}
3. scss file: tab1.page.scss
ion-content ion-toolbar {
–background: transparent;
}
.box {
box-shadow: 0 2px 4px rgba(var(–ion-color-dark-rgb), 0.24);
margin: 10px;
text-align: center;
padding: 6px;
min-height: 190px;
}
.cardimg {
width: 84px;
height: 84px;
}
.data {
margin: 0;
}
.font12{
font-size:12px;
}
.font10{
font-size:10px;
}
.red{
color:gray;
height: 100vh;
}
.greenBorder{
border-bottom:4px solid green;
}
.redBorder{
border-bottom:4px solid gray;
}
.amberBorder{
border-bottom:4px solid red;
}
.loading{
background-color:transparent !important;
}
Package.json
{
"name": "vidut",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/common": "~8.2.14",
"#angular/core": "~8.2.14",
"#angular/forms": "~8.2.14",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"#ionic-native/core": "^5.0.0",
"#ionic-native/device": "^5.24.0",
"#ionic-native/keyboard": "^5.25.0",
"#ionic-native/preview-any-file": "^5.30.0",
"#ionic-native/screen-orientation": "^5.26.0",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^5.0.0",
"bootstrap": "^4.4.1",
"cordova-browser": "6.0.0",
"cordova-ios": "6.1.1",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-screen-orientation": "^3.0.2",
"core-js": "^2.5.4",
"es6-promise-plugin": "^4.2.2",
"highcharts": "^8.1.0",
"highcharts-angular": "^2.4.0",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.803.29",
"#angular/cli": "~8.3.23",
"#angular/compiler": "~8.2.14",
"#angular/compiler-cli": "~8.2.14",
"#angular/language-service": "~8.2.14",
"#ionic/angular-toolkit": "^2.1.1",
"#ionic/lab": "3.2.10",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-android": "^9.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-fcm-with-dependecy-updated": "^7.7.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-preview-any-file": "^0.1.7",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-screen-orientation": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-preview-any-file": {},
"cordova-plugin-fcm-with-dependecy-updated": {}
},
"platforms": [
"android",
"browser",
"ios"
]
}
}
In Android it is working fine without flickering below you can see Gif.
In IOS it is not working ,it is flickering
can anyone help me from this issue
I have an issue with my Ionic app. The issue is very strange when I create a build from ionic dashboard and installed it in my device everything is working fine but if I am restarting the device or killing app from background and then I am opening the app is reflecting me old content. Like old UI screens.
I did following thing to resolve it.
Run ionic platform remove android then ionic platform add android
Run cordova clean
But these are not working for me.
config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example" version="1.0.21" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>App Name </name>
<description>App Name</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashScreenDelay" value="0" />
<preference name="loadUrlTimeoutValue" value="60000" />
<preference name="android-windowSoftInputMode" value="adjustResize" />
<preference name="SplashScreen" value="screen" />
<preference name="AutoHideSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="ShowSplashScreenSpinner" value="true" />
<preference name="FadeSplashScreen" value="true" />
<preference name="UseSwiftLanguageVersion" value="4.2" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-targetSdkVersion" value="28" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
</platform>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
<string>To scan barcodes</string>
</edit-config>
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-device" spec="1.1.4" />
<plugin name="cordova-plugin-statusbar" spec="2.2.2" />
<plugin name="cordova-plugin-sslcertificatechecker" spec="5.1.0" />
<plugin name="cordova-plugin-certificates" spec="^0.6.4" />
<plugin name="cordova-plugin-http" spec="1.2.0" />
<plugin name="cordova-plugin-file" spec="^6.0.1" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.0" />
<plugin name="cordova-plugin-ionic" spec="^2.0.4">
<variable name="APP_ID" value="e363211c" />
<variable name="CHANNEL_NAME" value="Production" />
<variable name="UPDATE_METHOD" value="background" />
<variable name="UPDATE_API" value="https://api.ionicjs.com" />
<variable name="MAX_STORE" value="2" />
</plugin>
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.0" />
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-datepicker" spec="0.9.3" />
<allow-navigation href="http://192.168.2.26:8100" />
<engine name="ios" spec="5.0.0" />
<engine name="android" spec="6.3.0" />
<engine name="browser" spec="5.0.4" />
package.json
{
"name": "App Name ",
"version": "1.0.21",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"preinstall": "./cordovaOverride.sh",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build --prod",
"lint": "ionic-app-scripts lint",
"ionic:serve": "ionic-app-scripts serve"
},
"config": {
"ionic_source_map": "source_map"
},
"dependencies": {
"#angular/common": "4.1.3",
"#angular/compiler": "4.1.3",
"#angular/compiler-cli": "4.1.3",
"#angular/core": "4.1.3",
"#angular/forms": "4.1.3",
"#angular/http": "4.1.3",
"#angular/platform-browser": "4.1.3",
"#angular/platform-browser-dynamic": "4.1.3",
"#ionic-native/app-preferences": "4.7.0",
"#ionic-native/barcode-scanner": "4.7.0",
"#ionic-native/core": "4.7.0",
"#ionic-native/date-picker": "4.7.0",
"#ionic-native/file": "4.7.0",
"#ionic-native/printer": "4.7.0",
"#ionic-native/social-sharing": "4.7.0",
"#ionic-native/splash-screen": "4.7.0",
"#ionic-native/sqlite": "4.7.0",
"#ionic-native/status-bar": "4.7.0",
"#ionic/pro": "1.0.16",
"#ionic/storage": "2.1.3",
"#zxing/library": "0.5.0",
"amazon-cognito-identity-js": "1.26.0",
"angular2-signaturepad": "2.6.1",
"aws-sdk": "2.156.0",
"cordova-android": "6.3.0",
"cordova-browser": "5.0.4",
"cordova-ios": "5.0.0",
"cordova-pdf-generator": "^2.0.8",
"cordova-plugin-add-swift-support": "^1.7.2",
"cordova-plugin-android-permissions": "^1.0.2",
"cordova-plugin-barcodescanner-browser-support": "7.1.22",
"cordova-plugin-certificates": "^0.6.4",
"cordova-plugin-datepicker": "^0.9.3",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-http": "^1.2.0",
"cordova-plugin-ionic": "^2.0.4",
"cordova-plugin-printer": "^0.7.3",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-sslcertificatechecker": "^5.1.0",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "^5.6.2",
"es6-promise-plugin": "^4.2.2",
"eslint-plugin-html": "2.0.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"moment": "^2.24.0",
"node-sass": "^4.9.4",
"phonegap-plugin-barcodescanner": "^7.1.2",
"rxjs": "5.4.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.3",
"#types/node": "8.5.1",
"json-loader": "0.5.7",
"typescript": "2.3.4",
"webpack": "3.8.1"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-sslcertificatechecker": {},
"cordova-plugin-certificates": {},
"cordova-plugin-http": {},
"cordova-plugin-file": {},
"cordova-pdf-generator": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic": {
"APP_ID": "e363211c",
"CHANNEL_NAME": "Production",
"UPDATE_METHOD": "background",
"UPDATE_API": "https://api.ionicjs.com",
"MAX_STORE": "2"
},
"ionic-plugin-keyboard": {},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-plugin-printer": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-whitelist": {},
"cordova-plugin-datepicker": {}
},
"platforms": [
"ios",
"android",
"browser"
]
}
}
In your config.xml and package.json try to change "UPDATE_METHOD": "background" to "UPDATE_METHOD": "none"
After RND I found that its the problem of ionic dashboard.
Ionic dashboard has channels.We add our git commit on channel to update ionic app.
Here is the details.
<plugin name="cordova-plugin-ionic" spec="^2.0.4">
<variable name="APP_ID" value="e363211c" />
<variable name="CHANNEL_NAME" value="Production" />
<variable name="UPDATE_METHOD" value="background" />
<variable name="UPDATE_API" value="https://api.ionicjs.com" />
<variable name="MAX_STORE" value="2" />
</plugin>
In my ionic dashboard 'Production' channel had a old version commit thats why when app is update from ionic dashboard in background it took old version old.
for fixing this issue I add new commit with production channel and app works fine.
I am able to bind the CourseName and Text to the view but is not able to bind the Image link to the view (in the Image src)
code for view is as follows :-
<mvc:View controllerName="Workspace.controller.MasterData" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form">
<Shell>
<App class="sapUiResponsiveMargin" width="auto">
<pages>
<Page title="{i18n>MasterDataTitle}" backgroundDesign="Transparent" showNavButton="true" navButtonPress="onNavBack">
<l:Grid class="sapUiSmallMarginTop" hSpacing="2" defaultSpan="L6 M6 S10" id="grid1">
<l:content>
<VBox items="{course>/Courses}">
<items>
<Image src="{course>Image}" width="100%" press="CreateDataButton">
<layoutData>
<l:GridData span="L3 M3 S8" linebreakL="true" linebreakM="true" linebreakS="true"/>
</layoutData>
</Image>
<VBox >
<Text text="{course>CourseName}"/>
<Text text="{course>Text}"/>
</VBox>
</items>
</VBox>
</l:content>
</l:Grid>
</Page>
</pages>
</App>
</Shell>
The JSON file is as follows :- (course.json)
{
"Courses": [{
"CourseName": "JAVA",
"Text": "Java is a general-purpose computer-programming language ",
"Image" :"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI4AAACgCAMAAADthaR8AAAAwFBMVEX"
}, {
"CourseName": "C++",
"Text": "Hypertext Preprocessor is a server-side scripting language designed for web development. ",
"Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI4AAACgCAMAAADthaR8AAAAwFBMVEX"
}, {
"CourseName": "PHP",
"Text": "C++ is a general-purpose programming language. ",
"Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJoAAABNCAMAAABpGo2yAAAAY1BMVEX///8AAAA/Pz/r6+uFhYX39"
}, {
"CourseName": "JAVASCRIPT",
"Text": "SQL is a domain-specific language used in programming and designed .",
"Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAMAAAC8EZcfAAAAeFBMVEX33x4AAAD74x9JQgnUwBrx2h0sKAX/6B/+5R+WiBL/6h"
}, {
"CourseName": "SQL",
"Text": "SQL is a domain-specific language used in programming and designed ",
"Image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO0AAADVCAMAAACMuod9AAAA+VBMVEX///8mh84Acsa6ury41DJ/ugAAacO80usUeskkhs4kitC2trgAf8vv7+"
}]
}
I have built a RestAPI with MongoDB using Mulesoft.
But the returned data for _id looks odd with a lot of unexpected data which are not from the DB.
How to fix this please?
Actual
[
{
"_id": {
"date": "2018-08-17T15:41:34",
"processIdentifier": 689,
"timeSecond": 1534516894,
"counter": 12813439,
"timestamp": 1534516894,
"time": 1534516894000,
"machineIdentifier": 7769240
},
"name": "Armenia",
"code": "AM"
}
]
Expected
[
{
_id: "5b76de9e768c9802b1c3848b",
name: "Armenia",
code: "AM"
}
]
Mule configuration XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ldap="http://www.mulesoft.org/schema/mule/ldap" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/apikit http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/ldap http://www.mulesoft.org/schema/mule/ldap/current/mule-ldap.xsd">
<http:listener-config name="web2-httpListenerConfig" host="0.0.0.0" port="8082" doc:name="HTTP Listener Configuration"/>
<apikit:config name="web2-config" raml="web2.raml" consoleEnabled="false" doc:name="Router"/>
<mongo:config name="Mongo_DB__Configuration" username="user1" password="123" database="mydatabase" host="mongohost" authenticationDatabase="admin" doc:name="Mongo DB: Configuration"/>
<flow name="web2-main">
<http:listener config-ref="web2-httpListenerConfig" path="/api/*" doc:name="HTTP"/>
<apikit:router config-ref="web2-config" doc:name="APIkit Router"/>
<exception-strategy ref="web2-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy"/>
</flow>
<flow name="web2-console">
<http:listener config-ref="web2-httpListenerConfig" path="/console/*" doc:name="HTTP"/>
<apikit:console config-ref="web2-config" doc:name="APIkit Console"/>
</flow>
<flow name="get:/countries:web2-config">
<mongo:find-documents config-ref="Mongo_DB__Configuration" collection="payment" doc:name="Mongo DB"/>
<dw:transform-message doc:name="Transform Message" metadata:id="517da57f-8f6a-4b76-87fc-ea4462e438b6">
<dw:input-payload mimeType="application/java" doc:sample="sample_data\json.json"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
payload]]></dw:set-payload>
</dw:transform-message>
<set-payload value="#[payload]" doc:name="Set Payload"/>
</flow>
<apikit:mapping-exception-strategy name="web2-apiKitGlobalExceptionMapping">
<apikit:mapping statusCode="404">
<apikit:exception value="org.mule.module.apikit.exception.NotFoundException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<set-payload value="{ "message": "Resource not found" }" doc:name="Set Payload"/>
</apikit:mapping>
<apikit:mapping statusCode="405">
<apikit:exception value="org.mule.module.apikit.exception.MethodNotAllowedException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<set-payload value="{ "message": "Method not allowed" }" doc:name="Set Payload"/>
</apikit:mapping>
<apikit:mapping statusCode="415">
<apikit:exception value="org.mule.module.apikit.exception.UnsupportedMediaTypeException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<set-payload value="{ "message": "Unsupported media type" }" doc:name="Set Payload"/>
</apikit:mapping>
<apikit:mapping statusCode="406">
<apikit:exception value="org.mule.module.apikit.exception.NotAcceptableException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<set-payload value="{ "message": "Not acceptable" }" doc:name="Set Payload"/>
</apikit:mapping>
<apikit:mapping statusCode="400">
<apikit:exception value="org.mule.module.apikit.exception.BadRequestException" />
<set-property propertyName="Content-Type" value="application/json" doc:name="Property"/>
<set-payload value="{ "message": "Bad request" }" doc:name="Set Payload"/>
</apikit:mapping>
</apikit:mapping-exception-strategy>
</mule>