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

Tab navigate not trigger ionViewDidEnter

$
0
0

@soo wrote:

I create an Ionic 4 tab app.
Then generate a new page name second-page.
I use tab1 as main page, then add button navigate to second-page, add a back button at second-page to go back to main page, as below in html:

<ion-buttons slot="start">
  <ion-back-button defaultHref="/"></ion-back-button>
</ion-buttons>

I add function ionViewDidEnter() for both pages for testing, as below:

ionViewDidEnter() {
    console.log('ionViewDidEnter.....');
  }

When the app start, the console shows that main page trigger the ionViewDidEnter function, navigate to second page, the ionViewDidEnter is triggered too. So far so good.

Then I click the back button, the ionViewDidEnter function at the main page is not triggered. Why?

Using router navigate at second-page ts file is not working too:
this.router.navigate(['tabs/tab1']);

It navigate to tab1, but the ionViewDidEnter did not triggered.
If navigate between tabs, from tab2 or tab3 to tab1, the function is working fine.
I know it’s ionic page life cycle theory, but I just can’t figure it out.
Someone help. Thanks in advance.

Posts: 1

Participants: 1

Read full topic


Capacitor PushNotification

$
0
0

@rahulchouksey_123 wrote:

Issue belongs to IOS.

  1. pushNotificationReceived
  2. pushNotificationActionPerformed

Above 2 events not getting fired in IOS when notification recieved, eventually Android is fine with all events of Push.
Do anyone have idea why its not being call in IOS.

Posts: 1

Participants: 1

Read full topic

Ionic 5 React - Capacitor with plugin Zoom or others Cordova plugins

$
0
0

@wesleyzxt wrote:

When I add a plugin to my Capacitor project in Android Studio, the following message is displayed: “Caused by: org.gradle.api.resources.MissingResourceException: Could not read script ‘C:\Poliglota\poliglota-app\android\capacitor-cordova-android-plugins\cordova.variables.gradle’ as it does not exist.”

Ionic:

Ionic CLI : 6.6.0 (C:\Users\wesley.ornellas\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/react 5.0.7

Capacitor:

Capacitor CLI : 2.0.1
@capacitor/core : 2.0.1

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v12.16.2 (C:\Program Files\nodejs\node.exe)
npm : 6.14.4
OS : Windows 10

npx cap ls
Found 0 Capacitor plugins for android:
Found 1 Cordova plugin for android
cordova-plugin-camera (4.1.0)
Found 0 Capacitor plugins for ios:
Found 1 Cordova plugin for ios
cordova-plugin-camera (4.1.0)

Posts: 1

Participants: 1

Read full topic

Capacitor PushNotification

$
0
0

@rahulchouksey_123 wrote:

Issue belongs to IOS.

  1. pushNotificationReceived
  2. pushNotificationActionPerformed

Above 2 events not getting fired in IOS when notification recieved, eventually Android is fine with all events of Push.
Do anyone have idea why its not being call in IOS.

Posts: 1

Participants: 1

Read full topic

iOS build fails - PhaseScriptExecution [CP]\ Copy\ Pods\ Resource

$
0
0

@hanigb wrote:

My projects builds and runs just fine on android. On iOS, I get the error below after running this command:

ionic cordova run ios -l

The command fails with this output:

[cordova] PhaseScriptExecution [CP]\ Copy\ Pods\ Resources /Users/user170741/Library/Developer/Xcode/DerivedData/Kalimny-hcljtuahycuofwbzkwikjjpvvhee/Build/Intermediates.noindex/Kalimny.build/Debug-iphonesimulator/Kalimny.build/Script-B237CB1F7F892CE32F67A378.sh
[cordova] (1 failure)
[cordova] xcodebuild: Command failed with exit code 65

Ionic CLI: 6.60
ionic/angular: 5.1.0
cordova-ios: 5.1.1

Posts: 1

Participants: 1

Read full topic

Capacitor AdMob Plugin doesn't display correctly

$
0
0

@alokjkumar97 wrote:

Ionic v5 with Angular using https://github.com/rahadur/capacitor-admob

Hi I have followed the set up guide and am seeing a splashscreen at the bottom of the page for banner ads:

image

I also get this view whilst the app is starting up - if there’s any way to prevent the splashscreen in the corner that would be great

image

I have abstracted the plugin to a separate service called admob.service.ts as so:

To initialize the plugin:

  constructor(private platform: Platform) {
    if(this.platform.is('mobileweb') || this.platform.is('desktop')) {
      // pass
    } else if(this.platform.is('ios')) {
      AdMob.initialize('ca-app-pub-ios-key');
    } else {
      AdMob.initialize('ca-app-pub-android-key');
    }
  }

To show a banner ad:

  public async showBannerAd(position: any = AdPosition.BOTTOM_CENTER, adSize: any = AdSize.SMART_BANNER): Promise<any> {
    if(this.platform.is('mobileweb') || this.platform.is('desktop')) { return; }
    // This is a test ID
    const adId = 'ca-app-pub-3940256099942544/6300978111';
    const options: AdOptions = {
      adId: adId,
      adSize: adSize,
      position: position,
      hasTabBar: false,
    }

    AdMob.addListener('onAddFailedToLoad', async (info: any) => {
      this.removeBannerAd();
    });

    return AdMob.showBanner(options)
  }

I had to upgrade the plugin to AndroidX which is where I think the problem is:

AdMob.java

import androidx.coordinatorlayout.widget.CoordinatorLayout;

bridge_layout_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.getcapacitor.BridgeActivity"
    >

    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Appreciate any thoughts

Posts: 1

Participants: 1

Read full topic

Check location without leaving page

$
0
0

@heardnetwork wrote:

I have a firebase app that uses location. the check for location happens when you enter the page.

This works for the main part, but if you land on the page with your location off, and then turn it on, you have to leave the page and come back to load the content. This is a poor UX, and doesn’t make it clear. is there a way of detecting the change without reloading the page?

i’ve tried to google it but i’m not really sure what i’m looking for

thanks

Posts: 1

Participants: 1

Read full topic

Contacts plugin

$
0
0

@rubenmiq wrote:

Does anyone know if the contacts plugin is able to get the contacts on Samsung phones? Samsung phones normally have their own Contacts app, not the Google one, and i have some customers reporting that they can’t see any contacts retrieved.
Is there a way to fix this or some one can point me out on some direction to investigate further?

Posts: 1

Participants: 1

Read full topic


Header color in android not working

$
0
0

@kn01 wrote:

I am trying to leave the black header on the android device, but it is not working. IOS works normally, but not on Android. I have already tested several alternatives, can you help me?

my component.html:

<ion-header>
  <ion-toolbar>
  </ion-toolbar>
</ion-header>

I try this in my component.scss and global.scss:

ion-header {
    @media (prefers-color-scheme: dark){
        .md body {
            --ion-background-color: #000000 !important
        } 
    }
    
    @media (prefers-color-scheme: light){
        .md body {
            --ion-background-color: #000000 !important
        } 
    }
}

@media (prefers-color-scheme: dark){
    .md body {
        --ion-background-color: #000000 !important
    } 
}

@media (prefers-color-scheme: light){
    .md body {
        --ion-background-color: #000000 !important
    } 
}

my component.scss:

ion-content{
    --ion-background-color: #ffffff;
    --ion-background-color-rgb: 255,255,255;
    --ion-text-color: #000000;
    --ion-text-color-rgb: 0,0,0;
}

ion-card-content {
    margin: 0 auto;
}

ion-icon {
    color: black;
    font-size: 24px;
}



button {
    background-color: white !important;
    color: black;
    border-radius: 5px;
    border: 2px solid transparent;
    outline: none;
}

ion-card {
    --ion-background-color: #ffffff;
    background-color: white !important;
    border: none !important;
    font-family: $font;
}

ion-fab-button {
    --background: black !important;
    --background-activated: black;
    --background-focused: black;
    --background-hover: black;
}

I need this in all devices android, theme light or dark:

but in device emulator the background color is white, why?

thanks =)

Posts: 1

Participants: 1

Read full topic

Choosing the right database platform for Ionic App

$
0
0

@Maldini3 wrote:

Hello.

I am planning to build an ionic app that depends on a database, which would eventually have many data saved. I am wondering what is the best database available to have the app fully functioned? I am used to mySQL but I read it is not recommended to be used in Ionic. If there is a way to use mySQL without problems I would go for it. Google Firebase is an option I like but is it fully free if I want to use their database only without the other functionalities that they offer? What about MangoDB?

Posts: 1

Participants: 1

Read full topic

[blocked] Access to geolocation was blocked over insecure connection to ionic://localhost

$
0
0

@arielhasidim wrote:

:wave:
I have Cordova-Angular project (not Ionic), with ionic-webview. I’m trying to use cordova-geolocation plugin to get current-location and device-orientation (compass heading) with a “location.service” I created.
Im using:

  • @angular/cli 7.3.9
  • cordova-lib@9.0.1
    • platforms:
      • android 8.1.0
      • ios 5.1.1
    • plugins (shorten):
      • cordova-plugin-ionic-webview 4.1.1 “cordova-plugin-ionic-webview”
      • cordova-plugin-geolocation 4.0.2 “Geolocation”

It used to work both on android and ios, now on ios, I get the location, but with an error for device orientation.

[blocked] Access to geolocation was blocked over insecure connection to ionic://localhost.

Geolocation PositionError {code: 1, message: “Origin does not have permission to use GeolocThis text will be blurredation service”

in my *.plist file:

My location.service:


import {Injectable} from '@angular/core';
import {BehaviorSubject, combineLatest, fromEvent, Observable, of, timer} from 'rxjs';
import {HttpClient} from '@angular/common/http';
import {map, switchMap} from 'rxjs/operators';
import { Globals } from '../globals';

export interface DefiLocation {
  accuracy: number;
  altitude: number;
  altitudeAccuracy: number;
  heading: number;
  latitude: number;
  longitude: number;
  speed: number;
  compass: number;
}

@Injectable({
  providedIn: 'root'
})
export class LocationService {
  errorMessage$: string;
  currentLocation$: BehaviorSubject<{
    accuracy?: number,
    altitude: number,
    altitudeAccuracy: number,
    heading: number,
    latitude: number,
    longitude: number,
    speed: number
  }> = new BehaviorSubject({
    accuracy: 0,
    altitude: 0,
    altitudeAccuracy: 0,
    heading: 0,
    latitude: 32.5,
    longitude: 35,
    speed: 0,
  });

  currentCompass$: BehaviorSubject<number> = new BehaviorSubject(0);
  currentCompass: number = 0;
  currentPosition: {
    accuracy: 0,
    altitude: 0,
    altitudeAccuracy: 0,
    heading: 0,
    latitude: 32.5,
    longitude: 35,
    speed: 0,
  };
  locationTimer;
  sendLocationError: boolean = true;

  constructor(public globals: Globals) {
    this.isCurrentPosition$.next(true);
    this.trackMe();
  }

  private trackMe() {
    if (this.globals.iphone) {
        window.addEventListener('deviceorientation', (event) => {
          this.currentCompass$.next(Math.round(event['webkitCompassHeading']));
        });
      // }
    } else {
      window.addEventListener('deviceorientationabsolute', (event) => {
        this.currentCompass$.next(360 - Math.round(event['alpha']));
      }, true);
    }


    if (navigator.geolocation) {
      this.locationTimer = timer(0, 100).subscribe(tick => {
        navigator.geolocation.getCurrentPosition((position) => {
          this.currentLocation$.next(position.coords);
          this.isCurrentPosition$.next(true);
          this.sendLocationError = true;
        }, (err) => {
          this.isCurrentPosition$.next(false);
          this.sendError(err.message);
          console.log(err);
          this.errorMessage$ = err.message;
          console.log(this.errorMessage$);
        }, {
          enableHighAccuracy: true
        });
      });

    } else {
      alert('Geolocation is not supported by this browser.');
      this.sendError('navigator.geolocation = null ("Geolocation is not supported by this browser.")');
    }
  }

  getCurrentLocation$(): Observable<DefiLocation> {
    return combineLatest(this.currentCompass$.asObservable(), this.currentLocation$.asObservable())
      .pipe(
        map(([compass, location]) => {
            return {
              longitude: location.longitude,
              latitude: location.latitude,
              accuracy: location.accuracy,
              altitude: location.altitude,
              altitudeAccuracy: location.altitudeAccuracy,
              heading: location.heading,
              speed: location.speed,
              compass
            };
          }
        ));
  }

  sendError(error) {
    if (this.sendLocationError) {
      this.sendLocationError = false;
      window['cordova'].plugins.firebase.analytics.logEvent('user_location_failed', {param1: error});
      setTimeout(function() { this.sendLocationError = true; }, 5000);
    }
  }
}

### Detailed logs:

When I run cordova build ios , and then run it from Xcode on my iPhone (ios 13.4.1) and check Safari’s develop console:

Posts: 1

Participants: 1

Read full topic

Why ionic-react InAppBrowser is not working?

Ionic Consultant

$
0
0

@lucasarmstrong wrote:

Hello!

We are looking to build our angular app with capacitor and deploy in-house for iOS and android.

I need to consult with someone experienced with this process, let me know your rates for consultation!

Thank you,
Lucas

Posts: 1

Participants: 1

Read full topic

Copy Audio File Error

$
0
0

@franciscocab wrote:

Hello, I am using the File plugin and I want to copy audio files to my directory, example:
file: ///data/user/0/com.company/files/media_files

But I have this error:

FileError {code: 1, message: “NOT_FOUND_ERR”}
code: 1
message: "NOT_FOUND_ERR"

It only happens when I use Xiaomi brand phones, I realized that the difference is how it saves the file name, example: name: 5%20may.%2010.05%20p.%20m…aac

Has anyone had the same problem? If you can help me, thanks

Posts: 1

Participants: 1

Read full topic

Ionic multi app

$
0
0

@Stech wrote:

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Posts: 1

Participants: 1

Read full topic


ngOnInit()

$
0
0

@mehraj786 wrote:

hi i am having one issue when i login first time i am getting that particalr user details but when i logout and login with different user again i am getting same result can anyone know how to fix this

Posts: 1

Participants: 1

Read full topic

Android black space

$
0
0

@Bauss28 wrote:

Yo guys. So when I run my app on an emulator for Samsung S20, it shows the app perfectly over the entire display. If I run it on phone, there is a weird black space under where the statusbar was, and it doesn’t cover the entire screen. It’s so annoying can someone help out?

Here’s how it’s looking on the emulator and how it should be. Why doesn’t it show like this on phone? the upper area is completely black and it looks ugly on this phone, I want to cover all.

Screenshot_6

Posts: 1

Participants: 1

Read full topic

Bottom drawer (Cupertino Pane)

$
0
0

@Romwtb wrote:

Hey guys, i did create bottom drawer slider, especially for using in my ionic applications.
But it’s also support other javascript frameworks. :rocket:

Everybody welcome! Please push the start if you gonna use it :star:

Posts: 1

Participants: 1

Read full topic

Ionic 5 star rating

Ionic 4 tab bar button getting freezed

$
0
0

@toanuranjans wrote:

Hi… I need an urgent help on Ionic 4 navigation issue, I am facing.

Brief description

  1. I have a UserPage that has a single input field to take user name and a button to move to next page of taking password as PasswordPage.

  2. On successful login on Password page, I land into dashboard page where bottom tab bars will appear.

  3. In normal case i.e. if I enter user name on UserPage and then click on next button in the same page to move on PasswordPage.After entering valid password I submit the page which calls api and then it lands in DashboardPage and here all bottom tabs on DashboardPage are working fine.

  4. However, here I get error when I enter user name on UserPage and move to PasswordPage and then If I click back to UserPage and then again come to PasswordPage and lands to DashboardPage, all tabs are freezed and no tab is clickable.

I am struggling with this issues since many days…I am finding no clue…I would be thankful for any help on this.

Posts: 1

Participants: 1

Read full topic

Viewing all 70986 articles
Browse latest View live


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