Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 48986 articles
Browse latest View live

Ionic 4 livereload gives error

$
0
0

@edwinrikkers wrote:

The following command:

ionic cordova run ios --livereload --verbose – --buildFlag="-UseModernBuildSystem=0"

gives the following error:

ng has unexpectedly closed (exit code 0).

If i remove the --livereload it is working, but I need the livereload for smooth development.

My ionic info:

ionic (Ionic CLI) : 4.5.0
Ionic Framework : @ionic/angular 4.0.0-beta.17
@angular-devkit/build-angular : 0.11.0
@angular-devkit/schematics : 7.1.0
@angular/cli : 7.1.0
@ionic/angular-toolkit : not installed

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.0.3, (and 15 other plugins)

System:

Android SDK Tools : 26.1.1
ios-deploy : 2.0.0
NodeJS : v8.11.3
npm : 6.5.0
OS : macOS High Sierra
Xcode : Xcode 10.1 Build version 10B61

Posts: 1

Participants: 1

Read full topic


Ion-searchbar autocorrect not working

$
0
0

@AdamGelineau wrote:

Hi guys !

I’m not able to make autocorrect “ON” on a ion-searchbar, but I was able to do it on a ion-textarea input…

Here is my code:

<ion-searchbar
          *ngIf="enviesOpened"
          class="mesenvies-searchbar"
          placeholder="Rechercher selon mes envies"
          [(ngModel)]="searchtext"
          [formControl]="searchControl"
          (ionInput)="onSearchInput()"
          autocorrect="on"
  ></ion-searchbar>

I tried with spellcheck true too but nothing seems to work here :confused:

Any help on this please ?
Thanks !

Posts: 1

Participants: 1

Read full topic

[IONIC-3] Location of Error Page html file in config.xml inside IONIC project, to be used when offline/ no network connection, to show error message

$
0
0

@abhishekkanitkar wrote:

Hi all,

We are working on an Ionic app for an enterprise product.
All of the data/content/web assets used in the project are loaded from remote location like S3.

In config.xml, the path to index.html can be like this for example

Due to this, we need to handle the ‘no network/ internet’ scenario.

config.xml has an option ‘ErrorUrl’ which should point to errorPage.html.

My question is,

In an IONIC project, where should this error html page reside & what should it’s path be in config.xml ???

Following are the links for reference that I have gone through but didn’t get any concrete answer,

https://cordova.apache.org/docs/en/latest/config_ref/#preference
(Search for ErrorUrl property)

https://www.raymondcamden.com/2013/02/19/Some-examples-of-Android-PhoneGap-Config-Settings

Please help me with this !

Thanks in advance :slight_smile:

Posts: 1

Participants: 1

Read full topic

Reading PDF files

$
0
0

@smith9522 wrote:

Hello, i will read a PDF in my app. This my code
openLocalPdf() {
const options: DocumentViewerOptions = {
title: ‘My PDF’
}
this.document.viewDocument(‘assets/gad1.pdf’, ‘application/pdf’, options);
}
there are nothing on my phone

Posts: 1

Participants: 1

Read full topic

How to change height of list dynamically?

$
0
0

@pdj wrote:

I have long sentence to show in ion-list , I want list to be enlarged vertically according to sentences, but How can I achieve it?

for example, I have sentence long enough to overflow of ion-item, I want to show it all with enlarged listview vertically.
45

Posts: 3

Participants: 2

Read full topic

Android Adaptive icons

$
0
0

@helpmelearn wrote:

Is there a good walkthrough on getting adaptive icons working with android?
We had our icon guy give me a front image and a background image. I know I need to get android studio involved. anybody get this working?

Posts: 1

Participants: 1

Read full topic

Some Images don't load in Ionic build or in deployed apk

$
0
0

@Cabz wrote:

Hey guys, i need help…
I have an app that uses images but when i deployed it, some images don’t load… though all is well when i use ionic serve. I have no clue what’s happening.

This is the screenshot from the deplyoed app:

This is the screenshot from ionic serve:

And this is the code:

    <div text-center *ngIf='diseases=="" && diagnostics.affected_part==""'>
		<h2 *ngIf="eng=='true'">Please choose a vegetable:</h2>
		<h2 *ngIf="bis=='true'">Palihog pili ug tanom:</h2>
		<br>
		<ion-card *ngFor='let vegetable of vegetables' (click)="diagnoseThis(vegetable)">
	      <img src="./assets/imgs/{{vegetable}}.jpg" >
	      <div class="card-title">{{vegetable}}</div>
	    </ion-card>
	</div>

If you have any idea how to solve this, please do tell me.

Posts: 2

Participants: 2

Read full topic

How to toggle CSS with ion-checkbox

$
0
0

@MarioRud wrote:

Hi all! I’m quite new to Ionic and I’m currently working on a simple to-do list app for an assignment. The app uses Firebase to store objects. What I’m trying to do is have each object have a checkbox on the right that, when clicked, changes the CSS of the task name and sets the text-decoration to line-through, and when unchecked, gets rid of this CSS. I figured the best way to achieve this would be to set a default status of ‘pending’ to each new object created. Then when the checkbox is checked the status changes to ‘done’ Then an ngClass would check and set the CSS according to the status.

This is my code in the html:

<ion-checkbox item-right (ionChange)="doneTask(task.status)"></ion-checkbox>
        <ion-label>
          <h2 [ngClass]="{'done': task.status !== 'pending'}">{{task.taskname}}</h2>
        </ion-label>

I’ve made it so that every new object has a default ‘pending’ status. I also have a TaskListService that handles the create and removal of new tasks. Should the doneTask() function then call another function in my TaskListService that will update status=‘done’? I’m a bit stuck when it comes to the functions.

Any help would be much appreciated, thanks!

Posts: 1

Participants: 1

Read full topic


How to stream local file with ionic streamingMedia

$
0
0

@jagr2713 wrote:

I am using ionic streamingMedia to stream a video from a mp4 link I generated from a downloader. But the link expires after a certain time and instead of using the link I created a folder called “videos” in my assets folder and I want to use this instead. I tried doing

june_19(){
      let options: StreamingVideoOptions = {
        successCallback: () => { console.log('Video played') },
        errorCallback: (e) => { console.log('Error streaming') },
        orientation: 'portrait',
        shouldAutoClose: true,
        controls: true
      };
      
      this.streamingMedia.playVideo('../../assets/videos/june_19.mp4');
  }

But that didn’t work. How about I go about this?

Posts: 1

Participants: 1

Read full topic

Ionic 3 serve error

$
0
0

@gauravgenden wrote:

I can successfully install and view my ionic 3 project on my browser using ‘ionic serve’. But when I’m starting to edit codes, livereload is not working and this ECONNABORTED error occurs on my CMD.
But when I refresh my browser, changes are there.

Posts: 1

Participants: 1

Read full topic

How to check if Admob ad is shown and is watched?

$
0
0

@Saban wrote:

Hello
Can anyone help me with AdMob Free. I had call my AdMob ads, and they are shown every time. Now, I need to check if Rewarded Ads is shown and watched to the end. I use this code:
document.addEventListener(‘admob.rewardvideo.events.REWARD_VIDEO_CLOSE’, (result) => {
some code to reward the user
}
This code is working OK, but I have problem with that if Rewarded ad is shown at all. Because when I publish my App on playstore, in first time there is no ads, but they are shown later.
So my question is how to check if Rewarded ad can be shown, so then I can call a code above?

Posts: 1

Participants: 1

Read full topic

Ion-slides effects in ionic 4

$
0
0

@mcihak wrote:

Hi,
do you have an issue with <ion-slides> in Ionic 4, that there can`t be changed its effect to coverflow, flip,… ?Only slide as default is working.

Just created new clean project and trying it.

Thanks

Posts: 1

Participants: 1

Read full topic

Deeplink works when the app in background but none when it's killed

$
0
0

@joe_c_sleiman wrote:

i’m using ionic deeplink plugin ionic-plugin-deeplinks it works fine for android, but as it didn’t work on ios i forced to install another plugin cordova-deeplink , and cordova-universal0links-plugin . package.json:

@ionic-native/deeplinks”: “^4.16.0”,

“cordova-deeplink”:“git+https://github.com/foneclay/cordova-universal-links-plugin.git#2.3.1”, “cordova-universal-links-plugin”: “1.2.1” so in my component.ts:

platform.ready().then(() => {
      if (this.platform.is('android')) {
        this.deeplinks.routeWithNavController(this.nav, {
          '/e-training/course_overview/:courseID': CourseDetailsPage,
           .......
        }).subscribe((match) => {
          console.log('Successfully routed', match);
        }, (nomatch) => {
          console.log('Unmatched Route', nomatch);
        });
      } else {
        if (this.platform.is('ios')) {
          universalLinks.subscribe('openApp', this.onAppRequest.bind(this));
          universalLinks.subscribe('openPage', this.onPageRequest.bind(this));
        }
      }
    });

config.xml:

<universal-links>
        <host event="openApp" name="example.com" scheme="https">
            <path event="openPage" url="/" />
        </host>
</universal-links>

everything work fine on android but in ios only works when the app still in background, when i kill the app (terminate it) and click on any link that i shared through the app it open the home page of the app , didn’t go deep inside the details.

Ionic:

  • ionic (Ionic CLI) : 4.0.2
  • Ionic Framework : ionic-angular
  • 3.9.2 @ionic/app-scripts : 3.2.0

Cordova:

  • cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
  • Cordova Platforms : not available

System:

  • Android SDK Tools : 25.2.5
  • NodeJS : v8.9.3
  • npm : 5.4.2
  • OS : Windows 10

Posts: 1

Participants: 1

Read full topic

IONIC inappbrowser loadstop event not working in IOS

$
0
0

@Deepakk2017 wrote:

I am launching an https://… URL in iPhone within InAppBrowser. I am trying to call ‘loadstop’ event for Inappbrowser. It is not getting called in iPhone but it works for Android.
Please let me know if there is any API update is required.

Thanks,

Posts: 1

Participants: 1

Read full topic

Geolocation access has been blocked because of a Feature Policy applied to the current document. See https://goo.gl/EuHzyv for more details

$
0
0

@itsumeryousuf wrote:

Please help me to solve this damn problem its working fine when run on browser map willl show perfectly when i run on lab view or apk real device its will show a blank white screen please help to resolve this its been 3 months to find a way to solve this problem. it will very helpfull if some one help to resolve and one more thing if google allow cross origin in iframe how to implement iframe.
Thankyou

This is my Map.ts code

import { Component, ViewChild ,ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Geolocation ,GeolocationOptions ,Geoposition ,PositionError } from '@ionic-native/geolocation'; 


declare var google;

@Component({
    selector: 'page-map',
    templateUrl: 'map.html'
})
export class MapPage {

@ViewChild('map') mapElement: ElementRef;

options : GeolocationOptions;
currentPos : Geoposition;
map: any;
places : Array<any> ;



constructor
(
    public navCtrl: NavController,
    private geolocation : Geolocation,
    
     

    ) {} 

   

ionViewDidEnter(){
    this.getUserPosition();
}    


 

getUserPosition(){
    this.options = {
    enableHighAccuracy : false
    };
    this.geolocation.getCurrentPosition(this.options).then((pos : Geoposition) => {

        this.currentPos = pos;     

        console.log(pos);
        this.addMap(pos.coords.latitude,pos.coords.longitude);

    },(err : PositionError)=>{
        console.log("error : " + err.message);
    ;
    })
}

getRestaurants(latLng)
{
    var service = new google.maps.places.PlacesService(this.map);
    let request = {
        location : latLng,
        radius : 3000 ,
        types: ["gym"]
    };
    return new Promise((resolve,reject)=>{
        service.nearbySearch(request,function(results,status){
            if(status === google.maps.places.PlacesServiceStatus.OK)
            {
                resolve(results);    
            }else
            {
                reject(status);
            }

        }); 
    });

}

createMarker(place)
{
    let marker = new google.maps.Marker({
    map: this.map,
    animation: google.maps.Animation.DROP,
    position: place.geometry.location
    });   
}  

ionViewDidload(){
    console.log(MapPage)
}


addMap(lat,long){

    let latLng = new google.maps.LatLng(lat, long);

    let mapOptions = {
    center: latLng,
    zoom: 5,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);

    this.getRestaurants(latLng).then((results : Array<any>)=>{
        this.places = results;
        for(let i = 0 ;i < results.length ; i++)
        {
            this.createMarker(results[i]);
        }
    },(status)=>console.log(status));

    this.addMarker();
}


addMarker(){

    let marker = new google.maps.Marker({
    map: this.map,
    animation: google.maps.Animation.DROP,
    position: this.map.getCenter()
    });

    let content = "<p>This is your current position !</p>";          
    let infoWindow = new google.maps.InfoWindow({
    content: content
    });
import { Component, ViewChild ,ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Geolocation ,GeolocationOptions ,Geoposition ,PositionError } from '@ionic-native/geolocation'; 


declare var google;

@Component({
    selector: 'page-map',
    templateUrl: 'map.html'
})
export class MapPage {

@ViewChild('map') mapElement: ElementRef;

options : GeolocationOptions;
currentPos : Geoposition;
map: any;
places : Array<any> ;



constructor
(
    public navCtrl: NavController,
    private geolocation : Geolocation,
    
     

    ) {} 

   

ionViewDidEnter(){
    this.getUserPosition();
}    


 

getUserPosition(){
    this.options = {
    enableHighAccuracy : false
    };
    this.geolocation.getCurrentPosition(this.options).then((pos : Geoposition) => {

        this.currentPos = pos;     

        console.log(pos);
        this.addMap(pos.coords.latitude,pos.coords.longitude);

    },(err : PositionError)=>{
        console.log("error : " + err.message);
    ;
    })
}

getRestaurants(latLng)
{
    var service = new google.maps.places.PlacesService(this.map);
    let request = {
        location : latLng,
        radius : 3000 ,
        types: ["gym"]
    };
    return new Promise((resolve,reject)=>{
        service.nearbySearch(request,function(results,status){
            if(status === google.maps.places.PlacesServiceStatus.OK)
            {
                resolve(results);    
            }else
            {
                reject(status);
            }

        }); 
    });

}

createMarker(place)
{
    let marker = new google.maps.Marker({
    map: this.map,
    animation: google.maps.Animation.DROP,
    position: place.geometry.location
    });   
}  

ionViewDidload(){
    console.log(MapPage)
}


addMap(lat,long){

    let latLng = new google.maps.LatLng(lat, long);

    let mapOptions = {
    center: latLng,
    zoom: 5,
    mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);

    this.getRestaurants(latLng).then((results : Array<any>)=>{
        this.places = results;
        for(let i = 0 ;i < results.length ; i++)
        {
            this.createMarker(results[i]);
        }
    },(status)=>console.log(status));

    this.addMarker();
}


addMarker(){

    let marker = new google.maps.Marker({
    map: this.map,
    animation: google.maps.Animation.DROP,
    position: this.map.getCenter()
    });

    let content = "<p>This is your current position !</p>";          
    let infoWindow = new google.maps.InfoWindow({
    content: content
    });

    google.maps.event.addListener(marker, 'click', () => {
    infoWindow.open(this.map, marker);
    });

}
}google.maps.event.addListener(marker, 'click', () => {
    infoWindow.open(this.map, marker);
    });

}
}

Posts: 1

Participants: 1

Read full topic


Create pwa but ng command not found

$
0
0

@anna_liebt wrote:

Hello,
I am on ionic v4 beta and want to create my first pwa.
I created with ionic

ionic start myapp tabs --type=angular

I change with cd myapp into dir and want to create a service worker with

ng add @angular/pwa --project myapp

This fails with ng command not found.

If I do ionic serve then I see that ng is called from ionic serve and it starts into chrome.
I use nvm with node version 8.11.2 on a win64 machine

Any ideas, whats wrong, faulty, …

Best regards, anna-liebt

Posts: 1

Participants: 1

Read full topic

Could not upload image any one help me please!1

$
0
0

@hamzaamjad750 wrote:

Onload
ionViewDidLoad() {

const options: CameraOptions = {
  quality: 70,
  destinationType: this.camera.DestinationType.DATA_URL,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE
}

this.camera.getPicture(options).then((imageData) => {
 // imageData is either a base64 encoded string or a file URI
 // If it's base64 (DATA_URL):
 this.myphoto = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
 // Handle error
});
//console.log('ionViewDidLoad CameraPage');

}

Upload Image
uploadImage(){
//Show loading
let loader = this.loadingCtrl.create({
content: “Uploading…”
});
loader.present();
//create file transfer object
const fileTransfer: FileTransferObject = this.transfer.create();

 //random int
 var random = Math.floor(Math.random() * 100);

 //option transfer
 let options: FileUploadOptions = {
   fileKey: 'photo',
   fileName: "myImage_" + random + ".jpg",
   chunkedMode: false,
   httpMethod: 'post',
  mimeType: "image/jpeg",
   headers: {}
 }

 //file transfer action
 fileTransfer.upload(this.myphoto, 'http://localhost:8080/orangehrm/uploadimage/uploadimage.php', options)
   .then((data) => {
     alert("Success");
     loader.dismiss();
   }, (err) => {
     console.log(err);
     alert("Error");
     loader.dismiss();
   });

}

php File

<?php header('Access-Control-Allow-Origin: *'); $target_dir = "/images/"; $target_file = $target_dir . basename($_FILES["photo"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); $check = getimagesize($_FILES["photo"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; if (move_uploaded_file($_FILES["photo"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["photo"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } else { echo "File is not an image."; $uploadOk = 0; } ?>

Posts: 4

Participants: 2

Read full topic

Debug ionic on developer tools

$
0
0

@bengold wrote:

Not sure if any one can help.

When i am debugging the Ionic 3 app on development tools devices. The app is unresponsive when i press a button and becomes very blurry and navigation stops. When i close development tools everything goes back to normal.

In development tools i also get:
Remote browser is newer than client browser. Try inspect fallback if inspection fails.

but inspect fallback as the same problem.

Ben

Posts: 1

Participants: 1

Read full topic

Dislay data into FormControl

$
0
0

@tomeskrt wrote:

Hello, I’m trying to call a function and display data that I get in return of it into a FormControl.

This is my code but I get undefined.

private iobAnagrafica: any = [];
private formAnagrafica: FormGroup

  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    private privacyProvider: PrivacyProvider,
    private formBuilder: FormBuilder
    ) {
    this.myParam = navParams.get('myParam');
    console.log(this.myParam);
    this.getAnagrafica();
    console.log(this.iobAnagrafica);
    this.formAnagrafica = this.formBuilder.group({
      ID_INSTALLATO: new FormControl(this.iobAnagrafica.id_installato),
      ID_ANAGRAFICA: new FormControl(this.iobAnagrafica.id_anag),
      ID_PRODUTTORE: new FormControl(this.iobAnagrafica.id_produttore),
      ID_GRUPPO: new FormControl(this.iobAnagrafica.id_gruppo),
      ID_INSTALLATORE: new FormControl(this.iobAnagrafica.id_installatore)
    });
  }

  getAnagrafica(){
    this.privacyProvider.getIOBAnagrafica(this.myParam).subscribe((data) => {
      if (data) {
        this.iobAnagrafica = data;
        console.log(this.iobAnagrafica);
      }
    })
  }

How can I solve this issue?

Posts: 2

Participants: 2

Read full topic

Ionic 3 cors

$
0
0

@demidovitchrusso wrote:

I’m back from my app, in development environment I had to configure a proxy in the ionic to go around CORS when I run through the “ionic server” browser. I want to know if when to publish the application in the playstore I will have the same problem?

When I publish my endpoints they will point directly to the external resource.

Posts: 1

Participants: 1

Read full topic

Viewing all 48986 articles
Browse latest View live


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