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

How to debug Android In app purchases?


Ion-slides not work with another components

$
0
0

Hello everybody, i have a problem with my ion-slides.

He not works with another components

   <div>
      <ion-slides #slides pager="false" [options]="sliderOptions" (ionSlideDidChange)="slideShanged(slides)" (ionSlidesDidLoad)="slideShanged(slides)">
        <ion-slide><app-compte userData=this.email></app-compte></ion-slide>
        <ion-slide><app-home-metier></app-home-metier></ion-slide>
        <ion-slide><app-annonce></app-annonce></ion-slide>
      </ion-slides>
    </div>

if i replace app-annonce with app-home-metier , he works except i replace with another component except app-compte or app-home-metier , he not works…

i have my slide into a component tabs , this is the tabs.module.ts :

import {NgModule, OnInit,CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Router, RouterModule  } from '@angular/router';
import {IonicModule} from '@ionic/angular';


import { TabsPage } from './tabs.page';
import {TabsPageRoutingModule} from './tabs-routing.module';
import {HomeMetierComponent} from '../home-metier/home-metier.component';
import {ComptePageModule} from '../compte/compte.module';
import {AnnoncePageModule} from '../annonce/annonce.module';


@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        IonicModule,
        TabsPageRoutingModule,
        ComptePageModule,
        AnnoncePageModule
    ],
    declarations: [TabsPage, HomeMetierComponent],
    schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
})
export class TabsPageModule  { }

and the app module :

import { NgModule, CUSTOM_ELEMENTS_SCHEMA  } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

import { InscriptionComponent} from './inscription/inscription.component';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';

import {ConnexionComponent} from './connexion/connexion.component';
import { HttpClientModule } from '@angular/common/http';
import {UserService} from './service/user.service';
import { FirstNamePipe } from './informationAccount/first-name.pipe';

@NgModule({
  declarations: [AppComponent, InscriptionComponent, ConnexionComponent, FirstNamePipe],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, FormsModule, HttpClientModule, ReactiveFormsModule],
  providers: [
      UserService,
      StatusBar,
      SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

2 posts - 1 participant

Read full topic

Ionic v5 (React) Capacitor: Custom Cordova Plugin Usage

$
0
0

I am trying to figure out how to use a Cordova plugin in a Ionic React application. The documentation walks you through how to install plugin and sync it with Capacitor but not how to use a custom plugin that does not have a ionic-natice wrapper. The plugin in question in a Cordova based project is accessed via the window object. Will this be the case with Ionic w/Capacitor?

1 post - 1 participant

Read full topic

Origin null is not allowed by Access-Control-Allow-Origin. IOS HTTP request

$
0
0

Hi, I have recently upgraded my application from Ionic 3 to Ionic 4. I have successfully been able to recreate most of my application on the android version and it is working completely fine. but when I am testing the IOS version none of the API request calls that are made with custom headers are working correctly. for example this is an API request call I am making:

import {throwError as observableThrowError, Observable} from 'rxjs';

import {catchError, map} from 'rxjs/operators';
import {Component, ViewChild} from '@angular/core';
import {Injectable} from '@angular/core';
import {HttpClient, HttpHeaders, HttpRequest} from '@angular/common/http';
import {env} from '../env/env';
import {ToastController, IonApp, NavController} from '@ionic/angular';
import 'rxjs/add/operator/toPromise';
import {NavigationExtras} from '@angular/router';
import { Storage } from '@ionic/storage';

@Injectable()
export class ApiService {
  private userID: string;
  private userNotification: string;
  private userDetails: string;
  private userToken: string;
  constructor(
      public storage: Storage,
      private http: HttpClient,
      public toastCtrl: ToastController,
      public appCtrl: NavController,
      // public device: Device
  ) {

  }

 checkIfUserExists(mobile) {
    return this.http.get(`${env.baseApiUrl}/CheckUser/${mobile}`, {}).pipe(
        catchError(this.handleError)).toPromise();
  }

This is being implemented as so:

 this.loadingCtrl.create({
            message: 'Sending code ...'
        }).then((res) => {
            res.present();

            // Check if the user already exists
            this.ApiService.checkIfUserExists(this.user.mobile)
                .then( async (r: any) => {
                    res.dismiss();
                    // User exists. Prompt login
                    const alert = await this.alertCtrl.create({
                        header: 'Mobile Number Exists',
                        message: 'There is an account associated with the mobile number you\'ve entered. Navigate to Login?',
                        buttons: [
                            {
                                text: 'Cancel',
                                role: 'cancel',
                                handler: () => {
                                    console.log('Cancel clicked');
                                }
                            },
                            {
                                text: 'Ok',
                                handler: () => {
                                    const navigationExtras: NavigationExtras = {queryParams: {val: 'init'}};
                                    this.navCtrl.navigateRoot('/login', navigationExtras);
                                }
                            }
                        ]
                    });
                    alert.present();
                })
                .catch(e => {
                    // No User. Continue
                    this.origCode = Math.floor(1000 + Math.random() * 9000);
                    console.log(this.origCode);
                    this.ApiService.sendVerificationCode(this.user.mobile, this.origCode)
                        .then(r => {
                            this.signupState = state;
                            res.dismiss();
                        })
                        .catch(e => {
                            res.dismiss();
                            this.ApiService.showToast('Error sending verification code.');
                        });
                });
        });

I have already included the following in my config.xml:

<allow-navigation href="*" />
<access origin="*" />

This is the error I receive from the above implementation:

[Error] Unhandled Promise rejection: – "Network request failed" – "; Zone:" – "<root>" – "; Task:" – "Promise.then" – "; Value:" (2)
TypeError: Network request failed — vendor.js:125431(anonymous function) — fetch.js:499(anonymous function) — zone.js:188(anonymous function) — zone.js:503timer — zone.js:3034
	(anonymous function) (cordova.js:1540)
	(anonymous function) (polyfills.js:4009)
	handleUnhandledRejection (polyfills.js:4032)
	_loop_1 (polyfills.js:4023)
	(anonymous function) (polyfills.js:4027)
	drainMicroTaskQueue (polyfills.js:3927)
	(anonymous function) (polyfills.js:3826)
	invokeTask (polyfills.js:4990)
	globalZoneAwareCallback (polyfills.js:5016)
[Error] Origin null is not allowed by Access-Control-Allow-Origin.
[Error] XMLHttpRequest cannot load due to access control checks.
[Error] ERROR – TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. — vendor.js:124032
TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. — vendor.js:124032subscribeTo — subscribeTo.js:28subscribeToResult — subscribeToResult.js:15(anonymous function) — catchError.js:43(anonymous function) — Subscriber.js:79(anonymous function) — Subscriber.js:59(anonymous function) — Subscriber.js:79(anonymous function) — Subscriber.js:59(anonymous function) — OuterSubscriber.js:13(anonymous function) — InnerSubscriber.js:18(anonymous function) — Subscriber.js:59onError — http.js:1757onInvokeTask — core.js:28110(anonymous function) — zone.js:188(anonymous function) — zone.js:503invokeTask — zone.js:1671globalZoneAwareCallback — zone.js:1697
	defaultErrorLogger (vendor.js:42843)
	(anonymous function) (vendor.js:42891)
	next (vendor.js:67400)
	(anonymous function) (vendor.js:64232)
	(anonymous function) (vendor.js:113498)
	(anonymous function) (vendor.js:113436)
	(anonymous function) (vendor.js:113382)
	(anonymous function) (vendor.js:113359)
	(anonymous function) (vendor.js:113125)
	(anonymous function) (vendor.js:64214)
	(anonymous function) (polyfills.js:3462)
	onHandleError (vendor.js:66871)
	(anonymous function) (polyfills.js:3510)
	(anonymous function) (polyfills.js:3822)
	invokeTask (polyfills.js:4990)
	globalZoneAwareCallback (polyfills.js:5016)
[Error] Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin. (4088021903, line 0)```
Any help would be greatly appreciated.

1 post - 1 participant

Read full topic

How to see/test icon / splashscreen of an app

$
0
0

I am nearly finished with a new app, but need to see what my desktop icon looks like – at least on Android. I’ve put the icon.png file in resources/android/icon.png and run ionic cordova resources android -i. Then to build the app and load it on my android phone (which is plugged in to my computer), I do ionic build --prod && npx cap sync && npx cap open android.

From Android Studio, I build it and run it. It is successfully downloaded to my phone, but the icon on the desktop still looks like the ionic icon – not my new icon.

Should this work? Or do I have to build an apk as in https://ionicframework.com/docs/deployment/play-store and then move the apk to my phone somehow?

Or, is there a better way to see what the icon will look like on my phone?

If this answer is somewhere in the docs, please just point me to it. thanks.

Vic

2 posts - 2 participants

Read full topic

Websocket server error in ionic 5 react

$
0
0

I am using ionic react ,
After using ionic-native/web-server in react it gives type error , after finding solutions in GitHub for this plugin , they says to use plain javascript, how to implement this in react ionic.
Any comments would be extremely helpful I have been struggling since ages.

1 post - 1 participant

Read full topic

Capacitor vs Cordova

$
0
0

We are starting a new ionic project. I came to understand that ionic is now recommending capacitor instead of cordova to build application.

My application has the requirement of touch id, face id and native storage. I can see these libraries readily available in cordova.

If i choose capacitor, do we have capacitor plugins correspondingly?. Since capacitor is pretty new, we are concerned about using it for our application. Can i proceed with capacitor or cordova ?

2 posts - 2 participants

Read full topic

How to implement heat map charts using ionic

$
0
0

Hi Team,

How to implement heat map charts using ionic, chart js will support Heat map chart?

How to implement Amcharts using ionic?

Thanks in Advance.

1 post - 1 participant

Read full topic


Why Google Maps Cordova ionic angular, only working in Android and blank in IOS?

Ionic: "Cannot match any route"

$
0
0

Hello,

On my Ionic app, I get the following error:

Cannot match any route. URL Segment: 'user-profile/edit/[userId]

when trying to go from “user-profile/[userId]” to “user-profile/edit/[userId]” page.
I can’t acces the said page when entering the route manually either.

My “user-profile-routing.module.ts” looks like so:

    const routes: Routes = [
      {
        path: "id",
        component: UserProfilePage,
      }, 
      {
        path: "edit/:id",
        component:EditProfilePage
      },
      {
        path:"prizes-list/:id", 
        component: PrizesListPage
      },
      {
        path: "add-prize/:id",
        component: AddPrizePage
      },
      {
        path: "stats/:id",
        component: StatsPage
      },
    ];

I have the same type of structure in another page which go from “message” page to “message/messages-details/[messageId]” page and have no problem navigating between the two:

    const routes: Routes = [
    
      {
          path: '',
          component: MessagesPage
      },
      {
          path: "messages-details/:id",
          component: MessagesDetailsPage
      },
    ];

What am I missing in my routing module to make it works? Thx for the help !

1 post - 1 participant

Read full topic

Ionic DatePicker custom placement

$
0
0

My Present datePicker design is look like this:

But I want to show the datePicker under the the Begin button. Look like this one.
ionic Date Design

<ion-item *ngIf="selectCustomDate">
  <ion-label>BEGIN</ion-label>
  <ion-input type="date" [(ngModel)]="startDate" ></ion-input>
</ion-item>

<ion-item *ngIf="selectCustomDate">
  <ion-label>END</ion-label>
  <ion-input type="date" [(ngModel)]="endDate" ></ion-input>
</ion-item>

1 post - 1 participant

Read full topic

Intruduce my self

$
0
0

My name’s Kien, I come from Ha Noi, I’m studying International Business at VNU and planning to take an IELTS exam next year. My hobbies are reading English books , playing video games and football, listening to US-UK music. My family has 4 members: My older brother who is studying in France, My parents and I. I admire my brother so much and want to study abroad like him after I graduated; as a result, I’m trying to study very hard and take every chance happens in my life!!!

1 post - 1 participant

Read full topic

Remove line under a field

$
0
0

Ionic is making line below after each field I am creating. how can I remove this line? What this line thing “officially” called? Is it removable by CSS?

My code:

<ion-grid style="height: 100%;" class="something-semantic">

  <ion-row class="something-else-semantic">

    <ion-col size-md="6" offset-md="3" class="something-semantic">

      <ion-card style="height: 100%;" class="something-else-semantic">

        <ion-card-header>

          <ion-card-title>

          </ion-card-title>

        </ion-card-header>

        <ion-card-content>

          <ion-item>

            <ion-thumbnail slot="start">

              <!-- <ion-img [src]="../../assets/logos/logo1.png"></ion-img> -->

              <img src="../../assets/logos/logo1.png">

            </ion-thumbnail>

            <ion-text style="color:#7fba00; font-weight: bolder; ">Cool Website</ion-text>

          </ion-item>

          <ion-item>

            <ion-text>Sign in</ion-text>

          </ion-item>

          <ion-item hidden>

            <ion-text style="color: red;">

              Account doesn't exist. Enter a different account or <a>get a new one.</a>

            </ion-text>

          </ion-item>

          <ion-item>

            <ion-input placeholder="Email or Username"></ion-input>

          </ion-item>

          <ion-item>

            <ion-text> Don't have an account? <a>Sign up</a> </ion-text>

          </ion-item>

          <div class="ion-margin-vertical ion-text-center">

            <ion-button fill="solid" expand="block" color="secondary" size="small"

              style="text-transform: none; width:auto;">Next</ion-button>

          </div>

        </ion-card-content>

      </ion-card>

    </ion-col>

  </ion-row>

</ion-grid>

Untitled2

A second question is : why image is working when using relative path and normal html image tag, but not working when using ion image tag? [ see my code ]

1 post - 1 participant

Read full topic

Zipalign | dyld: Library not loaded: @rpath/libc++.dylib

$
0
0

Hi Team/ Fellow Ionic-ers.

I have a problem here of using zipalign, I followed all the steps here Android Play Store Deployment.
The issue came on the last step zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk

I got an Error

Anele-MacBook-Pro:release anele$ ./zipalign -v 4 app-release-unsigned.apk learner.apk
dyld: Library not loaded: @rpath/libc++.dylib
  Referenced from: path/to/my/android/app/build/outputs/apk/release/./zipalign
  Reason: image not found
Abort trap: 6
Anele-MacBook-Pro:release anele$ 

Like I am so bumbed-out to get stuck on the last step … Also note that all my <img /> tags point to online source like <img src="https://i.imgur.com/AlWWrSz.jpg" />

Please help and Thank You In Advance

1 post - 1 participant

Read full topic

Zeroconf.register not working

$
0
0

ZeroConf.register is not working

when i call mdns ip it does not work,
i have also set webserver if zeroconf.register requires webserver , but it dint run , i confirmed it using postman , directly calling ip gives result but not mdns

1 post - 1 participant

Read full topic


Is it possible to build a cordova plugin from an Android app?

$
0
0

Hello everyone.

I’ve build an Android app which I would like to use as a plugin with Ionic 5. I don’t know if there is a way to transform this application in a Cordova plugin, and then add this to my Ionic project.

Thanks in advance.

1 post - 1 participant

Read full topic

Keychain-touch-id save method callback.sucess.apply undefined

$
0
0

Hi Everyone,

I’m attempting to use the save method of the KeychainTouchId ionic-native component.
When running in the iOS simulator, the following error is returned:

⚡️  [log] - Error in Success callbackId: TouchID190698072 : TypeError: callback.success.apply is not a function. (In 'callback.success.apply(null, args)', 'callback.success.apply' is undefined)
⚡️  [error] - {"line":273,"column":71,"sourceURL":"user-script:27"}

Seems to imply that the method is expecting a callback function, but this does not match the ionic documentaion.

Note all other methods of the plugin work as expected.

Any help appreciated.

Ionic:

   Ionic CLI                     : 6.10.1 (/usr/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.2.2
   @angular-devkit/build-angular : 0.901.9
   @angular-devkit/schematics    : 9.1.9
   @angular/cli                  : 9.1.9
   @ionic/angular-toolkit        : 2.2.0

Capacitor:

   Capacitor CLI   : not installed
   @capacitor/core : 2.2.0

Utility:

   cordova-res : not installed
   native-run  : 1.0.0

System:

   NodeJS : v10.21.0 (/usr/bin/node)
   npm    : 6.14.6
   OS     : Linux 5.4

This is how I’m using it in my component.


import { KeychainTouchId } from '@ionic-native/keychain-touch-id/ngx';
.
.
.
constructor(
.
.
.
  private kechainTouchId: KeyChainTouchId,
.
.
.
) { }
.
.
.
async presentBiometricSetupOffer() {
    const actionSheet = await this.actionSheetController.create({
      header: 'Setup Biometric Authentication.',
      buttons: [
        {
          text: 'Setup',
          handler: () => {
            const credentials = {
              instance: this.instance,
              username: this.username,
              password: this.password,
              selectedURI: this.selectedURI
            };
            this.keychainTouchId.save('com.feenics.mobile.key', JSON.stringify(credentials), true)
              .then(() => {
                this.biometricsConfigured = true;
                this.presentToast('Credentials saved. Reloading.');
                setTimeout(() => {
                  location.assign(this.apiService.originURI);
                }, 2000);
              })
              .catch((error: any) => console.log('Key save error: ', error));
          }
        },
        {
          text: 'Later',
          role: 'cancel',
          handler: () => {
            location.assign(this.apiService.originURI);
          }
        },
        {
          text: 'Never',
          handler: () => {
            this.keychainTouchId.has('com.feenics.mobile.key')
              .then(() => {
                this.keychainTouchId.delete('com.feenics.mobile.key')
                  .then(() => {
                    this.biometricsConfigured = false;
                    console.log('Keychain key deleted.');
                  })
                  .catch(error => console.log('Keychain verify failure: ', error));
              })
              .catch((error: any) => {
                console.log('keychainTouchId.has error: ', error);
              });
            localStorage.setItem('refusedBiometrics', 'true');
            location.assign(this.apiService.originURI);
          }
        }
      ]
    });
    await actionSheet.present();
  }

1 post - 1 participant

Read full topic

The app is "restarted" when I move it to background

$
0
0

Hi!
Im creating an app and I need to keep working in background but this doesnt work.
Im using:

https://github.com/katzer/cordova-plugin-background-mode

I am on Visual studio with ionic , so I execute:

ionic cordova run android

The app is launched and working. The first view is a Login, I fill the login and this take me to the second view (thit is a tab page).
On this page I add:

import { BackgroundMode } from '@ionic-native/background-mode/ngx';

constructor(private background: BackgroundMode){
this.background.enable();
console.log(this.background.isEnable());
console.log(this.background.isActive());
this.background.moveToBackground();
}

The problem is that when I move the app to the background, is “restarted” . I mean that when I open the app on background it takes me again to the first view where I should do the Login. So this is not working.

Am I doing something wrong? Is visual studio? How can I solve it?

Thanks!

1 post - 1 participant

Read full topic

Add Increment and Decrement Product for Each Product

$
0
0

Good Day! I want to implementing a feature that after customers clicking “Add to cart” Button, the increment and decrement product amount will show up. below is my code:

<ion-slide *ngFor="let product of cat.products">
          <ion-card class="flat-card ion-no-padding ion-no-margin">
            <img src="{{image_link+product.filename}}" class="product-img">
            <ion-card-header>
              <h6>
                <ion-text color="dark">{{product.name}}</ion-text>
              </h6>
              <ion-text color="medium" *ngIf="product.old_price" style="text-decoration:line-through">
                {{product.old_price |  currency: 'Rp '  : 'symbol' : '1.0-0'}}</ion-text>
              <ion-text *ngIf="!product.old_price">&nbsp;</ion-text>
              <br>
              <strong>
                <ion-text color="success">{{product.price |  currency: 'Rp '  : 'symbol' : '1.0-0'}} /
                  {{product.unit}}
                </ion-text>
              </strong>
            </ion-card-header>
            <ion-card-content>
              <!-- <div *ngIf="!getProductCount(product)"> -->
                <ion-button expand="full" (click)="addToCart(product)">Beli</ion-button>
              <!-- </div> -->

              <!-- INCREMENT AND DECREMENT BUTTON-->
              <div *ngIf="getCartProductCount(product) > 0">
                <ion-row>
                  <ion-col>
                    <ion-button (click)="decreaseCartItem(product)">
                      <ion-icon name="remove-outline" ></ion-icon>
                    </ion-button>
                  </ion-col>
                  <ion-col>
                    <ion-text>{{ getCartProductCount(product) }}</ion-text>
                  </ion-col>
                  <ion-col>
                    <ion-button (click) ="addToCart(product)">
                      <ion-icon name="add-outline" ></ion-icon>
                    </ion-button>
                  </ion-col>
                </ion-row>
              </div>

            <!-- END INCREMENT AND DECREMENT BUTTON -->
            </ion-card-content>
          </ion-card>
        </ion-slide>

After clicking Add To Cart button, below image is what i expected:

But i got below image:

When i clicked add to cart button at the first product, the increment and decrement button is appearing, but they’re not when i clicked the second product. it will appear if i decrease the first product amount till 0.

Im sorry for my bad explanation. Im trying my best to explain my problem. any help would be appreciated. Thanks!

1 post - 1 participant

Read full topic

Github Commits not showing up in Appflow

$
0
0

Just a few minutes ago new commits to Github stopped showing up in the Commits screen in Appflow.

Is something broken right now, or is there some limitation on the number of Commits I can see in Appflow?

3 posts - 2 participants

Read full topic

Viewing all 71531 articles
Browse latest View live


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