Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 49526 articles
Browse latest View live

Not allowed to load local resource: file:/// - Ionic V1

$
0
0

@codiqa100079737 wrote:

I have to update and publish an Ionic V1 app. Due to UIWebView issue with Apple, I followed Ionic instructions - Updated to cordova-ios 5.1.0, installed the WKWebView plugin and updated each Cordova plugin to the latest version.

However, after that it’s throwing error for displaying images:
[Error] Not allowed to load local resource: file:///Users/Prasoon/Library/Developer/CoreSimulator/Devices/A834F73C-A3A1-4B66-B922-8450F9CBEA21/data/Containers/Data/Application/AD7D56B7-B702-4C08-B7F2-4F41D1C28588/Documents/S12000033_logo.png

I tried updating URL manually by string manipluation like
/Users/Prasoon/Library/Developer/CoreSimulator/Devices/A834F73C-A3A1-4B66-B922-8450F9CBEA21/data/Containers/Data/Application/AD7D56B7-B702-4C08-B7F2-4F41D1C28588/Documents/S12000033_logo.png

But, that changes the URL internally and throws error:
ionic://localhost/Users/Prasoon/Library/Developer/CoreSimulator/Devices/A834F73C-A3A1-4B66-B922-8450F9CBEA21/data/Containers/Data/Application/AD7D56B7-B702-4C08-B7F2-4F41D1C28588/Documents/S12000033_logo.png
Failed to load resource: the server responded with a status of 404 ()

Then I tried implementing convertFileSrc/normalizeURL - however, not getting any help on Ionic V1 for using that.

Posts: 1

Participants: 1

Read full topic


Please help me with native file

$
0
0

@alexmehler wrote:

this.file.readAsText(this.file.externalRootDirectory + “xtracker”, filename).then(???)

i want to read a json from android sdcard/xtracker and then JSON.parse it.

but i dont know how the promise resolves

writing the file works , but i dont know how to read it correctly please replace the ??? in the code so i get the filecontent as text

thanx !

Posts: 1

Participants: 1

Read full topic

QrCode and Barcode scanner with Ionic5 and Capacitor

$
0
0

@ioclaudio wrote:

Hi,
I have to update an App from Ionic3 to Ionic5.
It is a small app, with a few pages and uses some Cordova plugins to read Barcodes, to read QR codes and to take photos.
I think the best thing is to create a new Ionic5 app and copy the features to from the Ionic3 app to the Ionic5 app.

I can see that it is suggested for the new apps to use Capacitor instead of Cordova.
I’ve never used it and I can’t see a plugin to read Barcodes nor a plugin to read QR codes.
I’m using these plugins:

Will I still be able to use these plugins with Capacitor?

Thank you very much

Claudio

Posts: 1

Participants: 1

Read full topic

Rxjs add/remove timeout operator dynamically

$
0
0

@Vartex05 wrote:

hi, in my app, iam working with on a service, which i use to communicate over udp. Responses from udp communication are sent through subject which i created. Here is the method, for getting observable:

getUdp(){
return this.udpSubject.asObservable().pipe(
      switchMap((response: any) => {
        return response.timeoutNeeded
          ? of(response).pipe(timeout(5000))
          : of(response);
      }),
      take(1),
      map((response: any) => {
        return {
          result: response.result,
        };
      }),
      catchError(err => {
        this.closeUdpConnection(socketId, udpResponseHandler);
        return of({ result: "0", text: "Communication error" });
      })
    );
}

The problem is, that i want to apply timeout operator only if there is timeoutNeeded property on response object true. I used switchmap for that and it works great, but only for cases, when some response is emitted. But when there is no emit, the switchmap operator doesnt run, so it waits forever. For these cases i want to apply 5s timeout. How can i do this? Is it possible to reset timeout operator or remove it dynamically?

Posts: 1

Participants: 1

Read full topic

Ion-popover missing enter animation (bug?)

$
0
0

@AlenDK wrote:

Hey,

I am currently using ion-popovers in my application, but i noticed that there is not an enter animation. It just starts up with the popover on top. I looked at the source and found out there is a animation for enter: https://github.com/ionic-team/ionic/blob/c68160ecd3fb0c4d791e034e88f97ebf7f98de70/core/src/components/popover/animations/md.enter.ts .
I tried to copy the code into a custom animation and it worked (sort of, the popover was not pointing at the right place). So i am not really sure why it is not working while the leave/dismiss animation does…

Anyone got the same problem or maybe a solution?

Posts: 1

Participants: 1

Read full topic

Trying to pass Id value from this component to price component, but it's seems i couldn't display it or access the Id value

$
0
0

@samdawit wrote:

// LotItem Component

const LotItem = props => {

const { lotName, id } = props.lot;

return (

<IonGrid>

  <IonRow>

    <IonCol size-md='6' offset-md='3'>

      <IonList>

        <IonCard>

          <IonItem

            routerLink={`/lot/${id}`}

            button

            onClick={() => <Prices id={id} />}

          >

            <IonIcon slot='start' name='car-sport'></IonIcon>

            <IonLabel>{lotName}</IonLabel>

          </IonItem>

        </IonCard>

      </IonList>

    </IonCol>

  </IonRow>

</IonGrid>

);

};

export default LotItem;

// Price Component

const Prices = props => {

return (

<IonGrid>

  <IonRow>

    <IonCol size-md='6' offset-md='3'>

      <IonList>

        <IonButton onClick={() => {}}>

          <IonLabel>The Id is :{props.id}</IonLabel>

        </IonButton>

      </IonList>

    </IonCol>

  </IonRow>

</IonGrid>

);

};

export default Prices;

Posts: 1

Participants: 1

Read full topic

Button relative to scroll-content background

$
0
0

@stefani0 wrote:

I have a background image and have set this image at scroll-content class.
I want to make a button that stand always in the end of background.
Until know with some css is possible to postion but when change from pc to mobile it change.
I want something that work for all platforms.

<ion-col col-2></ion-col>
<ion-col col-8 style="text-align: center;">     
    <button class="btn" ion-button block large (click) = login()>ENTRA</button>   
</ion-col>
<ion-col col-2></ion-col>

.scroll-content {
background: url("…/imgs/Sfond.svg") no-repeat center center / cover;
margin-top: -6px;
bottom: 55px;
margin-right: -100px;
margin-left: -100px;
margin-bottom: -3px !important;
position: absolute;
}

Thank you in advance.

Posts: 1

Participants: 1

Read full topic

Ionic 4: HttpClient is giving me a “http error response 0 unknown error”

$
0
0

@feliperiverot wrote:

I am working with Ionic 4 developing and hybrid app. I am trying to consume an API URL. I am calling the API with the below code.

import { HttpHeaders, HttpErrorResponse, HttpClient  } from '@angular/common/http';

  constructor(private http: HttpClient, private androidPermissions: AndroidPermissions, private uid: Uid, private device: Device,  public platform: Platform, public formBuilder: FormBuilder, private router: Router, private nativeStorage: NativeStorage,private fb: Facebook,   private googlePlus:GooglePlus ) {


  platform.ready().then(() => {
      this.onDeviceReady();
    });


  }

    let urlSearchParams = new URLSearchParams();
urlSearchParams.append('brand', this.myManufacturer );
urlSearchParams.append('model',  this.myModel);
urlSearchParams.append('androidid', this.myUuidt);
urlSearchParams.append('serialsim', this.myUuidt);
urlSearchParams.append('imei', this.myIMEI);    

     this.httpOptions = {
    headers: new HttpHeaders(
    {
      'Content-Type': 'application/json',
      'Authorization': this.tobas64string
    })
  }



    this.http.post("some url", urlSearchParams.toString(),  this.httpOptions).subscribe(
        data  => {
        alert(JSON.stringify(data));
        },
        error  => {

        alert(JSON.stringify(error));

        }
    );

And I get this result:

enter image description here

I am testing in my cell phone, is android 9 model.

Any ideas why this is happening?

Posts: 1

Participants: 1

Read full topic


Badge count does not increase (Capacitor-PushNotification-Plugin)

$
0
0

@Catweazle101 wrote:

Hi all

I made following tutorial to integrate the PushNotifications plugin into my app.
https://capacitor.ionicframework.com/docs/guides/push-notifications-firebase/

Everything worked so far. I can now test push notifications from the Firebase Console to my app
running on my iPhone.

But my general question is:
Do I have to set the badge-count(to show for the app-icon manually?
If yes, how can I set and manage the badge-count of the app-icon?

Thanks for any tip
Oliver

Posts: 1

Participants: 1

Read full topic

Running npx cap open android is displaying the "blank" ionic app

$
0
0

@Sweg wrote:

I am trying to run my ionic app using npx cap open android,

When I run ionic serve, my app appears.

But when I run npx cap open android, the “blank” ionic app that you start off with is displayed on my phone.

Can someone please tell me why this is? I’m definitely running the same projects also.

Posts: 1

Participants: 1

Read full topic

Is possible entry to folder gallery?

$
0
0

@SirSaren wrote:

Is possible entry to folder gallery for Android & iOs. I need to get name and size photo or image of gallery ?

Posts: 1

Participants: 1

Read full topic

Splash screen flickering on .hide()

$
0
0

@KevinR007 wrote:

I’m having the following issue:

  • When launching the app, the splash screen appears. When the SplashScreen.hide(); is called the splash screen flickers and hides.

I need a solid solution for this fix, there are many comments on the internet that suggests using a setTimeout(), that won’t work for me because I can’t trust on a fixed time.

The code I’m using is pretty simple and straight forwards:

//Side info
import { Plugins } from '@capacitor/core';
const { SplashScreen } = Plugins;

//Using the Ionic InAppBrowser
constructor ( private iab: InAppBrowser)

ngOnInit() {
  this.platform.ready().then () => {
    const browser = this.iab.create('https://google.com', '_blank');
    browser.on('loadstop').subscribe( event => { SplashScreen.hide(); });
  });
}

Changing the SplashScreenDelay value has no effect, if anyone needs more information please let me know!

Posts: 1

Participants: 1

Read full topic

Xcode 11.4

$
0
0

@tkclark wrote:

I updated to Xcode 11.4 and now my project won’t compile. I guess it’s a good idea not to update to the latest version right away?

Error I’m getting:
Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)

on file:
Pods>Development Pods>Capacitor>CAPBridge.swift>registerPlugins()

on this line:
let c: AnyClass = classes![i]

debug window says:

2020-03-24 17:52:14.159915-0400 App[53045:17186165] WF: === Starting WebFilter logging for process App
2020-03-24 17:52:14.160038-0400 App[53045:17186165] WF: _userSettingsForUser : (null)
2020-03-24 17:52:14.160149-0400 App[53045:17186165] WF: _WebFilterIsActive returning: NO
2020-03-24 17:52:14.190025-0400 App[53045:17186165] *** NSForwarding: warning: object 0x7fff89115030 of class 'PFEmbeddedMulticasterImplementation' does not implement methodSignatureForSelector: -- trouble ahead
2020-03-24 17:52:14.190217-0400 App[53045:17186165] *** NSForwarding: warning: object 0x7fff89115030 of class 'PFEmbeddedMulticasterImplementation' does not implement doesNotRecognizeSelector: -- abort

Anything I can do to fix? Wait for a capacitor update?

P.S. I am running an Ionic/Vue project if that matters.

Posts: 2

Participants: 2

Read full topic

Dynamically add Popover to element onInit

$
0
0

@kodis wrote:

Just wondering if there is any way to trigger a Popover on view init?

Basically it’s a tour functionality, so the first time a user goes to a screen the popover will automatically be displayed on a button. I was able to get it to automatically show a popover with the following code but it doesn’t get attached to the element, it just displays it in the middle of the screen.

preview.ts

// Import modules
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { NavController, ToastController, PopoverController } from '@ionic/angular';
import { PopoverSimpleComponent } from '../../components/popover-simple/popover-simple.component';

@Component({
	selector: 'app-preview',
	templateUrl: './preview.page.html',
	styleUrls: ['./preview.page.scss'],
})
export class ProgramPage implements OnInit {
	@ViewChild('addButton', { read: ElementRef, static: false}) addButton: ElementRef;

	constructor(
		public navCtrl: NavController,
		public toastCtrl: ToastController,
		public popoverCtrl: PopoverController
	) {
	}

	async ngOnInit() {
		this.presentPopover(this.addButton.nativeElement, 'Text instructions');
	}
}

preview.html (relevant component only)

<ion-button #addButton class="b-add-to-library" color="primary" size="small" (click)="addToLibrary($event)">
	<ion-icon name="add"></ion-icon>
	<ion-label>Add to Library</ion-label>
</ion-button>

Cheers!

Posts: 1

Participants: 1

Read full topic

I want to used image instead of checkbox in ion-checkbox

$
0
0

@CHAEN wrote:

Hi guys!
Can’t I use an image instead of a checkbox in the ion-checkbox?
I am beginner. Please help me ;(

Posts: 1

Participants: 1

Read full topic


Ion-segment-button style

$
0
0

@Astrid5 wrote:

Hey guys, I need to make a selection between 3 dates values (today, this week, this month) or open a date picker to choose the date myself.

image

so, I thought about using ion-segment and ion-segment-buttons to do that, but so far I got this:

image

I wonder if ion-segment-button is the best choice for it (i think it is) and wich is the best way to style it. Here’s my code atm:

ion-segment-button {
    height: 40px;
    min-height: 40px;
    border-radius: 51px;
  }
  ion-segment-button.segment-button-checked {
    border-bottom: 2px solid;
    background: #ff9009;
    color: #FFFFFF !important;
  }

text-color is not applying… and the width is weird. Tips and solutions are apreciated.

Posts: 1

Participants: 1

Read full topic

Error TS2339: Property 'u_email_address' does not exist on type 'LoginPage'

$
0
0

@lily28 wrote:

Hi, I tried to make a login & register page using mysql and php as the backend, but the toast timeout (image 1 below) keep came out yet the data is been saved (image 2 below)

image 1

image 2

There is no error after click on the register button except Timeout alert, but there are few errors like this


This is my code in login.page.html

<ion-header no-border>
  <ion-toolbar color="warning">
    <ion-title>Login</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-list>
    <div class="">
      <ion-item>
        <ion-label position="floating">Email</ion-label>
        <ion-input type="text" [(ngModel)]="u_email_address"></ion-input>
      </ion-item>
    
      <ion-item>
        <ion-label position="floating">Password</ion-label>
        <ion-input type="password" [(ngModel)]="u_password"></ion-input>
      </ion-item>
      <br><br><br>
      <ion-button expand="block" class="ion-padding" color="warning" (click)="tryLogin()">Login</ion-button>
  </div>

    <p class="ion-text-center info-1">
      <br>Don't have an account? <span (click)="openRegister()">Register now</span>
    </p>
  </ion-list>
</ion-content>

login.page.ts

import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-login',
  templateUrl: './login.page.html',
  styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {

  constructor(
    private router : Router
  ) { }

  ngOnInit() {
  }

  openRegister(){
    this.router.navigate(['/register']);
  }

}

register.page.html

<ion-header no-border>
  <ion-toolbar color="warning">
    <ion-title>Register</ion-title>
    <ion-buttons slot="start">
      <ion-back-button></ion-back-button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-list>
    <div class="">
      <ion-item>
        <ion-label position="floating">Name</ion-label>
        <ion-input type="text" [(ngModel)]="u_name"></ion-input>
      </ion-item>
    
      <ion-item>
        <ion-label position="floating">Email</ion-label>
        <ion-input type="text" [(ngModel)]="u_email_address"></ion-input>
      </ion-item>

      <ion-item>
        <ion-label position="floating">Password</ion-label>
        <ion-input type="password" [(ngModel)]="u_password"></ion-input>
      </ion-item>
    
      <ion-item>
        <ion-label position="floating">Confirm Password</ion-label>
        <ion-input type="password" [(ngModel)]="u_confirm_password"></ion-input>
      </ion-item>
      <br><br><br>
      <ion-button expand="block" class="ion-padding" color="warning" (click)="tryRegister()" [disabled]="disabledButton">Register</ion-button>
  </div>
  </ion-list>
</ion-content>

register.page.ts

import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { ToastController, LoadingController, AlertController } from '@ionic/angular';
import { AccessProviders } from '../providers/access-providers';

@Component({
  selector: 'app-register',
  templateUrl: './register.page.html',
  styleUrls: ['./register.page.scss'],
})
export class RegisterPage implements OnInit {

  u_name          : string = "";
  u_email_address : string = "";
  u_password      : string = "";
  u_confirm_password : string = "";

  disabledButton;

  constructor(
    private router : Router,
    private toastCtrl : ToastController,
    private loadingCtrl : LoadingController,
    private alertCtrl : AlertController,
    private accsPrvds: AccessProviders
  ) { }

  ngOnInit() {
  }

  ionViewDidEnter(){
    this.disabledButton = false;
  }

  async tryRegister(){
    if(this.u_name == ""){
      this.presentToast('Name is required');
    }else if(this.u_email_address == ""){
      this.presentToast('Email is required');
    }else if(this.u_password == ""){
      this.presentToast('Password is required');
    }else if(this.u_confirm_password != this.u_password){
      this.presentToast('Password are not the same');
    }else{
      this.disabledButton = true;
      const loader = await this.loadingCtrl.create({
        message: 'Please wait a moment...',
      });
      loader.present();

      return new Promise(resolve =>{
        let body = {
          aksi: 'proses_register',
          u_name: this.u_name,
          u_email_address: this.u_email_address,
          u_password: this.u_password
        }

        this.accsPrvds.postData(body, 'proses_api.php').subscribe((res:any)=>{
          if(res.success==true){
            loader.dismiss();
            this.disabledButton = false;
            this.presentToast(res.msg);
            this.router.navigate(['/login']);
          }else{
            loader.dismiss();
            this.disabledButton = false;
            this.presentToast(res.msg);
          }
        },(err)=>{
          loader.dismiss();
          this.disabledButton = false;
          this.presentAlert('Timeout');
        });
      });
    }
  }

  async presentToast(a){
    const toast = await this.toastCtrl.create({
      message : a,
      duration: 1500,
      position: 'top'
    });
    toast.present();
  }

  async presentAlert(a){
    const alert = await this.alertCtrl.create({
      header: a,
      backdropDismiss: false,
      buttons: [
      {
        text: 'Close',
        handler: (blah) => {
          console.log('Confirm Cancel: blah');
          //action
        }
      }, {
          text: 'Try Again',
          handler: () => {
            this.tryRegister();
          }
        }
      ]
    });
    await alert.present();
  }
}

access-providers.ts

import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
import { map } from 'rxjs/operators';
import { timeout } from 'rxjs/operators'; 

@Injectable()
export class AccessProviders {
    //url backend api json
    server: string ='http://localhost/login-register-home/api/';

    constructor(public http: HttpClient){}

    postData(body, file){
        let headers = new HttpHeaders({
            'Content-Type' : 'application/json; charset=UTF-8'
        });
        let options = {
            headers: headers
        }

        return this.http.post(this.server + file,JSON.stringify(body), options)
        .pipe(timeout(59000))// 59 sec timeout
        .pipe(map(res => res));
    }
}

Does anyone how to fix this ? Thank you

Posts: 3

Participants: 2

Read full topic

How to change the colors of header and button in ion-alert (ionic-5)

$
0
0

@salad-gg wrote:

I have tried most options to change the color of header and buttons in ion-alert. What could be the solution?

async resetPin() {
const alert = await this.alertController.create({
header: ‘Reset Pin’,
cssClass:‘alertHeader’,
inputs: [
{
name: ‘phone’,
type: ‘number’,
placeholder: ‘Enter phone number’
}
],
buttons: [
{
text: ‘Cancel’,
role: ‘cancel’,
cssClass: ‘alertButton’,
handler: (blah) => {
alert.dismiss();
}
}, {

c.scss

.alertHeader {
color: #b52024 !important;
// --color: #b52024 !important;
}
h2.alertHeader {
color: #b52024 !important;
// --color: #b52024 !important;
}

//this works for alertHeader when inspecting in the browser
.alert-sub-title.sc-ion-alert-md, .alert-title.sc-ion-alert-md {
color: #b32224;
}

Posts: 1

Participants: 1

Read full topic

WhatsApp or Facebook messenger direct link, that would open the contact directly,

$
0
0

@AvkAvk wrote:

if its possible . put ting a button with WhatsApp or Facebook messenger direct link, that would open the contact directly, so the user can talk to the clinic through video chat

please suggest me for ionic developer .

Posts: 4

Participants: 2

Read full topic

Generating & Publishing - app names, updates recommendations?

$
0
0

@marcinni2 wrote:

Hi,

I was developing the Ionic App - I am a beginner after cash course and I have some doubts - if You could advise me something, regarding Generating the App.

I’ve generated one, it was working, then I’ve tried put it on Google Play and:
image

Package “io.ionic.starter” exists on Google Play, but I was changing the name of the app everywhere, where it was recommended during the courses.

Ok, after that, I changed “io.ionic.starter” everywhere, using Search Tool. But… It stopped working well. I think that I made some mistakes. If You could tell me - where should be App name and where should be “io.ionic.starter” or something like that.

capacitor.config.json:

{
  "appId": "com.sportigio.smartclub",
  "appName": "SmartClub",

config.xml

<widget id="com.sportigio.smartclub" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

    <name>SmartClub</name>

build.gradle

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.sportigio.smartclub"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sportigio.smartclub">

 <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
            android:name="com.sportigio.smartclub.MainActivity"

MainActivity.java

package com.sportigio.smartclub;

strings.xml

<resources>
    <string name="package_name">com.sportigio.smartclub</string>
    <string name="custom_url_scheme">com.sportigio.smartclub</string>
</resources>

However, I see the folder in Android Studio, called io.ionic.starter and I am unable to change the name of this folder:
image


  1. What is the correct workflow when I update my App?

When I was generating my App first time I did in this order:

ng build --prod
ionic capacitor sync android
ionic capacitor open android

When I was updating something - I did everything once again - start from “ng build --prod”.
Is it correct or what should I type when app is already generated, but I want to change something.

I hope You understand my problem and You will help me with my IONIC understanding - thanks in advance!

Posts: 1

Participants: 1

Read full topic

Viewing all 49526 articles
Browse latest View live


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