Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 70435 articles
Browse latest View live

How to pass parameters from a Tab-page to Tabs?

$
0
0

@airserenity wrote:

My application is driving some devices identified by their ID.

The app contains a tab-page with 2 tabs: Left and Right. I basically followed the template of ionic. Both Left and Right need to know the ID.

When I click on a button, the routing system leads me to /tab-page/:ID. Then the default tab is Left. The tab-page reads the ID from

this.activatedRoute.snapshot.paramMap.get('ID');  (in ionViewWillEnter).

I want to pass the ID to the Left and to the Right elements.

My first approach was the following:

  • the tab-page writes the ID in a Global variable
  • Left reads the ID from the Global variable in ionViewDidEnter

Issue: sometimes, Left is entered before the tab-page has read the params so it reads an old value from the Global.

Second approach:

  • the tab-page published an Event after reading the ID: this.events.publish(‘new_ID’, id);
  • Left subscribes to the event to get the ID

ngOnInit(){
this.events.subscribe(‘new_id6_index’, (data)=>{ console.log(…); });
}

Issues: sometimes, the event is published once but read twice by Left, as if Left was created twice. These two instances of Left block each other. In app.routing.module, the preloadingStrategy (PreloadAllModules or default) has no impact.

Third approach

  • same as the second one, but I add a timer before the event is published. This is supposed to ensure that Left has opened.
    setTimeout(() => {this.events.publish('new_id6_index', aa);},200);

It is not really clean but it works.

Question: what is the best practice in this domain?

Thanks!

Posts: 1

Participants: 1

Read full topic


Lensy: Photo Vocabulary

$
0
0

@PlayingInCanvas wrote:

One liner: A new way of learning vocabulary in a foreign language.

Description: Lensy allows you to use the camera of your phone, tablet or computer to translate visible objects around you to any language.

Features

Camera based Translation

Point your camera at any object or view and get a list of the recognized objects translated to your selected language.

Multilingual

Dinning far away from home? You are covered with a list of 105 languages to translate to and from. In a growing number of languages you can also find a text to voice button to listen to an accurate pronunciation of each word.

Lexicon

Build your own lexicon by adding words to it. You can filter them by language and search at any point using the original or the translated word.

Games

Bored of reading big lists of text trying to memorize meanings? Try our growing collection of games, learn by playing attractive word games. Have fun learning!

Tech stack:

  • Ionic 4 with Angular
  • PlayCanvas
  • Google Cloud

Site: https://lensy.one
Playstore: https://play.google.com/store/apps/details?id=pirron.app.lensy

Posts: 1

Participants: 1

Read full topic

Change ion-toggle programmatically

$
0
0

@rbender wrote:

We are using ion-toggle and wanting to show a message when the toggle is enabled. For this we are using (ionChange) event.

However there are some scenarios where we want to programmatically set the value of the toggle (when loading the form) and do not want the message to show.

Is there a way to detect this in the event, or to update the toggle without triggering the change event?

Posts: 1

Participants: 1

Read full topic

How to solve duplicate resources ionic facebook login?

$
0
0

@lobaton wrote:

my application has worked with facebook4 login, but by removing and re-adding the facebook4 plugin with the variables it has generated a mess in my application since it does not build well on the android platform.

cli packages: (/Users/user/Desktop/home-made-repo/node_modules)

@ionic/cli-utils  : 1.19.3
ionic (Ionic CLI) : 3.20.1

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.2.4
Cordova Platforms  : android 6.4.0 ios 4.5.5
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.15.0
npm               : 6.4.1
OS                : macOS
Xcode             : Xcode 10.2.1 Build version 10E1001

Environment Variables:

ANDROID_HOME : /Users/user/Library/Android/sdk/

Misc:

backend : pro

try to manually add the variables to the platforms / android / res / values / string as suggested inhttps://stackoverflow.com/a/48713244/11369978

but this only brought me another problem, now What went wrong: the execution failed for the task ‘: mergeDebugResources’.



>ionic cordova plugin add cordova-plugin-facebook4 --variable APP_ID="XXXXXXXX" --variable APP_NAME="XXXXXXXX"

>ionic cordova build android

I expected to build android successful and I got error

FAILURE: Build failed with an exception.

* What went wrong: Execution failed for task ':mergeDebugResources'.
> [string/fb_app_id] /Users/user/Desktop/home-made-repo/platforms/android/res/values/facebookconnect.xml [string/fb_app_id] /Users/user/Desktop/home-made-repo/platforms/android/res/values/strings.xml: Error: Duplicate resources [string/fb_app_name] /Users/user/Desktop/home-made-repo/platforms/android/res/values/facebookconnect.xml [string/fb_app_name] /Users/user/Desktop/home-made-repo/platforms/android/res/values/strings.xml: Error: Duplicate resources

Posts: 1

Participants: 1

Read full topic

Intention of named colors?

$
0
0

@hlamprecht wrote:

Dear all,

while writing a style guide / design system for our Ionic-based applications, I was wondering about the intention behind the various named colors in Ionic. Okay, names like “success”, “warning” and “danger” are easily understandable, similar for “dark”, “medium”, “light”.

But what about “primary”, “secondary” and “tertiary” (which - if I remember correctly - was introduced only recently with v4). Especially when looking at the default theme. From a UX perspective, I would imagine that “primary” should be used for the most important action on a page (“CTA”), however, this is the default when no other color is defined at a button. besides, “secondary” and “tertiary” are no less prominent.

Is there any documentation about the intentions behind this structure?

Cheers,

Heiner

Posts: 1

Participants: 1

Read full topic

Error when using modals

$
0
0

@JohnCressman wrote:

I am trying to use two modals to display a terms of use and disclaimer. It works, but when I try to build for android I get the following error:

ERROR in : Type DisclaimerPage in C:/ionic/EMSPROv1/src/app/pages/disclaimer/disclaimer.page.ts is part of the declarati
ons of 2 modules: HomePageModule in C:/ionic/EMSPROv1/src/app/home/home.module.ts and DisclaimerPageModule in C:/ionic/E
MSPROv1/src/app/pages/disclaimer/disclaimer.module.ts! Please consider moving DisclaimerPage in C:/ionic/EMSPROv1/src/ap
p/pages/disclaimer/disclaimer.page.ts to a higher module that imports HomePageModule in C:/ionic/EMSPROv1/src/app/home/h
ome.module.ts and DisclaimerPageModule in C:/ionic/EMSPROv1/src/app/pages/disclaimer/disclaimer.module.ts. You can also
create a new NgModule that exports and includes DisclaimerPage in C:/ionic/EMSPROv1/src/app/pages/disclaimer/disclaimer.
page.ts then import that NgModule in HomePageModule in C:/ionic/EMSPROv1/src/app/home/home.module.ts and DisclaimerPageM
odule in C:/ionic/EMSPROv1/src/app/pages/disclaimer/disclaimer.module.ts.

If I take the imports out of the homePageModule, I get errors as well. I’m not sure what it really wants me to do here.

Any hints?

ts file

import { GetMenuService } from './../services/get-menu.service';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Routes, Router } from '@angular/router';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
import {ModalController, NavController} from '@ionic/angular';
import { GoogleAnalytics } from '@ionic-native/google-analytics/ngx';
import { Storage } from '@ionic/storage';
import { AlertController } from '@ionic/angular';
import { DisclaimerPage } from '../pages/disclaimer/disclaimer.page';
import { TermsConditionsPage } from '../pages/terms-conditions/terms-conditions.page';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage implements OnInit {
    results: Observable<any>;
    analyticsPage = 'Home';
    disclaimerAgreed = 'No';
    termsAgreed = 'No';

    dataReturned: any;

    quickCallNumber = '';


  constructor(private menuService: GetMenuService, private router: Router, private ga: GoogleAnalytics,
              public storage: Storage, public alertController: AlertController, public modalController: ModalController) { }

    async presentTerms() {
        const modal = await this.modalController.create({
            component: TermsConditionsPage
        });

        await modal.present();
    }

  async presentDisclaimer() {
      const modal = await this.modalController.create({
        component: DisclaimerPage
      });

      await modal.present();
  }

  ngOnInit() {
        this.analyticsStart(this.analyticsPage);
        console.log('ngOnInit');
        this.results = this.menuService.getMenu2('menu1');
        console.log(this.results);

        this.storage.get('quickCallNumber').then((val) => {
              console.log('quickCallNumber', val);
              if (val === null || val === '') {
                this.storage.set('quickCallNumber', '610-973-1625');
                this.quickCallNumber = '610-973-1625';
              } else {
                this.quickCallNumber = val;
              }
        });

        this.storage.get('termsAgreed').then((val) => {
          console.log('termsAgreed', val);
          if (val === null || val === '') {
              this.termsAgreed = 'No';
          } else {
              this.termsAgreed = val;
          }
          if (this.termsAgreed === 'No') {
              this.presentTerms();
          }
        });

        this.storage.get('disclaimerAgreed').then((val) => {
            console.log('disclaimerAgreed', val);
            if (val === null || val === '') {
                  this.disclaimerAgreed = 'No';
            } else {
                  this.disclaimerAgreed = val;
            }
            if (this.disclaimerAgreed === 'No') {
              this.presentDisclaimer();
            }
        });
  }

    // Go to a specific url
    goToLink(url: string) {
      console.log('goToLink', url);
      window.open(url, '_blank');
    }
    // Dial phone number by using TEL
    dialNumber(phone: string) {
        console.log('goToPhone', phone);
        this.analyticsTrack('Dial Number', phone);
        window.open('tel://' + phone, '_blank');
    }

    // ---------------------------------------------------------------
    // ---------------------------------------------------------------
    // GOOGLE ANALYTICS
    // ---------------------------------------------------------------
    // ---------------------------------------------------------------
    analyticsStart(value) {
        this.ga.startTrackerWithId('UA-142662811-2')
            .then(() => {
                console.log('Google analytics is ready now');
                this.ga.trackView(value + ' Screen');
                // Tracker is ready
                // You can now track pages or set additional information such as AppVersion or UserId
                this.analyticsTrack('Page', 'View');
            })
            .catch(e => console.log('Error starting GoogleAnalytics', e));
    }
    analyticsTrack(event, label) {
        this.ga.trackEvent(this.analyticsPage, event, label, 1);
    }

}

Posts: 1

Participants: 1

Read full topic

Ionic PWA: How to transfer server ip from php into the ionic app?

$
0
0

@donotsue wrote:

Hi there,

I like Ionic PWA: No need for app installation, just calling a page on a webserver and the app is running on the smartphone in the browser.

My app needs for some reason the ip address of the webserver it is running on. So, the solution needs to work on server side while acting the php interpreter before it got send out to the smartphone browser.

On Php I get the string of the ip address with

getHostByName(getHostName()); // returns something like ‘192.168.0.20’

How to transfer this result string from php into the Ionic PWA app?

Do I have to rename the index.html into a index.php and play around with value-attributes that get the string injected/binded like

<input hidden [ngModel]=“whatever” value="<?= getHostByName(getHostName()); ?>">

Posts: 1

Participants: 1

Read full topic

Running subprocess Cordova error

$
0
0

@Mustafakhan10 wrote:

Hi my name is Mohammed,

The trouble I am having is running subprocess cordova. I tried doing:

Ionic Cordova platform add ios

I ran the command, but this gave me an error.
How do I fix this problem

Posts: 1

Participants: 1

Read full topic


Map is reloading when user location is change using geolocation. Watchpostion

$
0
0

@shiva11629 wrote:

How to avoid reloading map everytime I just want to update users position with marker?

import { DbusnoPage } from './../dbusno/dbusno.page';
import { AngularFirestore } from '@angular/fire/firestore';
import { Component, ViewChild, ElementRef } from '@angular/core';
import { Platform, NavController } from "@ionic/angular";
import { Geolocation } from '@ionic-native/geolocation/ngx'
import { AngularFirestoreModule, AngularFirestoreCollection, AngularFirestoreDocument } from '@angular/fire/firestore';
import { AngularFireStorageModule, AngularFireStorage } from '@angular/fire/storage';
import { firestore } from "firebase/app";
import {
  GoogleMaps,
  GoogleMap,
  GoogleMapsEvent,
  LatLng,
  MarkerOptions,
  Marker
} from "@ionic-native/google-maps";
import { google } from 'google-maps'
import { Icon } from 'ionicons/dist/types/icon/icon';


declare var google;



@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  @ViewChild('map') mapElemet;


  map: any;
  lat: number;
  lon: number;
  busno: number;
  driverlocation: any;
  icon: any;


  constructor(public geo: Geolocation, public afs: AngularFirestore, public dbusnos: DbusnoService,
    public platform: Platform,
    public gmaps: GoogleMaps) {
  }

  ngAfterViewInit() {

    this.busno = this.dbusnos.getdbusno();
    console.log(this.busno);

    let watch = this.geo.watchPosition();
    watch.subscribe((data) => {


      this.lat = data.coords.latitude;
      this.lon = data.coords.longitude
      if (this.busno == null) {

      }
      else {
        this.afs.doc(`driverlocation/${this.busno}`).set({
          lat: data.coords.latitude,
          lon: data.coords.longitude,
          busno: this.busno,

        });

        this.platform.ready().then(() => {

          if (this.lat == 0 && this.lon == 0) {

          }
          else {

            this.mapload()

          }
        });


      }
    })

  }



  addMarker() {

    this.icon = {
      url: "/assets/icon/bus.jpg", // url
      scaledSize: new google.maps.Size(50, 50), // scaled size
      origin: new google.maps.Point(0, 0), // origin
      anchor: new google.maps.Point(0, 0) // anchor
    };

    let marker = new google.maps.Marker({
      map: this.map,
      // animation: google.maps.Animation.DROP,
      position: this.map.getCenter(),
      Icon: this.icon


    });

    let content = "<h4>Information!</h4>";

    this.addInfoWindow(marker, content);

  }

  addInfoWindow(marker, content) {

    let infoWindow = new google.maps.InfoWindow({
      content: content
    });

    google.maps.event.addListener(marker, 'click', () => {
      infoWindow.open(this.map, marker);
    });
  }



  mapload() {
    let LatLng = new google.maps.LatLng(this.lat, this.lon)

    let mapOptions = {
      center: LatLng,
      zoom: 15,
      disableDefaultUI: true



    };

    this.map = new google.maps.Map(this.mapElemet.nativeElement, mapOptions)
    this.addMarker();
  }





}``

Posts: 1

Participants: 1

Read full topic

How could i transfer ion-title value as a parameter to another page?

$
0
0

@rishironak wrote:

I am trying to pass the title name as a parameter to another page but can’t find something like that.

Posts: 1

Participants: 1

Read full topic

How to generate android app bundle for ionic 3 application

$
0
0

@Subodh18 wrote:

Hii guys,
i have generated the apk using command :
ionic cordova build android --prod --release
after that i have generated key for playstore using command:
keytool -genkey -v -keystore myapp-release-key.keystore -alias com.exel.myapp -keyalg RSA -keysize 2048 -validity 10000

later i have signed using jarsigner using command:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp-release-key.keystore platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk com.exel.myapp

finally i am budling using zipalign using command:
C:\Users\Exel\AppData\Local\Android\sdk\build-tools\29.0.0\zipalign -v 4 platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk myapp-release-signed.apk

when i am uploading the apk to play store it’s giving warning like unoptimised code “please bundle using android app bundle”. when i am trying to do android app bundle using android studio 3.4.1 .it’s giving me warning like “Android Gradle Plugin version should be more than 3.2 or higher” .when i am clicking update button it’s getting dismissed and continuosly showing the same message every time .

so, i need suggestion and solution for this problem .i will be very thankful to this forum ,if i am able to fix this with your help.

Posts: 1

Participants: 1

Read full topic

Dismiss modal and prompt alert on press back button in ionic 3

$
0
0

@pksquare wrote:

I have a modal. In that modal i also have a prompt alert. I want to close first prompt alert then modal on pressing phone back button

Posts: 1

Participants: 1

Read full topic

How to implement jquery date picker

PubNub SDK for Ionic 5

$
0
0

@maktest wrote:

I’m going to implement the pubnub chat into my Ionic app version5.

Ionic have any plugin or SDK for pubnub?

Posts: 1

Participants: 1

Read full topic

Best Digital Marketing Company in India | Digital Media Agency

$
0
0

@xenelsoft wrote:

Xenelsoft is a leading digital marketing company in India. we are established in 2013 as a web development company in India after the long journey we worked with lots of satisfied customer. Now we works in web development, web designing, SEO, SMO, ORM and paid campaign in google adword. We have a dedicated team of expert who works on client project with 100% satisfaction result. In a short period of time we works with 1000 of satisfied customer.
Now we are expanding our services in Mobile development also.

Posts: 1

Participants: 1

Read full topic


Set Manual Focus on input

$
0
0

@gowtham_jadon wrote:

in my component i have a list of inputs in a form
once user save the form then i’ll reload the next input list without closing the component
once next set of input changed i need to set autoFocus to the very first input in the new list

only first time autofocus is working once user saved and next set of input focus is not working
while focus i need to show the keyboard as well

any solution ???

Posts: 1

Participants: 1

Read full topic

Stencil ion-input type file

$
0
0

@JEricaM wrote:

I’m using some ionic components inside a stenciljs project and some of them gives me errors also if I follow the documentation.
For example, <ion-input type="file"></ion-input> gives me this error "Type ‘“file”’ is not assignable to type ‘TextFieldTypes’."
This happens despite the fact that the ionic documentation allow to give to a ion-input the type=file.

I’ve tried also<ion-input file /> I have another error "Type ‘{ file: true; }’ is not assignable to type ‘IonInput’.
** Property ‘file’ does not exist on type ‘IonInput’".**

I don’t understand how to use a simple ion-input field with type file.

Posts: 1

Participants: 1

Read full topic

Ionic Infinte Scroll

$
0
0

@raman001 wrote:

In Inonic4 ("@ionic/angular": “^4.1.0”, and “@angular/cli”: “~7.3.8”), (ionInfinite)=“loadData($event)” is not triggering. Not able to catch the event in ts file.

In HTML:

<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)">
    <ion-infinite-scroll-content
      loadingSpinner="bubbles"
      loadingText="Loading more data...">
    </ion-infinite-scroll-content>
  </ion-infinite-scroll>

In ts:
loadData(event){
console.log(event);
}

Posts: 1

Participants: 1

Read full topic

Return result from http get

$
0
0

@contrasto97 wrote:

Hi, how can i return the result of this http get?

getChatId(emailTo) {

var email = emailTo
this.storage.get('token').then((val) => {
  const httpOptions = {
    headers: new HttpHeaders({
      'Accept': 'application/json',
      'Content-Type': 'application/json',
      'Token': val
    })
  };

  this.httpClient.get("https://sxxxxxx=" + email, httpOptions)
    .subscribe(data => {
      console.log(data['_body']);
    }, error => {
      console.log(error);
    });
});

}

Posts: 1

Participants: 1

Read full topic

Update Google Play Developer API to v3

$
0
0

@StoRmtec wrote:

Hello
I have received a message in the Google Play Console that I need to update the API.
“We’ve discovered that you’re using an old version of the Google Play Developer API in your app. As of December 1, 2019, versions 1 and 2 of this API will no longer be available. Please upgrade to version 3 by then.”

How can I do this or what steps are required to do it?
Thank you

Posts: 1

Participants: 1

Read full topic

Viewing all 70435 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>