Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228514 articles
Browse latest View live

Migration from Angular to React


Join Ionic WhatsApp Group

$
0
0

Group links are dead!
Can you give new links?

Changed then and catch in JavaScript promise

$
0
0

I find my problem. I forgot second argument of the executeSql function

it should be like this.

this.dbObject.executeSql("SELECT * FROM atten", **[]**).then(res => {

      console.log("this is responce = ", res.rows)

    }).catch(err => {

      console.log("this is error = ", err)

    })

Firebase storage on Ionic 4

$
0
0

I have a similar project with 5 pages of PDF applications along with Personal info for people we are keeping track of. I choose Firebase for this as it has a separate Database and Storage sections. No matter what File Format (mine are PDFs) you have, you can store the files on Storage. You can upload right on the Firebase Console or at a command line with their gsutil command:

gsutil -m acl ch -r -u firebase-storage@system.gserviceaccount.com:O gs://<your-cloud-storage-bucket>

// Get a non-default Storage bucket
var storage = firebase.app().storage("gs://my-custom-bucket");

So we already have the tools to deal with Storage files built-in to Firebase.

How to trigger an event when a certain slide is active?

$
0
0

Hi @rapropos you’ re right, I did see those events but I was deceived by the fact that they work only when you use the app on a real device.
In debug mode (ionic serve -lcs) the event ionSlideDidChange, for example, was never raised.
So yes I’ve used this event in this way:

<ion-slides pager="true" [options]="slideOpts" (ionSlideDidChange)="sliderChanges()">

  sliderChanges() {
    const context = this;
    this.slides.getActiveIndex().then(index => {
      console.log('@@@@ sliderChanges: index:', index);

      if (index === 3) {
...
      }

    });
  }

Thank you
cld

Does it make sense to use an analytics tool in an Ionic App?

$
0
0

Hi,
according to you, does it make sense to use an analytics tool, such as Google Analytics or Motomo, in an Ionic app to retrieve statistics on the use of the app and the user behavior?

Could it slow down the app or create other problems?
Can they be effective tools as they are with web sites and webapps?
There are ways to make the same thing?

Thank you

cld

How to receive data from USB - serial connector to app in ionic

$
0
0

Hi, sanjayparate, did you could recieve data from USB, I would like to know if you could get serial or digital data

How to receive data from USB - serial connector to app in ionic


Migration from Angular to React

$
0
0

Err, “abandoned” by whom, exactly?

Motion detection

Ionicons disappear if I change $font-path

$
0
0

Hi guys,

In my app created from a blank template, there are these 3 imports in the variables.scss file:

@import "ionic.ionicons";

@import "roboto";

@import "noto-sans";

Now, that alone works fine. I just had to replace the builtin roboto font with the full version containing the extended characters. I did that by creating fonts folder with the assets folder and copied the full font files there. So far so good.

However, I wanted to share the module with fonts across multiple projects without copying it everywhere, so I have my custom assets-common submodule that is mounted within the assets folder, so the fonts are no longer within assets/fonts but in assets/assets-common/fonts. Therefore I also had to change the $font-path variable within variables.scss to this:

$font-path: "../assets/audic-common-assets/fonts";

For the roboto font that is “overriden” in the fonts folder it works well, and the extended characters are still OK. However ionicons are now broken.

if I look in the www folder, I can see that ionicons and noto-sans fonts are still in assets/fonts. So obviously the fonts that are not overriden have a hardcoded build output path.

Anything I can do about it?

SQLite stops working after first run

$
0
0

I have an SQLite instance in my app which works perfectly the first time the app is run but never again afterwards - I have no inkling what’s going on here.

Service:

import { Platform } from '@ionic/angular';
import { SQLite, SQLiteObject } from '@ionic-native/sqlite/ngx';

  constructor(private platform: Platform, private sqlite: SQLite) {
    this.platform.ready().then(() => {
      this.sqlite.create({
        name: 'data.db',
        location: 'default'
      })
      .then((db: SQLiteObject) => {
        this.database = db;
        this.database.executeSql('CREATE TABLE IF NOT EXISTS favouriteQuotes (id VARCHAR(255) NOT NULL, date VARCHAR(255), content VARCHAR(255), author VARCHAR(255), PRIMARY KEY(id))');
      })
      .catch((error) => {
        console.log(error);
      });
    })
  }

  public async addFavourite(id: string, date: string, content: string, author: string): Promise<any> {
    let data = [encodeURI(id), encodeURI(date), encodeURI(content), encodeURI(author)];
    return this.database.executeSql(`INSERT INTO favouriteQuotes (id, date, content, author) VALUES (?, ?, ?, ?)`, data);
  }

  public async getQuote(id: string) {
    return this.database.executeSql(`SELECT * FROM favouriteQuotes WHERE id = ?`, [encodeURI(id)]);
  }

  public async getFavourites(limit: number = 5, offset: number = 0) {
    return this.database.executeSql(`SELECT * FROM favouriteQuotes LIMIT ? OFFSET ?`, [limit, offset])
  }

  public async removeFavourite(id: string) {
    return this.database.executeSql(`DELETE FROM favouriteQuotes WHERE id = ?`, [encodeURI(id)]);
  }

And on the page…

  public isFavourite(): void {
    this.quoteService.getQuote(this.quote.id)
                     .then((res) => {
                       this.favourite = (res.rows.length > 0);
                     })
                     .catch((error) => {
                       this.alertService.error("Unexpected issues when connecting to the favourites database. Please try again.");
                     })
  }

  public addFavourite(): void {
    this.quoteService.addFavourite(this.quote.id, this.quote.date, this.quote.content, this.quote.author)
                     .then(() => {
                       this.isFavourite();
                     })
                     .catch((error) => {
                       console.log(error);
                       this.alertService.error('There was an error favouriting this quote. Please try again.');
                     })
  }

  public removeFavourite(): void {
    this.quoteService.removeFavourite(this.quote.id)
                     .then(() => {
                       this.isFavourite();
                     })
                     .catch((error) => {
                       console.log(error);
                       this.alertService.error('Could not remove quote from favourites. Please try again.');
                     })
  }

Any ideas? Apologies if it’s something stupid!

EDIT: There’s a chance this isn’t an SQLite issue. After the second load the buttons (which are just elements - not ) suddenly have a chrome style orange outline around them when they are pressed…

Migration from Angular to React

$
0
0

Angular abandoned? Lol you’re misinformed and what you are asking wouldn’t get no ones attention, it’s just a common question that gets asked many many times. And here is the answer to your common question that you waited so long for, you need a complete rewrite of your project. Good luck with react!

Ionic-4-rest-api-calls-not-working-on-the-device

mediaDevices does not exist on type 'Navigator'

$
0
0

It’s not supported.


Ionic cordova in app phone call to a number but without launching dialer

$
0
0

Hi ubaidgul,

I have the same requirement. Do you able to solve it?

Does it make sense to use an analytics tool in an Ionic App?

$
0
0

Yes! It does.

You can use services like Google Analytics, Firebase Analytics and others.

If you are in a native environment, you should search for Cordova, Capacitor or Electron plugins to help you implement it.

All the libs to work with track analytics data that I know works in background. So use this kind of tool should not impact your user experience.

Ionic cordova in app phone call to a number but without launching dialer

$
0
0

Hi paragg,

I found no solution for this. I had to skip this requirement.

Register PushNotification: Error -> UI API called on a background thread

$
0
0

Main Thread Checker: UI API called on a background thread: -[UIApplication registerForRemoteNotifications]

I use the following js in constructor in the tab example, but I always get the error as title.
import {
Plugins,
PushNotification,
PushNotificationToken,
PushNotificationActionPerformed } from ‘@capacitor/core’;
const { PushNotifications } = Plugins;

   // Register with Apple / Google to receive push via APNS/FCM
     PushNotifications.register();

//Environment
Ionic:

Ionic CLI : 5.4.15 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.11.10
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.1.2

Capacitor:

Capacitor CLI : 1.4.0
@capacitor/core : 1.4.0

Anyone can help ?

Fab position incorrect in ngSwitch segment

$
0
0

vous êtes les bienvenus

Viewing all 228514 articles
Browse latest View live


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