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

Ionic app not getting data from server API on Android device

$
0
0

i’m building an Ionic 6 App with API calls, everything works fine when i run it on the browser and i get all my data.

But when i build the app (ionic capacitor build android) and install the .apk in my phone, App runs show only apps title but i get NO data, and i don’t know why.

I followed instructions that i found here but still nothing.

I’m lost and don’t really know why it is not working. i have uploaded my images and api on godaddy server. Help neede please !.

Product.page.html

<ion-buttons slot="end">
  <ion-button (click)="goToCartPage()">
    <ion-icon name="cart"></ion-icon> Cart
    <!-- Display the item count in a badge -->
    <ion-badge color="danger">{{ getCartItemCount() }}</ion-badge>
  </ion-button>
</ion-buttons>
<ion-title>Product List</ion-title>
{{ product.name }} Image

{{ product.name }}

Price: ${{ product.price }}

    </ion-col>
    <ion-col size="3">
      <ion-button (click)="viewProduct(product)">
        <ion-icon name="eye-outline"></ion-icon> <!-- Replace "eye-outline" with the actual icon name you want to use -->
      </ion-button>
      
    </ion-col>

</ion-row> 

Product.page.ts
import { Component } from ‘@angular/core’;
import { ProductService } from ‘…/…/services/product.service’;
import { Product } from ‘…/…/models/product.model’;
import { NavController } from ‘@ionic/angular’;
import { CartService } from ‘…/…/services/cart.service’;

@Component({
selector: ‘app-product’,
templateUrl: ‘./product.page.html’,
styleUrls: [‘./product.page.scss’],
})
export class ProductPage {
products: Product = ;
cart: Product = ;

constructor(
private productService: ProductService,
private navCtrl: NavController,
private cartService: CartService
) {}

ngOnInit() {
// Fetch all products using the ProductService

this.productService.getProducts().subscribe((data) => {
  // Convert the response data to the Product model
 
  this.products = data.map((ProductData) => ({
    id: ProductData.id,
    name: ProductData.name,
    price: ProductData.price,
    itemdescription: ProductData.itemdescription,

  }));
}); 

}

addToCart(product: Product) {
this.cartService.addItemToCart(product); // Add the product to the cart
}

viewProduct(product: Product) {
// this.navCtrl.navigateForward(/product-detail/${product.id});
this.navCtrl.navigateForward(/product-info/${product.id});
}
goToCartPage() {
this.navCtrl.navigateForward(‘/cart’); // Navigate to the cart page
}

// Implement the getCartItemCount method to get the item count from the CartService
getCartItemCount(): number {
return this.cartService.getCartItems().length;
}
}

Product.service.ts
import { Injectable } from ‘@angular/core’;
import { HttpClient } from ‘@angular/common/http’;
import { Observable } from ‘rxjs’;
import { Product } from ‘…/models/product.model’;
import { map } from ‘rxjs/operators’;
import { tap } from ‘rxjs/operators’;

interface ProductData {
id: number;
name: string;
price: number;
itemdescription: string;
}

@Injectable({
providedIn: ‘root’
})
export class ProductService {
private apiUrl = ‘https://gadkccs.in/api.php’; // Replace with your API URL
// private apiUrl = ‘https://localhost/api.php’; // Replace with your API URL

constructor(private http: HttpClient) {}

getProducts(): Observable<ProductData> {
return this.http.get<ProductData>(this.apiUrl);
}

getProductById(id: number): Observable<ProductData | undefined> {
return this.getProducts().pipe(
map((products: ProductData) => {
console.log(‘ID parameter:’, id);
console.log(‘All products:’, products);
const product = products.find((p: ProductData) => p.id.toString() === id.toString());
console.log(‘Filtered product:’, product);
return product;
})
);
}

}

App view when run in browser

App view when installed in mobile

4 posts - 2 participants

Read full topic


Modal with component trigger / id conflicts

$
0
0

This may be more of an Angular question than an Ionic issue but I am fairly new to both. I have an ionic modal within a component. The component is on multiple tab pages and I am having a conflict of some type with the a button name and trigger on the component modal. Clicking on the button seems to open multiple instances of the modal. Once I understood what was going on, it made a lot of sense but now looking for the best approach to ensure unique button ids and associated trigger values on a modal.

<ion-button id="open-modal" expand="block">
    // ...
<app-template-select trigger="open-modal"></app-template-select>

Is there an approach that will allow me to generate a unique id for both the id and trigger value? I don’t really care what it is but need to ensure it is unique for each modal component and associated button id. Can the component point to or reference the button rather than me assigning id values?

1 post - 1 participant

Read full topic

Issues with Forms Using Ionic 7 with Angular Standalone Components

$
0
0

I created an Ionic 7 app with tabs and picked the option to use standalone components. I then created a new page to be used for login, but cannot find the correct combination of imports to get it to work.

When I use components from ‘@ionic/angular/standalone’ I get an error on page load saying “TypeError: Cannot redefine property: accept.” I can get this error to go away if I remove either of the ion-inputs from the page.

When I import IonicModule from “@ionic/angular” the page doesn’t render correctly and I can’t click in to the input fields.

test.page.ts with @ionic/angular/standalone

import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { IonContent, IonHeader, IonTitle, IonCard, IonItem, IonInput, IonButton, IonToolbar} from '@ionic/angular/standalone';
import { Router } from '@angular/router';


@Component({
  selector: 'app-test',
  templateUrl: './test.page.html',
  styleUrls: ['./test.page.scss'],
  standalone: true,
  imports: [IonContent, IonHeader, IonTitle, IonCard, IonItem, IonInput, IonButton, IonToolbar, CommonModule, FormsModule, ReactiveFormsModule]
})
export class TestPage implements OnInit {
 credentials!: FormGroup;

 constructor(
  private fb: FormBuilder,
  private router: Router
 ) {}

 ngOnInit() {
  this.credentials = this.fb.group({
   email: ['', [Validators.required, Validators.email]],
   password: ['', [Validators.required]]
  });
 }

 async login() {
   this.router.navigateByUrl('/tabs', { replaceUrl: true });
 }

 // Easy access for form fields
 get email() {
  return this.credentials.get('email');
 }

 get password() {
  return this.credentials.get('password');
 }
}

test.page.ts with @ionic/angular

import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { IonicModule} from '@ionic/angular';
import { Router } from '@angular/router';


@Component({
  selector: 'app-test',
  templateUrl: './test.page.html',
  styleUrls: ['./test.page.scss'],
  standalone: true,
  imports: [IonicModule, CommonModule, FormsModule, ReactiveFormsModule]
})
export class TestPage implements OnInit {
 credentials!: FormGroup;

 constructor(
  private fb: FormBuilder,
  private router: Router
 ) {}

 ngOnInit() {
  this.credentials = this.fb.group({
   email: ['', [Validators.required, Validators.email]],
   password: ['', [Validators.required]]
  });
 }

 async login() {
   this.router.navigateByUrl('/tabs', { replaceUrl: true });
 }

 // Easy access for form fields
 get email() {
  return this.credentials.get('email');
 }

 get password() {
  return this.credentials.get('password');
 }
}

test.page.html

<ion-header [translucent]="true">
  <ion-toolbar>
    <ion-title>Login</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content [fullscreen]="true">
  <ion-header collapse="condense">
    <ion-toolbar>
      <ion-title size="large">Login</ion-title>
    </ion-toolbar>
  </ion-header>
   <form (ngSubmit)="login()" [formGroup]="credentials">
  <div class="input-group">
  <ion-card>
   <ion-item>
    <ion-input aria-label="Email" type="text" placeholder="Email" formControlName="email"></ion-input>
   </ion-item>
   <div *ngIf="(email?.dirty || email?.touched) && email?.errors" class="errors">
    <span *ngIf="email?.errors?.['required']">Email is required</span>
    <span *ngIf="email?.errors?.['email']">Email is invalid</span>
   </div>
   <ion-item>
    <ion-input type="password" placeholder="Password"></ion-input>
   </ion-item>
 </ion-card>
   <div *ngIf="(password?.dirty || password?.touched) && password?.errors" class="errors">
    <span *ngIf="password?.errors?.['required']">Password is required</span>
   </div>
  </div>

  <ion-button type="submit" expand="block" [disabled]="!credentials.valid">Log in</ion-button>
 </form>
</ion-content>

1 post - 1 participant

Read full topic

Multiple ion-datetime on the same page

$
0
0

I have a page which generates employee cards, inside each of these cards is an ion-datetime-button.

When there is more than one card, changing the time on either of the cards causes all subsequent cards / datetime values to change as well.

Is there something obvious that I’m missing?

1 post - 1 participant

Read full topic

Video background

$
0
0

is It possible to create a page with video background. I tried this but it is not working

<ion-content>
  <video autoplay loop src="assets/video/paradise.mp4"></video>
</ion-content>
page-home {
  video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    transform: translateX(-50%) translateY(-50%);
  }
}

Im using ionic 5 + capacitor

1 post - 1 participant

Read full topic

Amplify Social Sign In Ionic+React on Android

$
0
0

I am planning to implement Social Sign in my Ionic+react android application. Currently i am using AWS Amplify. I have tested and found an issue:

  1. After click on sign in redirect to browser(google consent screen to sign in)
  2. After success, redirect back to the app
  3. Nothing happens. The app does not capture that i have signed in.

I have tried using the built in withAuthenticator function given by aws-amplify but same problem.

I have searched online and found out that maybe i need to implement deeplinking but I don’t know how to do that. This issue has been bothering me for months

1 post - 1 participant

Read full topic

Capacitor browser plugin listeners

$
0
0

Hi to All,
Capacitor browser plugin (latest version, @capacitor/browser) works well but it handles only browserFinished and browserPageLoaded listener.

I actually need to have a listener for messages since I’m using it for external authentication in a Ionic Angular application.

Has anyone implemented others events listener at the plugin level (Android as CustomTabsCallback and iOS as SFSafariViewController)?

In case it’s not possible, is there a similar Angular plugin that allows for this?

Thank you All

1 post - 1 participant

Read full topic

In-App Purchase in ionic-react

$
0
0

using ‘cordova-plugin-purchase’ plugin

errors are come
-as per ionic-react in beta plugin support but cordova not support properly.
-app crash some times and some times pop-up come and close in 1ms.

1 post - 1 participant

Read full topic


In-App Purchase in Ionic-React Second

$
0
0

using ‘ionic-native/in-app-purchase2’ plugin

errors
-plugin work but after solving all error it not show any popup.
-cordova and ionic not support plugin.
-on android app show ionic-native call but plugin not found (but meanwhile, I already installed plugin ).

1 post - 1 participant

Read full topic

Ionic 7 (angular) and swiper 11.0.3 event did not trigger

$
0
0

Somehow the swiper unable to to listen to any event change like “slideChange”. What is the issue?

<swiper-container [modules]="swiperModules" [direction]="'vertical'" [pagination]="swiperPagination" [virtual]="swiperVirtual" (slideChange)="onSlideChange()" #swiperRef >
    <swiper-slide *ngFor="let item of slides">Slide {{item}}</swiper-slide>
</swiper-container>

I already follow the migration section in ionic framework to setup for the swiper 11.0.3 with standalone app.

1 post - 1 participant

Read full topic

Geolocation Capacitor timestamp question

$
0
0

With Geolocation plugins (capacitor and native look the same), the returned timestamp is the timestamp from GPS signal or is the timestamp from the device? I’ve look and search in the documentation but I’ve found an answer…
Thanks.

2 posts - 2 participants

Read full topic

Change Version of New Releases

$
0
0

Hi, everyone!

I am wondering that, now that there are no config.xml, is there any file where I should update the version of the apps from the ionic project? I tried to change it in package.json, but it is not changing it correctly on Android Studio nor Xcode.

1 post - 1 participant

Read full topic

Regarding the problem of ion-content and ion-footer protruding in android

$
0
0

When I display an app created using Ionic 7 & Angular on an Android tablet and scroll the ion-content area, the ion-footer protrudes to the bottom. However, if you pull up the ion-footer that is partially visible, the ion-footer itself can be returned to its original position, but this time the ion-header will shift upward and be hidden. What solutions can you think of?

The environment is as follows.
Please give me some advice.

ionic 7.0.9
angular 15.2.9

1 post - 1 participant

Read full topic

Ionic build takes more than 4 minutes

$
0
0

Hi everyone!

Here I have a problem with ionic build, that takes forever to finish the build and gives me no feedback on why. It terminates the process correctly, but takes too much time.

I have a project with this info
Ionic:

Ionic CLI                     : 7.1.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework               : @ionic/angular 7.0.0
@angular-devkit/build-angular : 15.2.4
@angular-devkit/schematics    : 15.2.4
@angular/cli                  : 15.2.4
@ionic/angular-toolkit        : 9.0.0

Capacitor:

Capacitor CLI      : 5.2.2
@capacitor/android : 5.2.2
@capacitor/core    : 5.2.2
@capacitor/ios     : 5.2.2

Utility:

cordova-res                          : not installed globally
native-run (update available: 2.0.0) : 1.7.2

System:

NodeJS : v20.2.0 (/usr/local/bin/node)
npm    : 9.8.1
OS     : macOS Unknown`

It’s a fairly big project, but the ionic build --prod takes more than 4 minutes to finish. I get this line of code Build at: DATE - Hash: XXX - Time: XXXXms and after that takes forever with no other news.

So I tried with the --verbose flag in case it could give me some explanation and only one line is shown: ionic:lib:hooks Looking for ionic:build:after npm script. +4m. But I don’t know where to even start with this. Any ideas?

1 post - 1 participant

Read full topic

Capacitor Camera - Compressed Image

$
0
0

Hi, wondering if someone could help me with an issue I’m facing.

On my app when I take a photo, the preview of the image is fine as it’s the preview from the native camera. When I submit the image to my app, the image is really compressed.

My image quality is set to 100. The height and width are set to 450x450 or 900x900, depending on if a Small/Large Image field is added to a form.

Taking a photo of text on a page is completely unreadable. Our app contractor left us so trying to get my bearings about me but getting nowhere fast.

Here is my image.component code. Apologies if there’s lack of detail as I’m on my phone doing this, I can provide more details tomorrow when I’m at my machine. Thank you in advance.

import {Component, forwardRef, Input} from ‘@angular/core’;
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from ‘@angular/forms’;
import {ModalController} from ‘@ionic/angular’;
import {AppService} from ‘src/app/core/app.service’;
import {FileTransferService} from ‘src/app/core/file-transfer.service’;
import * as Globals from ‘…/…/…/…/…/core/globals’;
import {EditImageComponent} from ‘…/edit-image/edit-image.component’;
import {HttpService} from ‘…/…/…/…/…/core/http.service’;
import {
Camera,
CameraDirection,
CameraPluginPermissions,
CameraResultType,
CameraSource,
ImageOptions,
} from ‘@capacitor/camera’;

export const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => ImageSingleComponent),
multi: true,
};

@Component({
selector: ‘fc-image’,
templateUrl: ‘./image.component.html’,
styleUrls: [‘./image.component.scss’],
providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR],
})
export class ImageSingleComponent implements ControlValueAccessor {
public _maxWidthOrHeight = Globals.LARGE_IMAGE_SIZE;
public stdWidthOrHeight = Globals.STD_IMAGE_SIZE;
private _value: string = ‘’;
private serverFolder: string;
private deviceFolder: string;
public img: string;
public initialized: boolean = false;
public options: ImageOptions = {} as ImageOptions;

public specificationFolderPath = ‘Specifications’;

@Input() label: string = ‘’;
@Input() specId: number;
@Input() docId: number;
@Input() supplierCheckTemplateId: number;
@Input() checklistTemplateId: number;
@Input() questionnaireId: number;
@Input() meetingId;
@Input() viewOnly: boolean = false;
@Input() comment: string = ‘’;
@Input() isSignature: boolean = false;
@Input() specCompanyId: number;
@Input() isReceived: boolean;

@Input() set maxWidthOrHeight(value: number) {
if (typeof value === ‘number’) {
this._maxWidthOrHeight = value;

  if (this.options) {
    this.options.height = this.options.width = value;
  }
}

}

get maxWidthOrHeight() {
return this._maxWidthOrHeight;
}

constructor(
private fileTransfer: FileTransferService,
private mdl: ModalController,
httpService: HttpService,
// private androidPermissions: AndroidPermissions,
private app: AppService
) {

if (httpService.apiModeName == 'Live') {
  this.specificationFolderPath = "specifications";
}

}

ngOnInit() {
this.options.quality = 100;
this.options.resultType = CameraResultType.DataUrl;
this.options.correctOrientation = true;

//removing these options as they are only using part of image if both together and using one drastically affects quality of the images
//this.options.height = this.maxWidthOrHeight;
//this.options.width = this.maxWidthOrHeight;
this.options.source = CameraSource.Camera;

if (this.specId && this.specId > 0) {
  if (this.isReceived) {
    this.serverFolder =
      this.specCompanyId +
      +
      '/'
      + this.specificationFolderPath +
      '/' +
      this.specId +
      '/';
  } else {
    this.serverFolder =
      Globals.currentUser().companyId +
      '/'
      + this.specificationFolderPath +
      '/' +
      this.specId +
      '/';
  }
  this.deviceFolder = this.specificationFolderPath +
    '/' + this.specId + '/';
} else if (this.docId && this.docId > 0) {
  this.serverFolder =
    Globals.currentUser().companyId +
    '/Documents/' +
    this.docId +
    '/';
  this.deviceFolder = 'Documents/' + this.docId + '/';
} else if (
  this.supplierCheckTemplateId &&
  this.supplierCheckTemplateId > 0
) {
  this.serverFolder =
    Globals.currentUser().companyId +
    '/SupplierChecks/' +
    this.supplierCheckTemplateId +
    '/';
  this.deviceFolder =
    'SupplierChecks/' + this.supplierCheckTemplateId + '/';
} else if (
  this.checklistTemplateId &&
  this.checklistTemplateId > 0
) {
  this.serverFolder =
    Globals.currentUser().companyId +
    '/Checklists/' +
  this.checklistTemplateId +
    '/';
  this.deviceFolder =
    'Checklists/' + this.checklistTemplateId + '/';
} else if (
  this.questionnaireId &&
  this.questionnaireId > 0
) {
  this.serverFolder =
    Globals.currentUser().companyId +
    '/Questionnaires/' +
    this.questionnaireId +
    '/';
  this.deviceFolder =
    'Questionnaires/' + this.questionnaireId + '/';
} else if (this.meetingId && this.meetingId > 0) {
  this.serverFolder =
    Globals.currentUser().companyId +
    '/Meetings/' +
    this.meetingId +
    '/';
  this.deviceFolder = 'Meetings/' + this.meetingId + '/';
}

}

async openCamera(type: CameraSource = CameraSource.Camera) {
try {
const notGrantedErr =
‘Read and write file system permissions must be granted to add images from the camera’;
try {
let permissions:CameraPluginPermissions;
if(type===CameraSource.Camera){
permissions = {permissions:[‘camera’]};

    }
    else {
      permissions = {permissions:['photos']};
    }
    await this.getPermission(permissions);
  } catch (err) {

    if (err === 'cordova_not_available') {
      this.app.showAlert('Error', err);
    }
    else {
      this.app.showAlert('Error', notGrantedErr);
    }
    throw err;
  }

  this.options.source = type;
  let imageData;
  if(type === CameraSource.Photos){
    /* this is a massive work around as the photo gallery is always getting permission denied no matter the permissions or requests*/
    imageData = await Camera.pickImages(this.options);
    if(imageData && imageData.photos) {
      imageData = imageData.photos[0];
      let res = await fetch(imageData.webPath);
      let blob = await res.blob();
      let  reader: FileReader = new FileReader();
      reader.onloadend = (fileLoadedEvent:any) =>{
        let imgSrcData = fileLoadedEvent.target.result;
        this.img = imgSrcData;
        this.value = imgSrcData;
      }
      reader.readAsDataURL(blob);
    }
  }
  else {
    this.options.saveToGallery = type == CameraSource.Camera;
    this.options.direction = CameraDirection.Rear;
    imageData = await Camera.getPhoto(this.options);
    this.img = imageData.dataUrl;
    this.value = imageData.dataUrl;
  }
} catch (err) {
  console.log(err);
}

}

private async getPermission(permission: CameraPluginPermissions) {

let status = await Camera.checkPermissions();
if ((permission.permissions[0] ==='camera' && status.camera!=='granted') || (permission.permissions[0] ==='photos' && status.photos!=='granted') ) {
  status = await Camera.requestPermissions(permission); // may throw exception

}

if (!status) {
  throw 'error';
}

}

openGallery() {
this.openCamera(CameraSource.Photos);
}

private isBase64(str: string) {
str = str.substr(str.indexOf(‘,’) + 1);

try {
  return btoa(atob(str)) == str;
} catch (err) {
  return false;
}

}

clearImg() {
this.img = this.value = ‘’;
}

/**

  • Called if img src is broken
  • Image not found on local device so try and download from server
  • @param img
    */
    updateImg() {
    this.serverFolder = this.serverFolder || ‘’;
    this.img = this.serverFolder + this.value;
this.fileTransfer.downloadSecureFiles(
  this.serverFolder + this.value,
  this.deviceFolder + this.value
);

}

async editImg() {
let mdl = await this.mdl.create({
component: EditImageComponent,
cssClass: ‘edit-image-mdl’,
componentProps: { image: this.img },
});

mdl.present();

const { data } = await mdl.onWillDismiss();
if (data) {
  this.img = data;
  this.value = data;
}

}

get value(): any {
return this._value;
}

set value(v: any) {
if (v !== this._value) {
this._value = v;
this.onChange(v);
}
}

async writeValue(value: any) {
this._value = value;
if (!this.initialized && value) {
if (this.isBase64(this.value)) {
this.img = this.value;
}
else {
this.img = await this.fileTransfer.getSecuredFullPath(
this.value
);
}
this.initialized = true;
}
this.onChange(value);
}

onChange = () => { };
onTouched = () => { };
registerOnChange(fn: (
: any) => void): void {
this.onChange = fn;
}

registerOnTouched(fn: () => void): void {
this.onTouched = fn;
}
}

1 post - 1 participant

Read full topic


How to prevent my APK from reverse engineering / Recompilation?

$
0
0

Hi, Can you provide solution to prevent reverse engineering of my Ionic(V5) Angular Cordova app?

1 post - 1 participant

Read full topic

Ionic React and In-App Purchase?

$
0
0

I had trouble in In-App Purchase in Ionic React project…
If any one have proper reference related to this then give me…

1 post - 1 participant

Read full topic

Handle ion-label with *ngIf or *ngSwitchCase - From legacy to modern syntax

$
0
0

I am trying to convert some code from legacy syntax of ionic 6 code to the modern syntax of ionic 7.

I have a case like this that triggers a lot of warnings.

<ion-item>
  <ion-label [position]="lookupValues ? 'floating' : 'stacked'"
    >{{ attribute.type }}
    <span *ngIf="type?.unitId as unit"> ({{ unit }})</span>
  </ion-label>

  <ion-input
    *ngSwitchCase="'Integer'"
    data-test="attribute-inner"
    [formControl]="control"
    type="number"
    #input
    (keydown)="numberFieldValidate($any($event).target.value, $event)"
  ></ion-input>

  <ion-input
    *ngSwitchCase="'Decimal'"
    data-test="attribute-inner"
    [formControl]="control"
    type="number"
    (keydown)="numberFieldValidate($any($event).target.value, $event)"
  ></ion-input>

  <ion-input
    *ngSwitchCase="'Real'"
    data-test="attribute-inner"
    [formControl]="control"
    type="number"
    (keydown)="numberFieldValidate($any($event).target.value, $event)"
  ></ion-input>

  <ion-input 
    *ngSwitchCase="'String'" 
    [formControl]="control" 
    type="text" 
    inputmode="text"
  ></ion-input>
</ion-item>

How to rewrite it in modern syntax without repeating the ion-label on every ion-input?
Thank you for attention!

1 post - 1 participant

Read full topic

Unable to see console.log from Android emulator

$
0
0

Angular 16.2, Ionic 7.5, Capacitor 5.5

Logging to console (console.log , console…debug,… ) works as expected when testing app in browser but no console-logging show up in logcat in Android Studio and neither in dev tools in chrome . Logcat in Android studio show logging from Capacitor, Capacitor(AppPlugin, EGL-EMulation… ) but none of my logging.

loggingBehavior: Is set to debug in capacitor-config.ts

to build and run:
npx capacitor run android --consolelogs --serverlogs

1 post - 1 participant

Read full topic

Capacitor.isNativePlatform returns false on android Device

$
0
0

Hi,

We have a setup where we redirect to remote web pages as our ionic app. But Capacitor.isNativePlatform is false on those pages. It is expectedly true on the initial page, an “index.html environment” in the original repository.

The setup is roughly like that:

Repository 1:

  • App starting point, local index.html
  • Packages: Capacitor Core, App, Android

Redirects to:

Repository 2:

  • Other parts of the app which are deployed on another remote URL
  • Packages: Capacitor Core, App, Android

I am testing on an android device via Android Studio.

Specifically, I want to access the resume event of the App Plugin but I get the warning implementation unavailable for: App. It is possible to listen to the Cordova resume event on document, though, but that sounds kinda outdated.

Any ideas how get the native platform correctly recognized? I tried setting window.CapacitorCustomPlatform = "android" early on the remote location. That didn’t help.

Is there a way to manually provide conditions for “nativePlatform” on android? Or does anyone have another idea?

thanks!

1 post - 1 participant

Read full topic

Viewing all 71000 articles
Browse latest View live


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