These are chat archives for angular/angular-2-ionic-2

Jul 2017
Jonathan Leek
Jul 26 2017 01:32
Hey guys... I've got an embarassing problem growing in my JSON area... Trying to install Geolocation and failing: [ERROR] Cordova encountered an error. │Untracked files: You may get more insight by running the Cordova command above directly. │ (use "git add <file>..." to include in what will be committed) │ [ERROR] An error occurred while running cordova plugin add cordova-plugin-geolocation --save (exit code 1): │ src/components/auth/ │ src/providers/location/ │ src/providers/merchant/ You have been opted out of telemetry. To change this, run: cordova telemetry on. │ Error: Failed to fetch plugin cordova-plugin-geolocation via registry. │no changes added to commit (use "git add" and/or "git commit -a") Probably this is either a connection problem, or plugin spec is incorrect. │ Check your connection and plugin name/version/URL. │ Error: npm: Command failed with exit code 1 Error output: │ npm ERR! Unexpected token < in JSON at position 49903 │ │ npm ERR! A complete log of this run can be found in: │ npm ERR! /Users/mrjonleek/.npm/_logs/2017-07-26T01_20_47_477Z-debug.log
Jul 26 2017 01:34

@UncertaintyP No Camera preview show after i call the
I post the code blow.I search the problem and got one solution works for others to set the body transparent.So I set <ion-content padding background-color:transparent>,but it’s not work for me.

      Ionic Blank

<ion-content padding background-color:transparent>
  The world is your oyster.
    If you get lost, the <a href="">docs</a> will be your guide.
  <button ion-button (click)="qrscanner()">qrscanner</button>


import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

import { AndroidPermissions } from '@ionic-native/android-permissions';
import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner';

  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {

  constructor(public navCtrl: NavController,
              public androidPermissions: AndroidPermissions,
              public qrScanner: QRScanner) {


  qrscanner() {

    // Optionally request the permission early
      .then((status: QRScannerStatus) => {
        if (status.authorized) {
          // camera permission was granted

          // start scanning
          let scanSub = this.qrScanner.scan().subscribe((text: string) => {
            console.log('Scanned something', text);
            this.qrScanner.hide(); // hide camera preview
            scanSub.unsubscribe(); // stop scanning


          // show camera preview

          // wait for user to scan something, then the observable callback will be called

        } else if (status.denied) {
          // camera permission was permanently denied
          // you must use QRScanner.openSettings() method to guide the user to the settings page
          // then they can grant the permission from there
        } else {
          // permission was denied, but not permanently. You can ask for permission again at a later time.
      .catch((e: any) => {
        alert('Error is' + e);
Jul 26 2017 02:26
how to set the ion-content background to transparent
Jul 26 2017 03:45
@Story5 Oh sorry I'm actually using the @ionic-native/barcode-scanner package
Because it is native you don't need to mess with page transparencies or the like
Jul 26 2017 04:07
@UncertaintyP I used barcode-scanner and it works for me.But I dont find way to embed ionic project with barcode-scanner plugin into android native.
Jul 26 2017 04:13
AnyOne can help?I ask on stackoverflow too.
Jul 26 2017 04:22
This can be related to not having camera permissions on phone
You should debug your android build to see whats going on
Jul 26 2017 07:24
I test the plugin, and I find it can scan qrcode and gain the text, but no camera preview. So the exact way is to set the ion-content background transparent. How to set it?AnyOne know?
Jul 26 2017 09:30
@UncertaintyP did according to it but not work. Strangely