Posts

Showing posts from 2020

how to check app running in foreground or background in ionic4

   //Subscribe on pause i.e. background         this.platform.pause.subscribe(() => {           //Hello pause           if(localStorage.getItem("LOG_IN") == "YESORANGE") {                 this.loginprofile=  JSON.parse(localStorage.getItem("Loginprofile"));                 this.api.UserLoginStatus({                   loginUserId: this.loginprofile.Id,                   status:"online"                 }).subscribe((res: any) => {                   console.log(res);                 })               }         });            ...

refresh page when page routing to another page and come back to previous page(like tabs page to another page and other page to came back tabs page that time load the page using below code)

import { NavigationEnd, Router } from '@angular/router'; place the below code in ngOnInt() function inside  this.router.events.subscribe((evt) => {       if (!(evt instanceof NavigationEnd)) {         return;       }       console.log('hai')           });

multiple images url path taking in instagram

 single image taking process Instagram image displaying format 1) instagram user needs login 2) Only public post pictures can copy the link address of the image 3) copy the link address of the image and modify the url  for example: https://www.instagram.com/p/CIDarnTHWHV/?utm_source=ig_web_copy_link modify above link  like this:  use parameter after the url image media/?size=l Thumbnail ?size=t Medium ?size=m Large ?size=l https://www.instagram.com/p/CIDarnTHWHV/media/?size=l;  the above link should work through instagram user login. we can modify the above link , logged in user enter url in browser https://www.instagram.com/p/CIDarnTHWHV/media/?size=l above link change the url format like this : https://instagram.fhyd2-1.fna.fbcdn.net/v/t51.2885-15/e35/128017220_2869929233225574_3640516192658627214_n.jpg?_nc_ht=instagram.fhyd2-1.fna.fbcdn.net&_nc_cat=1&_nc_ohc=vEkiPLbAZq8AX_7P990&tp=1&oh=3e678f161e50badf8d0083983cec8549&oe=5FC9C64C after we ...

social share share multiple urls and base 64 data in ionic4

 share(data) {      console.log(data);     for (var i = 0; i < data.Connected_apps.length; i++) {       console.log(i);       this.urldata.push(data.Connected_apps[i].ExternalLink);          }     console.log(this.urldata.length, data.Connected_apps.length);     if (this.urldata.length == data.Connected_apps.length) {       console.log(this.urldata.length, data.Connected_apps.length);       let arr = this.urldata;     this.newarr = []     for(let i=0;i<arr.length;i++){       if(this.newarr.length>0){           let newarr1 = this.newarr;           this.newarr = [];           this.newarr.push(newarr1[0]+'\n'+'OR'+'\n'+arr[i]);       }else{         this.newarr = []         this.newarr.p...

push multiple data in array(select and disselect items in array)

 <ion-content> <h1 class="h1 margin">Following</h1> <ion-row>   <ion-col size="12" *ngFor="let data of followingdata" (click)="select(data)">     <div  class="newcssbg"  [ngStyle]="{'background-image': 'url(' + data.img +  ')'}">       <div class="overlay">       <p class="innertext">{{data.text}}       <ion-icon *ngIf="data.selected" style="color:#fff;float:right;" name="checkmark-circle-outline"></ion-icon>       </p>    </div>     </div>   </ion-col> </ion-row> </ion-content> <!-- [ngStyle]="data.selected  && {'border': '2px solid green'}" --> ts  select(data) {     // this.followingdataarray.push(data);     this.followingdata.map(e => {               if(e.id==data.id){  ...

how to send dynamic data in alertcontroller in ionic4

 public AppIds = [     {Id: "5", AppName: "YouTube", AppPath: "com.google.android.youtube", IosAppPath: null},     { Id: "5", AppName: "Netflix", AppPath: "com.google.android.youtube", IosAppPath: null } ]   let input={data:[]};     for (let i=0;i<this.AppIds.length;i++) {       input.data.push({name:this.AppIds[i].AppName,type: 'radio',label:this.AppIds[i].AppName,value: this.AppIds[i]})     }            console.log(input);       const alert = await this.alertController.create({         header: 'Select Application',         inputs: input.data,         buttons: [           {             text: 'Cancel',             role: 'cancel',             cssClass: 'secondary',           ...

ionic important links

 https://github.com/topics/ionic5 https://www.damirscorner.com/blog/posts/20200501-CustomizingPageTransitionsInIonic5.html https://github.com/mhartington/v5-animations/blob/4dbe2c81d8acdfe916f5ff13c14b90432edf85d1/src/app/home/home.module.ts play music like spotify https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48/

ionic app status bar color changing

Image
  // this.statusBar.styleDefault(); replace above line with below code if ( this . platform . is ( 'android' )) { this . statusBar . overlaysWebView ( false ); this . statusBar . styleLightContent (); // this.statusBar.backgroundColorByHexString('#ffffff'); }

dark mode in ionic5

  darkmode () { const prefersColor = window . matchMedia ( '(prefers-color-scheme: dark)' ); this . dark = prefersColor . matches ; this . updateDarkMode (); prefersColor . addEventListener ( 'change' , mediaQuery => { this . dark = mediaQuery . matches ; this . updateDarkMode (); } ); } updateDarkMode () { this . dark = true ; // alert("data") document . body . classList . toggle ( 'dark' , this . dark ); } add functions in ngoninit of app.component.ts

ionic tinder ui

<ion-content> < ion-card *ngFor = "let card of cards1" style = " width:100% " [style.position] = "'absolute'" > < ion-card-header > < ion-card-title > < img [src] = "card.img" [style.width] = "'100%'" > < h3 > {{ card.title }} </ h3 > < p > {{ card.description }} </ p > < p > ID:{{card.ID}} </ p > </ ion-card-title > </ ion-card-header > </ ion-card > </ ion-content > loadTinderCards () { this . cards1 = [ { ID : 0 , img : "https://placeimg.com/300/300/people" , title : "Demo card 1" , description : "This is a demo for Tinder like swipe cards" }, { ID : 0 , img : "https://placeimg.com/300/300/animals" , title : "Demo card 2" , description : "...

# id based change the home page content in ionic5 and ionic-swipe-all

  < div id = "block" swipeAll (swipeup) = "swipeUp($event,'block3')" (swipedown) = "swipeDown($event)" ></ div > npm i  ionic-swipe-all import { IonicSwipeAllModule } from 'ionic-swipe-all' ; @ NgModule ( { imports : [ IonicSwipeAllModule ] , } ) export class AppModule { } home.page.html <div swipeAll (swipe)="swipeAll($event)" (swipeleft)="swipeLeft($event)" (swiperight)="swipeRight($event)" (swipeup)="swipeUp($event)" (swipedown)="swipeDown($event)" ></div> home.page.ts swipeAll ( event : any ) : any { console . log ( 'Swipe All' , event ) ; } swipeLeft ( event : any ) : any { console . log ( 'Swipe Left' , event ) ; } swipeRight ( event : any ) : any { console . log ( 'Swipe Right' , ev...

ionic 5 open another application

 import { Component } from '@angular/core'; import { AppLauncher, AppLauncherOptions } from '@ionic-native/app-launcher/ngx'; import { Platform } from '@ionic/angular'; @Component({   selector: 'app-tab3',   templateUrl: 'tab3.page.html',   styleUrls: ['tab3.page.scss'] }) export class Tab3Page {        constructor(private appLauncher: AppLauncher,     private platform: Platform) { }   open() {     const options: AppLauncherOptions = {       packageName:"com.instagram.android"     }          // if(this.platform.is('ios')) {     //   options.uri = 'fb://'     // } else {     //   options.packageName = 'com.instagram.android'     // }          this.appLauncher.canLaunch(options)       .then((canLaunch: boolean) => {         if (canLaunch) {     ...

free templates

 https://github.com/ionicthemes/ionic5-starter-app-tutorial https://github.com/ionictemplate-app/Ionic-5-Angular-8-Fitness-UI-Theme-Template-App-Starter-App https://github.com/ionic-team/ionic-conference-app https://github.com/ionic-team/ionic-conference-app

datatable in ionic5

 https://www.positronx.io/create-ionic-data-table-with-ngx-datatable/ npm install @swimlane/ngx-datatable --save import below code in app.module.ts import { NgxDatatableModule } from '@swimlane/ngx-datatable' ; NgxDatatableModule First, go to  assets  folder and create  styles > ngx-datatable  folder inside the  assets  folder. add below lines in  # node_modules > @swimlane > ngx-datatable > index.css # node_modules > @swimlane > ngx-datatable > themes > bootstrap.css # node_modules > @swimlane > ngx-datatable > themes > dark.css # node_modules > @swimlane > ngx-datatable > themes > material.css Copy the  fonts  folder and  icons.css  from the following path.. # node_modules > @swimlane > ngx-datatable > assets > fonts # node_modules > @swimlane > ngx-datatable > assets > icons.css Next, paste data table  theme files ,  fonts folder  and...

Ionic APK Generation

Run app on web use below command 1)ionic serve 2) adb devices(check device connected or not) 3) export ANDROID_HOME="/home/nss/Android/Sdk"(android home path) 4) ionic cordova run android (debug apk) 5) ionic cordova build android (debug apk) 6) ionic cordova platform addd android add platforms command generate keytool--> 7)  keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 8) ionic cordova build android --prod --release ( /home/nssdt022/VisitorappIonic5project/visitorapp/platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk ) like release apk will be generated here you go to that path and paste keytool here and then run below command  9)   jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore orangerover.keystore app-release-unsigned.apk orangerover final steps of apk-->open extranal terminal 10) cd Android/Sdk/build-tools/26.0.1  11) ./zipalign -v 4 app-release-unsig...