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

Can I use Ionic Pro (appflow) with ionic-v1?


Ionic Versions?

$
0
0

@jaga6 wrote:

Hi, I am new in this environment, so I am following some tutorials like http://masteringionic.com/blog/2017-08-02-using-the-web-audio-api-with-ionic/

I have tried a few more and in all of them I found the same problems, the providers don’t exist, the directories created are different, also the imports root like ionic-angular don’t work and I have to use @ionic/angular but with this, I have an error of “has no exported member”.

That could be possible due to the different ionic version?

Posts: 1

Participants: 1

Read full topic

Is this update safe

Qr code conflito ionic 3

How to show results on different lines Ionic-select

$
0
0

@Riley8 wrote:

Im trying to display the selected values from an ionic select with one per line instead of comma separated.
I’ve tried setting css classes and using white-space: pre-wrap but nothing seems to work

HTML

<ion-label padding class="dropdown-row" *ngIf="ready == true">
    Work Performed
    <ion-select multiple="" class="wpSelect"
        formControlName="workPerformed"
        [(ngModel)]="repairCodeSelect">
        <ion-option *ngFor="let item of repairCodes" [value]="item.repair_code" class="wpSelect">
            {{item.repair_code}}<br/> \n ahh
        </ion-option>
    </ion-select>
</ion-label>

CSS

.dropdown-row {
    border-color: green;
    border-top-style: outset;

    display: grid;
  }

  .wpSelect {
    white-space:pre-wrap;
    line-break: anywhere;
    color: green;
  }

Posts: 1

Participants: 1

Read full topic

Execute method after validation. Ionic 4

$
0
0

@jscabuzzo wrote:

Hi everyone
I need execute a method when a form control its validated.
i tested (ionChange) with debounce and it runs without validating the control after the specified time. therefore the validation shows the control in red, but after the time it executes the method.
How could I execute the method once validated in form control?
I hope everyone understands my need.
Best regards.
Joaquín.

Posts: 1

Participants: 1

Read full topic

Ionic 4 - PWA and navigation

$
0
0

@Kyrax80 wrote:

Hello,

I’d like to know why when I go here in my PWA: http://ulisesceca.com the url becomes http://ulisesceca.com/home

but if i try to go directly to http://ulisesceca.com/home by typing it in the browser, it tells me it can’t find that page?

My route code is this:

import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  { path: '', redirectTo: '/home', pathMatch: 'full' },
  { path: 'home', loadChildren: './home/home.module#HomePageModule' },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
  ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Thanks.

Posts: 3

Participants: 2

Read full topic

Blank White Screen After Ionic V3 --prod --release Build

$
0
0

@dalezak wrote:

We just started getting a blank white screen after doing npm run ionic:build --prod --release, previously had no problems doing --prod --release builds.

There are no errors in the console, the only warning in the server logs is "GET /build/sw-toolbox.js.map" Error (404): "Not found" but not sure it’s that’s an issue or not.

Older posts on the forums didn’t seem to resolve the issue, we’re currently using latest @ionic/app-scripts version 3.2.4.

Strangely, doing npm run ionic:build works fine. Could the issue be related to enableProdMode on Angular?

Here is our package.json file:

{
  "name": "app-name",
  "version": "2.11.0",
  "author": "our company",
  "homepage": "https://www.ourwebsite.org",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "ionic:watch": "ionic-app-scripts watch",
    "test": "karma start ./config/karma.conf.js",
    "test-ci": "karma start ./config/karma.conf.js --single-run",
    "test-coverage": "karma start ./config/karma.conf.js --coverage",
    "e2e": "npm run e2e-update && npm run e2e-test",
    "e2e-test": "protractor ./config/protractor.conf.js",
    "e2e-update": "webdriver-manager update --standalone false --gecko false"
  },
  "config": {
    "ionic_copy": "./config/copy.config.js",
    "ionic_webpack": "./config/webpack.config.js",
    "ionic_source_map_type": "source-map",
    "ionic_generate_source_map": true,
    "ionic_move_source_maps": true
  },
  "dependencies": {
    "@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/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/app-availability": "~4.15.0",
    "@ionic-native/app-version": "~4.15.0",
    "@ionic-native/badge": "~4.15.0",
    "@ionic-native/camera": "~4.15.0",
    "@ionic-native/contacts": "~4.15.0",
    "@ionic-native/core": "~4.15.0",
    "@ionic-native/deeplinks": "~4.15.0",
    "@ionic-native/device": "~4.15.0",
    "@ionic-native/diagnostic": "~4.15.0",
    "@ionic-native/fcm": "~4.15.0",
    "@ionic-native/file": "~4.15.0",
    "@ionic-native/file-transfer": "~4.15.0",
    "@ionic-native/firebase": "~4.15.0",
    "@ionic-native/geolocation": "~4.15.0",
    "@ionic-native/http": "~4.15.0",
    "@ionic-native/in-app-browser": "~4.15.0",
    "@ionic-native/intercom": "~4.15.0",
    "@ionic-native/is-debug": "~4.15.0",
    "@ionic-native/keyboard": "~4.15.0",
    "@ionic-native/native-geocoder": "~4.15.0",
    "@ionic-native/native-storage": "~4.15.0",
    "@ionic-native/network": "~4.15.0",
    "@ionic-native/screen-orientation": "~4.15.0",
    "@ionic-native/sim": "~4.15.0",
    "@ionic-native/social-sharing": "~4.15.0",
    "@ionic-native/splash-screen": "~4.15.0",
    "@ionic-native/sqlite": "~4.15.0",
    "@ionic-native/status-bar": "~4.15.0",
    "@ionic-native/themeable-browser": "~4.15.0",
    "@ionic/storage": "2.2.0",
    "cordova-android-support-gradle-release": "^1.4.7",
    "cordova-browser": "5.0.4",
    "cordova-custom-config": "^5.1.0",
    "cordova-plugin-add-swift-support": "^1.7.1",
    "cordova-plugin-advanced-http": "^1.11.1",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-appavailability": "^0.4.2",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-contacts": "^2.3.1",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-firebase": "^2.0.5",
    "cordova-plugin-firebase-analytics": "^1.0.0",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-intercom": "^6.2.0",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^4.0.1",
    "cordova-plugin-is-debug": "^1.0.0",
    "cordova-plugin-nativegeocoder": "^2.0.5",
    "cordova-plugin-nativestorage": "^2.3.2",
    "cordova-plugin-network-information": "^1.3.4",
    "cordova-plugin-screen-orientation": "^2.0.2",
    "cordova-plugin-sim": "^1.3.3",
    "cordova-plugin-splashscreen": "^4.1.0",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-themeablebrowser": "^0.2.18",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.4",
    "cordova-sqlite-storage": "^2.6.0",
    "cordova-universal-links-plugin": "^1.2.1",
    "cordova.plugins.diagnostic": "^3.9.2",
    "es6-promise-plugin": "^4.2.2",
    "firebase": "4.9.1",
    "ionic-angular": "3.9.2",
    "ionic-plugin-deeplinks": "^1.0.20",
    "ionicons": "3.0.0",
    "ios-sim": "^9.0.0-dev.4",
    "moment": "^2.18.1",
    "ng-intercom": "0.2.2",
    "ngx-localstorage": "2.0.1",
    "ngx-segment-analytics": "^1.0.4",
    "raven-js": "^3.27.1",
    "rxjs": "5.5.11",
    "sw-toolbox": "^3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.4",
    "@types/es6-promise": "^3.3.0",
    "@types/jasmine": "=2.8.9",
    "@types/node": "^8.0.45",
    "angular2-template-loader": "^0.6.2",
    "codelyzer": "^4.5.0",
    "html-loader": "^0.5.1",
    "ionic-version": "^1.0.3",
    "istanbul-instrumenter-loader": "^3.0.0",
    "jasmine": "^2.5.3",
    "jasmine-spec-reporter": "^4.1.0",
    "karma": "^4.0.1",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage-istanbul-reporter": "^1.3.0",
    "karma-jasmine": "^1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "^2.0.3",
    "null-loader": "^0.1.1",
    "protractor": "^5.4.0",
    "tar": ">=4.4.2",
    "ts-loader": "^3.0.3",
    "ts-node": "^3.0.2",
    "typescript": "^3.0"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ],
  "description": "TenFour App",
  "cordova": {
    "plugins": {
      "cordova-plugin-app-version": {},
      "cordova-plugin-appavailability": {},
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": "This app would like to access your camera.",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": "This app would like to access your photo library."
      },
      "cordova-plugin-contacts": {
        "CONTACTS_USAGE_DESCRIPTION": "This app would like to access your contacts."
      },
      "cordova-plugin-device": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "This app would like to access your location."
      },
      "cordova-plugin-is-debug": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-sim": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-x-socialsharing": {},
      "cordova-sqlite-storage": {},
      "cordova.plugins.diagnostic": {},
      "ionic-plugin-deeplinks": {
        "URL_SCHEME": "tenfour",
        "DEEPLINK_SCHEME": "https",
        "DEEPLINK_HOST": "app.ourwebsite.org",
        "ANDROID_PATH_PREFIX": "/"
      },
      "cordova-custom-config": {},
      "cordova-plugin-themeablebrowser": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-nativegeocoder": {
        "LOCATION_WHEN_IN_USE_DESCRIPTION": "This app would like to use a geocoder service."
      },
      "cordova-plugin-screen-orientation": {},
      "cordova-plugin-badge": {},
      "cordova-plugin-advanced-http": {},
      "cordova-plugin-firebase": {},
      "cordova-android-support-gradle-release": {
        "ANDROID_SUPPORT_VERSION": "26.+"
      },
      "cordova-plugin-intercom": {},
      "cordova-plugin-nativestorage": {},
      "cordova-plugin-ionic-keyboard": {}
    },
    "platforms": [
      "browser"
    ]
  }
}

Posts: 1

Participants: 1

Read full topic


Provider Returning Undefined (First Time) and correct (Second Time)

$
0
0

@Hawllysson wrote:

Object User:

export interface User
{
	uid?: string;
	name?: string;
	email?: string;
	gender?: string;
	birthDate?: string;
	phone?: string;
	password?: string;
}

Provider:

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

import { User } from '../interfaces/user';

@Injectable
({
  providedIn: 'root'
})

export class NavParamsProvider
{
  private user: User;

  constructor()
  {
    this.user = null;
  }

  getUser (): User
  {
    return this.user;
  }

  setUser (usr: User)
  {
    this.user = usr;
  }
}

Page Login (set):

async login()
{
  ... Code await ...

  if (this.loginForm.valid)
  {
    this.navParamsProvider.setUser(doc.data());
    this.router.navigateByUrl('/tabs/profile');
  }
}

Page Profile (get):

  ngOnInit()
  {
    console.log(this.navParamsProvider.getUser());
  }

When I redirect to the Profile page the User object is undefined. But on the second call it already exists.

Posts: 1

Participants: 1

Read full topic

Correct way of using Local Storage Variables

$
0
0

@egaldamez wrote:

Hello everybody, im having a little bit of an issue but im not sure if its my inexperience or something else hope someone can help me.
I have a login form that sends info to my backend and if everything its successful sends me to the main page of the app.
When the backend responds with error code 200 meaning all was successful, i store data to my local storage to use it along the app usage like Client name.
This is part of my login function:
Im using Angular Http module, to make the post into my backend and then i store it on my local storage.

this.GetService.getData(LOGINPREM?${urlSearchParams.toString()})
.subscribe(async data => {
this.result = JSON.stringify(data); // get data in result variable
this.allData = JSON.parse(this.result); // parse json data and pass json string
this.dataService.setjsonresult(this.result);
// alert(this.dataService.getjsonresult());
this.storage.set(‘ID’, this.allData[‘Cliente’]);
this.storage.set(‘Nombre’, this.allData[‘Nombre’]);
this.storage.set(‘Puntos’, this.allData[‘SaldoPuntos’]);
this.storage.set(‘Auth’, 1 );
this.GetService.id = this.allData[‘Cliente’];
this.GetService.cliente = this.allData[‘Nombre’];
this.GetService.puntos = parseInt(this.allData[‘SaldoPuntos’], 0 );
this.GetService.isOk = 1;
this.authService.login();
if (this.allData[‘Error’]== 200) {
const toast = await this.toastController.create({
message: "Bienvenido " + this.allData[‘Nombre’],
position: ‘top’,
duration: 2000
});
toast.present();
this.router.navigateByUrl(’/menu’);
return false;
} else {
const toast = await this.toastController.create({
message: "Codigo de Error: " + this.allData[‘Error’] + " Descripcion: " + this.allData[‘Descripcion’] ,
position: ‘top’,
duration: 2000
});
toast.present();
this.router.navigateByUrl(‘login’);
return false;
}

When i get to the main page on the ngOnInit, i use the this.storage.get to get all the variables i need like username for example.

This is my ngOnInit.ts

ngOnInit() {
this.isOk = this.newsService.isOk;
if (this.isOk) {
this.id = this.newsService.id;
this.cliente = this.newsService.cliente;
this.points = this.newsService.puntos;
} else {
this.storage.get(‘ID’).then((id) => {
this.id = id;
const urlSearchParams = new URLSearchParams();
urlSearchParams.append(‘cliente’, id);
this.newsService.getData(puntos?${urlSearchParams.toString()}).subscribe(data => {
this.data = data;
if (this.data[‘Error’] === 200) {
this.storage.set(‘Puntos’, this.data[‘SaldoPuntos’]);
this.points = parseInt(this.data[‘SaldoPuntos’], 0 );
}
});
});
this.storage.get(‘Nombre’).then((cliente) => {
this.cliente = cliente;
});
}
// this.auth();
}

I tried to store all the values in a middle service just to make sure i have the information available when getting into the main page.

My problem is when its the first time and ONLY in the first time my main page shows up, seems like the info is not ready when im trying to use it (this.cliente variable) appears empty when i display it on my html.
And when im running ionic serve on chrome i check all the information on the local storage and its there already.
How it looks like the first time i get to the main page:

How it SHOULD look like when i get to the main page, and how it looks after refreshing the page or closing and getting the app on again on device:

So i think theres a problem with how im trying to retrieve all the data.

Should i use: this.storage.ready and inside the then retrieve all the data?
i.e

this.storage.ready().then(() => {
/** set / get some data from the local storage */
}).catch((error: Error) => {
console.error(error);
return;
})

Or i’m doing something else wrong?

Thanks for your time to read my problem, have a great day.

Posts: 1

Participants: 1

Read full topic

View doesn't return anything

$
0
0

@Dule84 wrote:

Well I have problem with my app. I work on some basic movie app and I can’t fetch data from API with id parameter. My code look like this.
Home.ts

goToMovie(single: any) {
    let id = single;
    console.log(id);
    this.nav.push(SinglePage, {id: id});
  }

Single.ts

export class SinglePage {

  data: Movies = <Movies>{};
  id: any;

  constructor(public navCtrl: NavController, 
                     public navParams: NavParams, 
                     private movies: MoviesServiceProvider) {}

  ionViewDidLoad() {
    this.id = this.navParams.get("id");
    this.movies.getMovie(this.id)
        .then(res => { this.id = res[0]; });
    console.log(this.id);
  }
}

Single.html

<ion-header>
  <ion-navbar>
    <ion-title>single</ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding *ngIf="data">
  <p>{{data?.title}}</p>
</ion-content>

Interface.ts

export interface Movies {
    id: number,
    title: string,
    description: string,
    link: string,
    image: string,
}

Service.ts

getMovie(id: number): Promise<Movies> {
        return this.http.get('http://localhost:8000/api/movie/' + id)
            .toPromise()
            .then(response => response.json().data as Movies);
    }

My problem is that nothing is rendered in view of single.ts. In console I get expected results, values from id’s are correct. Also I don’t get any errors so if anybody knows what is problem I would be very grateful. I usually work in PHP and I didn’t work in Ionic for very long time.

Posts: 1

Participants: 1

Read full topic

Paginate API data

$
0
0

@robertnic wrote:

Hi there,

I have data returned by API and I need to paginate the results by infinite scroll, getting all data at once is a source killer for me and also takes long time.

Logic

  1. Page shows loading and gets first 10 data of API result (currently have loading but it gets all data)
  2. infinite scroll (each time add 10 more data till last one)

Code

Provider

import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { LoadingController } from '@ionic/angular';

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

  apiUrl = 'https://example.com/api/categories';

  constructor(private http: HttpClient, private loadingCtrl: LoadingController) { }

  getDetails(url) {
    const httpOptions = {
      headers: new HttpHeaders({
        'Accept': 'application/json, text/plain',
        'Content-Type': 'application/json'
      })
    };

    return this.http.get(`${this.apiUrl}/${url}`, httpOptions).pipe(
      map(category => category)
    );
  }
}

Module

import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { CategoriesService } from './../../services/categories.service';
import { LoadingController } from '@ionic/angular';

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

  categories: Observable<any>;
  loading: any;

  constructor(
    private categoriesService: CategoriesService,
    public loadingController: LoadingController,
  ) {}

  ngOnInit() {
    this.getData();
  }

  async getData(){
    this.loading = await this.loadingController.create({
      message: 'Please wait...',
      spinner: 'crescent',
      duration: 2000
    });

    await this.loading.present();

    this.categoriesService.getCategories().subscribe((res) => {
      this.categories = res;
      this.hideLoading()
    });
  }

  private hideLoading() {
    this.loading.dismiss();
  }
}

View

<ion-content padding>
    <ion-grid>
        <ion-row>
          <ion-list *ngIf="category">
            <ion-item *ngFor="let post of category.posts">
              <ion-avatar slot="start">
                 <img [routerLink]="['/', 'posts', post.url]" [src]="post.image">
              </ion-avatar>
                <ion-label class="ion-text-wrap" [routerLink]="['/', 'posts', post.url]">{{post.title}}</ion-label>
            </ion-item>
          </ion-list>
        </ion-row>
      </ion-grid>
</ion-content>

Based on docs I added this to my view below my loop code

<ion-infinite-scroll threshold="150px" (ionInfinite)="loadMorePosts($event)">
    <ion-infinite-scroll-content
      loadingSpinner="bubbles"
      loadingText="Loading more data...">
    </ion-infinite-scroll-content>
</ion-infinite-scroll>

And this to my Module

//....
import { LoadingController, IonInfiniteScroll } from '@ionic/angular';

//...
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
//....

Now please if someone can tell me how to handle loadMorePosts($event) function for my code I’ll be appreciate it.

Thank you.

Posts: 1

Participants: 1

Read full topic

ERROR Error: Uncaught (in promise): Error: Can't resolve all parameters for LoginPage: (?, [object Object])

$
0
0

@hindab wrote:

Good evening, thank you for helping me find a solution to this problem
ERROR Error: Uncaught (in promise): Error: Can’t resolve all parameters for LoginPage: (?, [object Object]).

login.page.ts

import { Component, OnInit } from ‘@angular/core’;

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

constructor(private authService:AuthenticationService, private router:Router) { }

ngOnInit() {
}

onLogin(user){
let res = this.authService.login(user.username,user.password);
if(res==true) {
this.router.navigateByUrl(‘menu’);
}else{
this.router.navigateByUrl(‘login’);
}
}

}

authentification.service.ts

import { Injectable } from ‘@angular/core’;

@Injectable({
providedIn: ‘root’
})
export class AuthentificationService {
public authenticated:boolean;
constructor() { }

public login(username:string, password:string){
if(username==“admin” && password==“1234”){
this.authenticated=true;
}
else{
this.authenticated=false;
}
return this.authenticated;
}
}

Posts: 1

Participants: 1

Read full topic

Capacitor writeFile, how to save a video?

$
0
0

@datenshi wrote:

Hi guys,

I am trying to save a video file. I get the blob data from recordRTC api, then I create a File:

const f = new File([blob], `video_${Date.now()}.mp4`, {
      type: 'video/mp4'
});

But I can not save it since it asks for a string. I have tried this two functions to convert it to base64 first:

 getBase64(file, callback) {
    const reader = new FileReader();
    reader.onload = () => {
        callback(reader.result);
    };
    reader.readAsDataURL(file);
  }

  getBase64New(file) {
    return new Promise((resolve, reject) => {
      const reader = new FileReader();
      reader.readAsDataURL(file);
      reader.onload = () => resolve(reader.result);
      reader.onerror = error => reject(error);
    });
  }

But no luck. Any idea?

Thanks a lot.

Posts: 1

Participants: 1

Read full topic

Question about Ionic 4 + firebase

$
0
0

@lxh37 wrote:

Hi,

I have trouble to deposit data to database in firebase in Ionic 4, I tried to
create a module storage with a provider StoreToFirebaseService to save data to firebase.

I did the following:

npm install firebase angularfire2

  1. add config to app/environments/environment.ts

export const environment = {
production: false,
firebase: {
apiKey: ‘’,
authDomain: ‘’,
databaseURL: ‘’,
projectId: ‘’,
storageBucket: ‘’,
messagingSenderId: ‘’,
appId: “”
}
};

  1. storage.module.ts

import { AngularFireModule } from ‘angularfire2’;
import { environment } from ‘…/…/environments/environment’;
import { AngularFirestoreModule } from ‘angularfire2/firestore’;

@NgModule({
declarations: ,
imports: [
CommonModule,
AngularFireModule.initializeApp(environment.firebaseConfig),
AngularFirestoreModule
],
providers: [ StoreToFirebaseService ]
})
export class StorageModule { }

  1. store-to-firebase.service.ts


import { AngularFirestore } from ‘angularfire2/firestore’;

export class StoreToFirebaseService {

constructor(
public afs: AngularFirestore
) {
}

addSurvey(){
  console.log("Inside addSurvey!");
  return new Promise<any>((resolve, reject) => {
    this.afs.collection('/result').add({
      ID: "Q2",
      Result1: false,
      Result2: false
    })
    .then(
      (res) => {
        resolve(res)
      },
      err => reject(err)
    )
  })
}    

}

  1. In the component, I imported the service

import { StoreToFirebaseService } from ‘…/…/storage/store-to-firebase.service’;

export class InitiatedDrinkComponent implements OnInit {

constructor(
private storeToFirebaseService: StoreToFirebaseService
) { }

storeData(){
console.log(“Inside storeData”);
this.storeToFirebaseService.addSurvey();
}

}

  1. Fore firebase database, I start in test mode with an empty database.

But “result” is not created with the fields ID, Result1 and Result2, any suggestion? Thanks!

Posts: 1

Participants: 1

Read full topic


Cordova-music-controls alternative

$
0
0

@madmandrew wrote:

cordova-music-controls isn’t working and doesn’t have a lot of active development. Is there any alternative plugin for getting music controls when the app is running in background??

I’ve tried multiple plugins and nothing seems to work.

Posts: 1

Participants: 1

Read full topic

Ionic cordova network strength

$
0
0

@guillomrv wrote:

Hello, im developing a position(GPS) based report online and offline app, i have add pictures and obtain latitude and longitude, but if it is offline, i should store that data inside an SQLITE table.

The problem is that when im asking the app to verify for the network state with the next code, it says the network is 4G, the PROBLEM is that even when the service is turn it off by the communication company, meaning that i CANT EVEN USE GOOGLE, the connection type also says im using 4G, I NEED THAT IT SAYS THAT IT IS OFFLINE :frowning:

function checkConnection() {
var networkState = navigator.connection.type;

  var states = {};
  states[Connection.UNKNOWN]  = 'Unknown connection';
  states[Connection.ETHERNET] = 'Ethernet connection';
  states[Connection.WIFI]     = 'WiFi connection';
  states[Connection.CELL_2G]  = 'Cell 2G connection';
  states[Connection.CELL_3G]  = 'Cell 3G connection';
  states[Connection.CELL_4G]  = 'Cell 4G connection';
  states[Connection.CELL]     = 'Cell generic connection';
  states[Connection.NONE]     = 'No network connection';

  alert('Connection type: ' + states[networkState]);

}

checkConnection();

Posts: 1

Participants: 1

Read full topic

Help me to take total of each time i clicked pluss button for one variable

$
0
0

@dssen wrote:

in this app i want to add total each time i click the plus button of each item. can anyone suggest me a way to do this.
the footer part is in app.html and items are in tab1 page.

Posts: 1

Participants: 1

Read full topic

Phone Authentication using firebase in ionic 4

$
0
0

@ShankarGuru wrote:

I am trying to perform phone authentication(i,e OTP) using firebase . Now i am receiving the OTP from the firebase , But i want verify that OTP, And after successful verification it should to route another page called home .I am unable to perform to verification process.

Below is my CODE:

HTML

<ion-content padding>
  <ion-item>
    <ion-label position="floating">Phone</ion-label>
    <ion-input type="text" [(ngModel)]="phone"></ion-input>
  </ion-item>
  <ion-button expand="full" (click)="send()">Send</ion-button>
  <ion-item>
      <ion-label position="floating">Enter OTP</ion-label>
      <ion-input type="text" [(ngModel)]="code"></ion-input>
    </ion-item>
  <ion-button expand="full" (click)="verify()">Verify</ion-button>
</ion-content>

TS

import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular';
import * as firebase from 'firebase';
@Component({
  selector: 'app-login',
  templateUrl: './login.page.html',
  styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {
  verificationId: any;
  code = '';
  phone: number;

  constructor(public navCtrl: NavController) { }

   ngOnInit() {}

  send() {
    const tell = '+91' + this.phone;
    (<any> window).FirebasePlugin.verifyPhoneNumber(tell, 60, (credential) => {
      console.log(credential);
      this.verificationId = credential.verificationId;
    }, (error) => {
      console.error(error);
      alert(error);
     });
  }

  verify() {
    const signInCredential = firebase.auth.PhoneAuthProvider.credential(this.verificationId, this.code);
    firebase.auth().signInWithCredential(signInCredential).then((info) => {
      console.log(info);
      // this.navCtrl.navigateRoot('/home'); 
    }, (error) => {
      console.log(error);
    });
    }
}

While surfing i got this solution ,Here they are performing verification of the CAPTCHA also, I don’t want this functionality. I just want OTP verification.

Posts: 1

Participants: 1

Read full topic

Keytool error in windows

$
0
0

@robertnic wrote:

I am trying to release my app and i’m at the point where i should use command

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

but I get this error

'keytool' is not recognized as an internal or external command,
operable program or batch file.

So I’ve searched for it and I found this and this and currently i have my system settings like:

Untitled

Yet I’m getting same error as before.

Any idea how to fix this issue?

Posts: 1

Participants: 1

Read full topic

Viewing all 70442 articles
Browse latest View live


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