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

iOS sometimes loses angular variables when resuming from the background

$
0
0

I have a number of variables that get set when someone logs into my App, these then get used throughout the application.

The majority of the time this works great but sometimes on iOS devices (this doesn’t seem to affect Android) when the App is resumed from the background these variables are lost therefore causing errors.

Does anyone know why this happens or what the best solution is to the problem?

I do also store these variables in local storage so possibly some sort of getter/setter that can check if the value is null or undefined and if so pull it from local storage. If this is the case then I would imagine I will need to do quite a bit of reworking because I would need to wait for the local storage promise to return the value (using “then”) and I would not be able to use the current method where I am just referencing the variable directly (code examples below).

Below is an example of class I use to store the variables:

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class GlobalProvider {

  // Global variables
  public authToken: string;
  public customerId: string;
  public version: any;
  public build: any;
}

The following shows how I set the “customerId” in local storage but also set it on the GlobalProvider class shown above:


  // This gets called when the user logs in
  this.authLocal.setCustomerId(1234);

  // This is the method that gets called above and sets the customer ID in 
 // local storage but also sets in on the GlobalProvider class
  setCustomerId(customerId) {

    return new Promise((resolve) => {
      this.storage.ready().then(() => {
        this.storage.set('customerId', customerId).then((value) => {

          // Set global variable
          this.global.customerId = value;

          // Return true
          resolve(true);
        });
      });
    });
  }

Below is how I then get and use the “customerId” throughout my App but as stated above, sometimes on iOS devices when the App resumes from the background this value is undefined:

const test = 'customerid=' + this.global.customerId;

Has anyone had this problem before or got any thoughts as the best practice to resolve it, ideally without having to put everything in a “then” after it has retrieved the value from local storage?

1 post - 1 participant

Read full topic


Ionic app compile

$
0
0

Hi
I have ubuntu and i make app for android but my question how to compile ios app in ubuntu any alternate way ?? its possible or only mac os need :pensive: i try find xcode but :sob: :sob:

1 post - 1 participant

Read full topic

Is Deploying a Live Update a free feature of Ionic?

New iOS app will not install

$
0
0

just starting with appflow after using Phonegap build.

The Android app builds, installs and runs OK. The iOS app builds, but will not install on a provisioned iPAD. The .ipa does not try to install - its just a file like any other (there is no error)

I am trying to think of why this might happen. My only idea is that the iPad is not in the provisioning file (I will have to double check).

Are there any other possibilities?

1 post - 1 participant

Read full topic

Storage.get returns null on init app

$
0
0

Hi, im using Storage module, my problem is when i try to get stored data on application init.
the first time no data is loaded, when i call a second time the same method ( " this.storeService.getUserData(); ") data is loaded well.

i have called my storage service on constructor of my homepage.ts, like this:

//Ready event is raised well, if i put a toast here it is shown
  this.plt.ready().then((readySource) => {
       this.dataUser= this.storeService.getUserData(); 
    });

in getUserData Method i have the folowing code:

getUserData(){
  this.getStoreduser(); 
  return JSON.parse(this.userData);
}

and in the StoreService class constructor i have:


//I have tried without storage.ready but is the same
this.storage.ready().then((readySource) => {
        this.getStoreduser();
 
      });

and the method getStoredUser:

async  getStoreduser(){
    await this.storage.get(this.KEY_USR).then(res=>{
       this.userData=res;

    },err=>{
      return null;
    });
   }

i dont know what is my problem, can you help me please?

Regards

1 post - 1 participant

Read full topic

How To Use Storybook with Ionic and ReactJS

Getting typescript errors on compilation but not on serve

$
0
0

I am all of a sudden getting the following errors that weren’t there a few days ago.

ERROR in src/app/gap-game/gap-game.page.html(61,75): The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
src/app/gap-game/gap-game.page.html(60,141): The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
src/app/transformation-game/transformation-game.page.html(80,86): The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
src/app/transformation-game/transformation-game.page.html(79,151): The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
src/app/transformation-game/transformation-game.page.html(91,89): The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

These don’t make sense; in the first case, 61,75 is a space character. These errors do not show up in either ionic serve or the more complicated way of doing live-reload on-device.

This is the latest Ionic 5, latest cordova, Angular 9 all up to date, TS 3.8.3. Any guidance would be greatly appreciated.

1 post - 1 participant

Read full topic

How to listen coming sms and read it

$
0
0

Is there any way to read SMS when it arrives using IONIC 4? I need to trigger some actions when the incoming message has a specific text. I saw this cordova-sms-plugin , but it can only send SMS. Any help in this regard would be helpful. I see many apps reading my messages, but why can’t I do it with IONIC?

1 post - 1 participant

Read full topic


Ion-note not showing correctly on device

$
0
0

I have this list:

  <ion-list inset="false" lines="full">
    <ion-item *ngFor="let item of detail">
      <ion-label>
        <h3>{{item.QUANTITY}} x {{item.DESCRIPTION}}</h3>
      </ion-label>
      <ion-note>{{getItemSubTotal(item)}}</ion-note>
    </ion-item>
  </ion-list>

and it looks perfectly on the browser:
Screen Shot 2020-06-18 at 8.18.19 PM

but when I build and install the app on my Android emulator, it looks like this:
Screen Shot 2020-06-18 at 8.17.06 PM

Any ideas about why the difference ??

1 post - 1 participant

Read full topic

Image upload from gallery or camera

$
0
0

Hi,

I have a ionic app which stores the data in sqlite database , here we want to provide a functionality where we want to upload images and associate them with the database record, like one comment can have multiple images, such type of relationship.

Can any one suggest how to achieve this in optimum way.

Thanks,
Seema Sharma

1 post - 1 participant

Read full topic

My ion modal screen is not displayed in fullscreen when I select iPad simulator

Combine ionic pwa with php

Ionic 5 ion-slides as "Virtual Slides"

$
0
0

I need to create an infinite slide list and it looks like ion-slides as “Virtual Slides” is the way to go.

However, I can’t see how I would do that in ionic and Google doesn’t yield much of use. Has anyone managed to do this? If so then any pointer would be appreciated. Thank you!

1 post - 1 participant

Read full topic

Ionic 5 with Capacitor - ITMS-90809: Deprecated API Usage

$
0
0

I have the following dependencies / Ionic packages in my application

 "@capacitor/android": "^1.5.0",
 "@capacitor/core": "2.2.0",
 "@capacitor/ios": "^2.2.0",
 "@ionic-native/barcode-scanner": "^5.21.5",
 "@ionic-native/call-number": "^5.23.0",
 "@ionic-native/clipboard": "^5.23.0",
 "@ionic-native/core": "^5.21.5",
 "@ionic-native/facebook": "^5.21.6",
 "@ionic-native/launch-navigator": "^5.23.0",
 "@ionic/react": "^5.0.7",
 "@ionic/react-router": "^5.0.7",
 "call-number": "^1.0.1",
 "chart.js": "^2.9.3",
 "cordova-clipboard": "^1.3.0",
 "cordova-plugin-actionsheet": "^2.3.3",
 "cordova-plugin-dialogs": "^2.0.2",
 "cordova-plugin-facebook4-no-zxing": "^4.2.2", 
 "uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.4"

The Ionic command line version is 5.4.12 and Capacitor command line version (npx cap --version) is 1.5.2.

However, when I upload the iOS app to App Store, I immediately get the deprecated warning saying it’s using UIWebView. I tried creating a new project (migrated the dependencies from the older project making sure the latest version is installed) and tried generating ios and android projects from the latest version, still I get the deprecation warning.

I was under the impression that Capacitor used WkWebView by default and this wouldn’t be an issue. Also, I installed all the plugins as mentioned under the Native APIs - https://ionicframework.com/docs/native

Anybody else facing this or resolved this?

1 post - 1 participant

Read full topic

Nginx 405 Not allowed when another site redirects to my Ionic app

$
0
0

I have an app that connects various payment gateways. When payment gateway navigates back to my site using url example.com/after-payment-success or example.com/after-payment-failed I get a 405 not allowed from Nginx.

If I visit the page direct from my browser there is no problem also when I refresh the exact same page with the 405 error it loads perfectly fine.

It seems to be related to programmatic redirection to my site from payment gateway.

Details: Site is hosted in a AWS which redirects to http so Nginx doesn’t have to.

1 post - 1 participant

Read full topic


Firebase storage/unauthorized due to Storage Rule

$
0
0

Hello Group,

My dev has run into Firebase Phone Auth error:

I use this plugin to Phone auth https://ionicframework.com/docs/native/firebase-authentication. So how can I transfer that Auth details to the AngulraFireAuth?

Original

I have a Firebase Storage bucket permission like so:

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write:if request.auth != null;
    }
  }
}

Client-side code: i.e. upload an image

 console.log('user', await this.afAuth.currentUser); //null

 const filePath: string = `signatures/${user.uid}`;

 const afUploadTask: AngularFireUploadTask = afStorageReference.putString(imageDataUrl, 'data_url');

But it fails:

vendor.js:44100 ERROR Error: Uncaught (in promise): FirebaseStorageError: {“code_”:“storage/unauthorized”,“message_”:“Firebase Storage: User does not have permission to access ‘signatures/gx3TlaSFQoPhQXCnjk3QCrq2j9x1’.”,“serverResponse_”:"{\n “error”: {\n “code”: 403,\n “message”: “Permission denied. Could not perform this operation”\n }\n}",“name_”:“FirebaseError”}

So how can I configure this kind of rule with Storage? Without any rule above code is working fine.

Here is the link to the above:

Any help would be much appreciated

1 post - 1 participant

Read full topic

Runtime Error Object (...) is not a function

$
0
0

how to fix this issue? I attach my package.json file.

{

“name”: “slendo-app”,

“version”: “0.0.1”,

“author”: “Ionic Framework”,

“homepage”: “http://ionicframework.com/”,

“private”: true,

“scripts”: {

"start": "ionic-app-scripts serve",

"clean": "ionic-app-scripts clean",

"build": "ionic-app-scripts build",

"lint": "ionic-app-scripts lint"

},

“dependencies”: {

"@agm/core": "^1.0.0-beta.6",

"@angular/animations": "5.2.11",

"@angular/common": "5.2.11",

"@angular/compiler": "5.2.11",

"@angular/compiler-cli": "5.2.11",

"@angular/core": "5.2.11",

"@angular/fire": "^5.2.1",

"@angular/forms": "5.2.11",

"@angular/http": "5.2.11",

"@angular/platform-browser": "5.2.11",

"@angular/platform-browser-dynamic": "5.2.11",

"@ionic-native/core": "~4.20.0",

"@ionic-native/document-viewer": "^4.20.0",

"@ionic-native/file": "^4.20.0",

"@ionic-native/file-transfer": "^4.20.0",

"@ionic-native/in-app-browser": "^4.20.0",

"@ionic-native/launch-navigator": "^4.20.0",

"@ionic-native/native-storage": "^4.20.0",

"@ionic-native/network": "^4.20.0",

"@ionic-native/open-native-settings": "^4.20.0",

"@ionic-native/photo-viewer": "^4.20.0",

"@ionic-native/push": "^4.20.0",

"@ionic-native/social-sharing": "^4.20.0",

"@ionic-native/splash-screen": "~4.20.0",

"@ionic-native/sqlite": "^4.20.0",

"@ionic-native/status-bar": "~4.20.0",

"@ionic-native/youtube-video-player": "^4.20.0",

"@ionic/cli-plugin-cordova": "^1.6.2",

"@ionic/storage": "2.2.0",

"@types/yup": "^0.26.26",

"angularfire2": "^5.2.1",

"chart.js": "^2.8.0",

"com-sarriaroman-photoviewer": "^1.2.4",

"cordova-android": "git+https://github.com/apache/cordova-android.git",

"cordova-android-firebase-gradle-release": "^4.0.0",

"cordova-android-support-gradle-release": "^3.0.1",

"cordova-ios": "5.1.1",

"cordova-open-native-settings": "^1.5.2",

"cordova-plugin-actionsheet": "^2.3.3",

"cordova-plugin-androidx": "^1.0.2",

"cordova-plugin-androidx-adapter": "^1.1.0",

"cordova-plugin-device": "2.0.2",

"cordova-plugin-dialogs": "^2.0.2",

"cordova-plugin-document-viewer": "^0.9.13",

"cordova-plugin-file": "^6.0.2",

"cordova-plugin-file-transfer": "^1.7.1",

"cordova-plugin-firebasex": "^6.0.1",

"cordova-plugin-inappbrowser": "^3.1.0",

"cordova-plugin-ionic-keyboard": "^2.0.5",

"cordova-plugin-ionic-webview": "^4.0.0",

"cordova-plugin-nativestorage": "^2.3.2",

"cordova-plugin-network-information": "^2.0.2",

"cordova-plugin-splashscreen": "5.0.2",

"cordova-plugin-statusbar": "2.4.2",

"cordova-plugin-whitelist": "1.3.3",

"cordova-plugin-x-socialsharing": "^5.6.0",

"cordova-plugin-youtube-video-player": "^2.3.0",

"cordova-sqlite-storage": "^3.4.0",

"cordova-support-google-services": "git+https://github.com/LuisEGR/cordova-support-google-services.git",

"es6-promise-plugin": "^4.2.2",

"expo-cli": "^3.11.1",

"firebase": "^6.3.1",

"ionic": "5.0.3",

"ionic-angular": "3.9.5",

"ionic2-super-tabs": "^5.2.0",

"ionicons": "3.0.0",

"moment": "^2.24.0",

"ng2-charts": "^2.3.0",

"ng2-charts-x": "^2.0.6",

"phonegap-plugin-multidex": "^1.0.0",

"phonegap-plugin-push": "^2.3.0",

"rxjs": "^6.0.0",

"rxjs-compat": "^6.0.0",

"sw-toolbox": "3.6.0",

"uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.4",

"webpack": "^3.11.0",

"zone.js": "0.8.29"

},

“devDependencies”: {

"@ionic/app-scripts": "^3.2.4",

"@ionic/cli-plugin-ionic-angular": "1.4.1",

"@ionic/lab": "2.0.3",

"cordova-plugin-device": "^2.0.2",

"cordova-plugin-ionic-keyboard": "^2.2.0",

"cordova-plugin-ionic-webview": "^4.1.2",

"cordova-plugin-splashscreen": "^5.0.2",

"cordova-plugin-statusbar": "^2.4.2",

"cordova-plugin-whitelist": "^1.3.3",

"typescript": "~3.7.3"

},

“description”: “An Ionic project”,

“cordova”: {

"plugins": {

  "cordova-plugin-whitelist": {},

  "cordova-plugin-statusbar": {},

  "cordova-plugin-device": {},

  "cordova-plugin-splashscreen": {},

  "cordova-plugin-ionic-webview": {

    "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"

  },

  "cordova-plugin-ionic-keyboard": {},

  "cordova-plugin-file-transfer": {},

  "cordova-plugin-file": {},

  "cordova-plugin-document-viewer": {},

  "cordova-plugin-androidx": {},

  "cordova-plugin-androidx-adapter": {},

  "uk.co.workingedge.phonegap.plugin.launchnavigator": {

    "GOOGLE_API_KEY_FOR_ANDROID": "####################################",

    "OKHTTP_VERSION": "3.12.0"

  },

  "cordova-plugin-youtube-video-player": {},

  "cordova-plugin-network-information": {},

  "cordova-open-native-settings": {},

  "cordova-plugin-x-socialsharing": {

    "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"

  },

  "com-sarriaroman-photoviewer": {},

  "cordova-plugin-inappbrowser": {},

  "phonegap-plugin-push": {

    "SENDER_ID": "558310504895",

    "ANDROID_SUPPORT_V13_VERSION": "27.+",

    "FCM_VERSION": "11.6.2"

  },

  "cordova-plugin-nativestorage": {},

  "cordova-sqlite-storage": {},

  "cordova-support-google-services": {}

},

"platforms": [

  "android"

]

}

}

1 post - 1 participant

Read full topic

How to build web in Ionic 5

$
0
0

I am trying to build web app using Ionic 5
I have tried:

ionic cordova build browser --prod --release

and

ionic serve --prod

both failed and have error like:

1. If 'ion-header' is an Angular component, then verify that it is part of this module.
2. If 'ion-header' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
1. If 'ion-icon' is an Angular component, then verify that it is part of this module.
2. If 'ion-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the'@NgModule.schemas' of this component to suppress this message.

It seems that when building production, it doesnot regconize ionic component.

I am fine when I use following command:

ionic serve

so how to deal with it?
Thanks

1 post - 1 participant

Read full topic

Ion-radio checked color as gradient

Apk is Not installing in Samsung Note 10+ Device

Viewing all 71531 articles
Browse latest View live


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