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

Ionic 4 OneSignal push notification click route to a page

$
0
0

@navod1997 wrote:

My code is working when my app running. but when app was closed it’s not working…

this is my app.component.ts file

I am using php api to create notification using onesignel. I attached some data to notification and I use it for navigate. actually that data is my navigation route…

import { Component } from '@angular/core';
 import { Platform, AlertController } from '@ionic/angular';
 import { StatusBar } from '@ionic- native/status-bar/ngx';
 import { OneSignal } from '@ionic-native/onesignal/ngx';
 import { Router } from '@angular/router';

@Component({
   selector: 'app-root',
 templateUrl: 'app.component.html'
    })
export class AppComponent {
 constructor(
private platform: Platform,
private statusBar: StatusBar,
private oneSignal: OneSignal,
private router: Router,
public alertController: AlertController,
public home: HomePage
) {
this.initializeApp();
}

initializeApp() {
this.platform.ready().then(() => {
  this.statusBar.styleDefault();

this.oneSignal.startInit('xxxxxxxxxxxx', 'xxxxxxx');

this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);

  this.oneSignal.handleNotificationReceived().subscribe(() => {
   // do something when notification is received

  });

  this.oneSignal.handleNotificationOpened().subscribe((data: any) => {
    // do something when a notification is opened

    if (data.notification.payload.additionalData.url && data.notification.payload.additionalData.id) {


      let rout = data.notification.payload.additionalData;

      let path = rout.url;

      let id = rout.id;

       let route = '/tabs/' + path + '/' + id;

       this.router.navigateByUrl(route);

    } else {

        // this.home.testnoti(JSON.stringify(data), JSON.stringify(data.notification.payload.additionalData));

      }


  });

  this.oneSignal.endInit();

 });
}
}

Posts: 1

Participants: 1

Read full topic


Does IONIC 1 support iOS12?

$
0
0

@ajitmore wrote:

Hi,

We have mobile application developed into IONIC 1. It is working fine with Android OS, but it is not working on iOS 12 devices. We are able to build an IPA file using XCode 10 with valid distribution certificate and provision profile. Once app is installed into iphone and open, it disappeared.

On simulator, I have tried with .app file, it is showing below log on service log service of an emulator.

UIKitApplication:{bundleId}
Program specified by service does not contain any valid architectures for this system.

services excited with abnormal code:78

Posts: 1

Participants: 1

Read full topic

Ionic 4 Current working directory is not a Cordova-based project

$
0
0

@thomaskim47 wrote:

Ionic Info
Ionic:

ionic (Ionic CLI) : 4.10.3 (C:\Users\thoma\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.4.0

System:

NodeJS : v8.11.4 (C:\Program Files\nodejs\node.exe)
npm : 6.5.0

Step to reproduce

  1. Start an ionic 4 project
  2. Try to add this plugin ‘cordova plugin add cordova-pdf-generator’

Error get
Current working directory is not a Cordova-based project

Posts: 1

Participants: 1

Read full topic

Where to initialize the admob pro plugin correctly

$
0
0

@To2gomes wrote:

Hello, recently acquire the admob-pro plugin license.
But I already have an application in production where I already used this plugin.
My implementation was as follows, on every page I wanted to display the ad I did the following:
Note: this I do in all the pages where I make the announcement call.
In the example here I use the home.
Come on.
I realize plugin and platform import:

import { AdMobPro } from '@ionic-native/admob-pro';
import { Platform } from 'ionic-angular';

then inside the construct make these settings

constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    public loadingCtrl: LoadingController,
    private toastCtrl: ToastController,
    platform: Platform,
    private admob: AdMobPro
  ) {
    platform.ready().then(() => {
      var admobid = {
          licença: "?????????????????????????????????????",
          banner: 'ca-app-pub-5884050189104927/9827819257',
          interstitial: 'ca-app-pub-5884050189104927/1013482083'
      };

      this.admob.createBanner({
          adId: admobid.banner,
          isTesting: false,
          autoShow: false,
          position: this.admob.AD_POSITION.BOTTOM_CENTER
      })

      this.admob.prepareInterstitial({
          adId: admobid.interstitial,
          isTesting: false,
          autoShow: true
      })
  });
  }

then logs down when performing a click event I make the announcement block call:
this.admob.showInterstitial();

openView(view) {
    this.navCtrl.push(ViewPage, { id: view.videos_id });
    this.admob.showInterstitial();
  }

and this follows on every page.

Now let’s get down to the problem:
Upon contacting the plugin developer he said the following:

Please set your license key in options first by calling setOptions (), createBanner (), and prepareInterstitial (). You only have to configure it once.

if (AdMob) AdMob.createBanner ({
licença: " sua licença",
adId: "your_ad_unit_id_for_banner_here"
});

he said that, it is not correct. You should not initialize the plug-in on each page.
You need to initialize the plug-in only once.
How do I make the plugin call only once.

Posts: 1

Participants: 1

Read full topic

Ionic4 Angular7 Capacitor HttpCLient @angular/common/http

$
0
0

@cengiz74 wrote:

Hello everybody, I would really apreciate some help. I am using the HttpClient ( import {HttpClient} from ''@angular/common/http'; ). I can log data and error returned when subscribing to httpClient.get for instance if the project is launched on a browser. But when I launch my project for android on a Samsung galaxy s8 + no logs get returned. It looks like if subscription was ignored. I am using Angular7, Ionic4 and Capacitor, here is the sample code used:

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

doTest() {
    console.log('Test'); // <-- Logging on both browser and Android
    this.httpClient.get('example.com').subscribe(
      data => console.log(data), // <-- Logging only in browser
      error => console.log(error), //  <-- Logging only in browser
    );
  }

Posts: 1

Participants: 1

Read full topic

Translate-ngx & Ionic 4

$
0
0

@blondie63 wrote:

Hi all, i’m using this code:

this.translate.get('ALERT_ERROR').subscribe(text => this.ALERT_ERROR = text);

but vs.code said me this:

@deprecated — Use an observer instead of a complete callback
@deprecated — Use an observer instead of an error callback
@deprecated — Use an observer instead of a complete callback

Can i use a better syntax ?
Thanks for help

Posts: 1

Participants: 1

Read full topic

How use the ionic-native/serial plugin

$
0
0

@chris389 wrote:

Hello,

I need to communicate with a device connected to OTG on a phone.

In the documentation( ionic 3) of the plugins there is an example for the part on the permission and the opening port bu nothing on the other function usable as read or registerReadCallback.

I tried to use read function like this :

readOnce(){
   let response = this.serial.read();
   console.log('response',response);
}

After use function write call function readOnce and response is each time an empty arrayBuffer whereas this should be ‘Cnx OK’.

Thank you in advance for you help.

Chris.

Posts: 1

Participants: 1

Read full topic

Create project with previous release

$
0
0

@lsantaniello wrote:

Hi all,
I need to create a project with v3 release but when I create a new project, it has release 4.x

Is it possible to use ionic cli to create a previous release project?

Thanks
Luca

Posts: 1

Participants: 1

Read full topic


NullInjectorError: No provider for NavController

$
0
0

@alexmigwi wrote:

I’ve read countless forum posts but I can’t figure out what am missing in my code which gives me the error.

"ERROR Error: “Uncaught (in promise): Error: StaticInjectorError(AppModule)[Content -> NavController]: StaticInjectorError(Platform: core)[Content -> NavController]: NullInjectorError: No provider for NavController!”

Here is my code – am trying to navigate away from the login page after a successful authentication but on getting to the navCtrl.push(‘pagename’) / navCtrl.setRoot(‘Pagename’) error occurs. Pages are lazyloaded.

import { IonicPage, NavController, NavParams, LoadingController } from 'ionic-angular';

`constructor(
public navCtrl: NavController,
public navParams: NavParams,
public storage: Storage,
public loadingCtrl: LoadingController,
public formBuilder: FormBuilder,
public WPService: WpServiceProvider,
public authHandler: AuthServiceProvider
) {

this.isLoggedIn = authHandler.isLoggedIn();
this.isLoggedIn.subscribe((data) => {
  console.log(data);
});

}`

`doLogin(value) {
let loading = this.loadingCtrl.create();
loading.present();
this.authHandler.doLogin(value.username, value.password).then((result) => {
if (result) {
console.log(this);
this.navCtrl.push(“HomePage”);
loading.dismiss();

  }
  else{
    throw new Error('Login Failed...');
  }
}, (err) => {
  console.error(err);
  loading.dismiss();
  // Error log
});

}`

The rest of the code to navigate away to other pages works…

doRegister() { this.navCtrl.push("RegisterPage"); }

The result of console.log(this) inside doLogin()
{…} ​ WPService: Object { http: {…}, wposts: 1, url: "http://localhost:8100/index.php/wp-json/wp/v2/", … } ​ authHandler: Object { localStorage: {…}, http: {…}, Config: {…}, … } ​ formBuilder: Object { } ​ isLoggedIn: Object { _isScalar: false, source: {…}, operator: {…} } ​ loadingCtrl: {…} ​​ _app: Object { _disTime: 0, _scrollTime: 0, _title: "Login", … } ​​ config: Object { _c: {…}, _s: {}, _modes: {…}, … } ​​ <prototype>: Object { create: create() , … } ​ login_form: Object { pristine: false, touched: true, status: "VALID", … } ​ navCtrl: Object { _config: {…}, _elementRef: {…}, _renderer: {…}, … } ​ navParams: Object { data: {} } ​ storage: Object { _driver: "asyncStorage", _dbPromise: {…} } ​ userData: Object { token: "", user_email: "", user_nicename: "", … } ​ <prototype>: Object { ionViewWillLoad: ionViewWillLoad(), doLogin: doLogin(), goHome: goHome(), … }

Posts: 1

Participants: 1

Read full topic

[Ionic 4]How do you remove the padding in .native-button?

$
0
0

@avex wrote:

I want to customize the button inside ion-item-option as Ionic3 style(full region) like.
However SHADOW show again without any --ion–xx way can be found.
So
How do you remove the padding in .native-button of <ion-item-option>?

Hope to change paddings in class “.button-native”
05

Use shadow web component is not a good idea, because Ionic4 doesn’t open enough, and designed to use shadow in a HURRY.

Posts: 1

Participants: 1

Read full topic

Ionic 4, logout method

$
0
0

@dev-gilbert wrote:

Hi guys, I was wondering what would be a nice implementation of a logout method, specifically which method from the navCtrl would you use?

I have this example:

 logout() {
    console.log("Logging out user");
    this.service.logout();
    this.navCtrl.navigateRoot("/welcome");
  }

But there is no animation at all, the logout method from the authService is only removing the token from the storage. Should I use navigateBack? or implement a loading or something?

Posts: 1

Participants: 1

Read full topic

Does ionic barcode scanner api supports multi barcode scan?

$
0
0

@kaurgurdeepjava wrote:

I am new to ionic development. I am building a mobile app that should have feature to scan multi barcodes. so far I get to know that scandit and manate works sdks support multi barcode scanning. However, these are paid. Is there any other sdks those support mobile multibarcode scanning. Does ionic barcode scanner has feature to scan multi barcodes. Either free or paid. any help will be appreciate.

Posts: 1

Participants: 1

Read full topic

Ion-datetime is frustrating

$
0
0

@helpmelearn wrote:

I have a ion-datetime to show just month and year.

<ion-datetime displayFormat=“MMM YYYY” picker-format=“M YYYY” [min]=“minDate” [max]=“currentDate” [(ngModel)]=“reportDate” name=“reportDate”>

I also only have it go back 24 months.
Starts off with Jan 2019.
Can’t go forward anymore (no other months are available).
I change the year to 2018, but no months show up. Then I select 2017 all the months show up.
I go back to 2018 and all the months still show up. Go back to 2019 only Jan shows up. It now works going back and forth.

I have also gotten it to update months if I go to 2018, only Jan shows up. Go back to 2019, then back to 2018 all months show up sometimes.
It seems like until I scroll so far does it realize it needs to refresh. But only scrolling one item, it doesn’t fire.

What is going on? Is this normal?

Posts: 1

Participants: 1

Read full topic

Flickering effect during navigation on iPhone

$
0
0

@dev-gilbert wrote:

I have no idea why this is happening, but when I run my app on my iPhone using the DevApp I found a flickering effect during the transition of the navigation animation. I tested it on Android and there’s no flickering effect, neither on the browser.

As for now I only have 3 routes: welcome, login and register. In my welcome screen I have to buttons to navigate either to login or register, here’s how my welcome.ts look like:

export class WelcomePage implements OnInit {
  constructor(private navCtrl: NavController) {}

  toLogin() {
    this.navCtrl.navigateForward("/login");
  }

  toRegister() {
    this.navCtrl.navigateForward("/register");
  }

  ngOnInit() {}
}

welcome.html

<ion-content class="welcome">
  <div class="welcome__container">
    <img class="welcome__logo" src="../../../assets/img/meet-logo.png" />
    <p class="welcome__text">
      Some text goes here...
    </p>
    <div class="welcome__btns-container">
      <ion-button
        expand="block"
        shape="round"
        class="btn-light btn-mb"
        (click)="toLogin()"
      >
        Sign in
      </ion-button>
      <ion-button
        expand="block"
        shape="round"
        class="btn-gradient"
        (click)="toRegister()"
        >Sign up</ion-button
      >
    </div>
  </div>
</ion-content>

Both my login and register pages are not loading any data, they are basically forms. Any help with this issue is greatly appreciated, I have no idea what might be causing this effect on iPhone only. Thanks in advance.

Posts: 1

Participants: 1

Read full topic

SVG Icon not appearing but others are

$
0
0

@sqr08 wrote:

29%20PM

Only 1 of my icons are not appearing, despite the code being the exact same for all of them. The icon is appearing on my web view and an android but not on my iOS simulator.

            <ion-row class="contactRows">
              <ion-icon aria-hidden="true" class="contactIcons" src="assets/contact_us_icons/pin_icon.svg"></ion-icon>
              <ion-label class="contactInfo addressInfo">
                <a *ngIf="this.platform.is('ios'); else isAndroid" href="http://maps.apple.com/?q={{advisor.addresses[j].full}}"
                  target="_blank">
                  <ion-row> {{advisor.addresses[j].address1}} </ion-row>
                  <ion-row *ngIf="advisor.addresses[j].address2"> {{advisor.addresses[j].address2}} </ion-row>
                  <ion-row> {{advisor.addresses[j].city + ' ' + advisor.addresses[j].province + ', ' + advisor.addresses[j].postal.substring(0,3) + ' ' + advisor.addresses[j].postal.substring(3,6)}} </ion-row>
                </a>
                <ng-template #isAndroid>
                  <a href="https://maps.google.com/?q={{advisor.addresses[j].full}}" target="_blank">
                    <ion-row> {{advisor.addresses[j].address1}} </ion-row>
                    <ion-row *ngIf="advisor.addresses[j].address2"> {{advisor.addresses[j].address2}} </ion-row>
                    <ion-row> {{advisor.addresses[j].city + ' ' + advisor.addresses[j].province + ', ' +
                      advisor.addresses[j].postal.substring(0,3) + ' ' + advisor.addresses[j].postal.substring(3,6)}}
                    </ion-row>
                  </a> 
                </ng-template>
              </ion-label>
            </ion-row>

this is what the code looks like if it helps.

thanks!

Posts: 1

Participants: 1

Read full topic


I cannot Open PDF File

$
0
0

@trustsolution wrote:

Hello Ionic Community :slight_smile:

i need a help for you , i want to make screen page by using ionic 4 , the screen contains

1- div , checkbox , button

the div contains PDF File viewer , when the user read the content in this PDF , the user should press the checkbox

Now the question is ? how i can show PDF content inside the PDF File ?

Best Reagrds ,

Posts: 1

Participants: 1

Read full topic

Black and white apps (v3, v4)

$
0
0

@tanojaja wrote:

Hi guys,

I’m running into a big problem in my android builds. I can’t figure it out what is going on… Each build in v3 or v4 generates the same result, an app with a broken css.

Here is how it looks in browser

And this is how it looks once built

Ionic info:

Ionic:

ionic (Ionic CLI) : 4.3.1 (/Users/user/.nvm/versions/node/v8.9.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.0.2
@angular-devkit/build-angular : 0.12.4
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.2.4
@ionic/angular-toolkit : 1.4.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 4 other plugins)

System:

Android SDK Tools : 26.1.1 (/Users/user/Library/Android/sdk)
NodeJS : v8.9.0 (/Users/user/.nvm/versions/node/v8.9.0/bin/node)
npm : 6.4.1
OS : macOS Sierra
Xcode : Xcode 9.2 Build version 9C40b

PD: I’ve tried the latest version of node, then downgrade to 8, rebuilding node-sass, even using another devices with android 8, 7, etc but nothing work :frowning:

Posts: 1

Participants: 1

Read full topic

How to record my voice and meanwhile play background music

$
0
0

@Liza1201 wrote:

I am building music app now, but faced some technical issue.
I played the background music and at the same time tried to record my voice.
It’s smiliar with karaoke.
But I can’t do both of them at a time.
If I try one, then another is turned off.
Who can help me, please?

Posts: 1

Participants: 1

Read full topic

Click to slide open and close ion-item-sliding on Ionic 4

Bug with --prod only

$
0
0

@JerryBels wrote:

Hello,

I have a VERY strange bug which I have absolutely no idea how to debug.

When building my ionic app and launching on my Android, it works just fine. But, when I add the --prod flag - which I do every time I want to show something to the customer - I have that angular error :

 main.5e301c2a6dc3a49ec613.js:1 ERROR Error: StaticInjectorError[t -> e]: 
  StaticInjectorError(Platform: core)[t -> e]: 
    NullInjectorError: No provider for e!
    at t.get (main.5e301c2a6dc3a49ec613.js:1)
    at main.5e301c2a6dc3a49ec613.js:1
    at t (main.5e301c2a6dc3a49ec613.js:1)
    at t.get (main.5e301c2a6dc3a49ec613.js:1)
    at main.5e301c2a6dc3a49ec613.js:1
    at t (main.5e301c2a6dc3a49ec613.js:1)
    at t.get (main.5e301c2a6dc3a49ec613.js:1)
    at oi (main.5e301c2a6dc3a49ec613.js:1)
    at t.get (main.5e301c2a6dc3a49ec613.js:1)
    at Qi (main.5e301c2a6dc3a49ec613.js:1)

And the app doesn’t load at all. Not very helpfull - which is expected since it’s --prod. I could very well rollback every change I made since the last time it worked, and check line by line… But it would take an awful amount of time, and also I really think there is a more logical way to get to it.

Thanks ahead.

Posts: 1

Participants: 1

Read full topic

Viewing all 70439 articles
Browse latest View live


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