Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228529 articles
Browse latest View live

Upload image to database using file_uri

$
0
0

I have post(upload) image to given database using file URI not data_url because it takes too much memory but I don’t know how to upload please help me with the code.
.ts

 getPic(){
     const options: CameraOptions = {
	   quality: 100,
	   sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM,
	   destinationType: this.camera.DestinationType.FILE_URI
      }

     this.camera.getPicture(options).then((imageData) => {
	 this.success = 'getting image is successful';
	 this.Image = imageData;
     }, (err) => {
	  this.err = err;
    });
   }

Image not displaying while displaying contacts

$
0
0

Hi @Sujan12 . Thanks for replying. I just solved it with an another way. I used ( WebView ) plugin for it. Which can be found here ( https://ionicframework.com/docs/native/ionic-webview ). And my code was look like this:

 constructor(private contacts: Contacts, private sanitizer: DomSanitizer, private router: Router, private callNumber: CallNumber, private contact: Contact, private webView: WebView) {
    // TODO
  }

 getContacts(): void {
    this.contacts.find(
        ['displayName', 'phoneNumbers', 'photos'],
        {multiple: true, hasPhoneNumber: true}
    ).then((contacts) => {
      for (let i = 0 ; i < contacts.length; i++) {
        if(contacts[i].displayName !== null) {
          const contact = {};
          contact['name']   = contacts[i].displayName;
          contact['number'] = contacts[i].phoneNumbers[0].value;
          if (contacts[i].photos != null && contacts[i].photos.length > 0) {
            console.log(contacts[i].photos[0].value);
            contact['image'] = this.webView.convertFileSrc(contacts[i].photos[0].value);
            console.log(contact['image']);
          } else {
            contact['image'] = 'assets/dummy-profile-pic.png';
          }
          this.contactList.push(contact);
        }
      }
    });
  }

This is the working code for me. You can update it in the github.

Image not displaying while displaying contacts

$
0
0

Can you help in saving contact with image?

Problem with

$
0
0

Hi to everyone, these are my stencil and ionic version

"dependencies": {
    "@ionic/core": "one"
  },
  "devDependencies": {
    "@stencil/core": "1.0.0-beta.8"
  }

I’m trying to use the <ion-menu> inside a <ion-split-pane> like in a ionic app, this is my code (this is the original repo of this code https://github.com/modemlooper/stencil-pwa-sidemenu ):

app-root.tsx

[...]
render() {
    return (
      <ion-app>
        <ion-router useHash={false}>
          <ion-route url="/" component="app-home" />
          <ion-route url="/profile/:name" component="app-profile" />
        </ion-router>

        <ion-split-pane when="lg">
          <ion-menu side="start">
            <ion-header>
              <ion-toolbar color="primary" />
            </ion-header>

            <ion-content forceOverscroll={false}>
              <ion-list>
                <ion-menu-toggle autoHide={false}>
                  <ion-item href="/">
                    <ion-icon slot="start" name="home" />
                    <ion-label>Home</ion-label>
                  </ion-item>
                </ion-menu-toggle>

                <ion-menu-toggle autoHide={false}>
                  <ion-item href="/profile/piero">
                    <ion-icon slot="start" name="person" />
                    <ion-label>Profile</ion-label>
                  </ion-item>
                </ion-menu-toggle>
              </ion-list>
            </ion-content>
          </ion-menu>
          <ion-nav main />
        </ion-split-pane>
      </ion-app>
    );
  }
[...]

The problem is that <ion-nav main /> gives me this error:


And without “main” the split pane don’t work properly

This is the expected behaviour

How is it possible to fix this? I don’t get how to use properly the ion menu inside a split pane…
Thank you so much

Using Appium to test Ionic

$
0
0

QA is trying to get some automation set up for our Ionic apps using Appium (http://appium.io/)
We realized adding in ids to everything seems to work better.

The problem is for an AlertController trying to click a button on these screens seems to have problems.
I can’t see a way to add an ID to these buttons either.

Any idea?

Radio button label is not showing up

$
0
0

Hi,

I am new to ionic and facing one weird issue. I am trying to display alter popup with radio button input type. Everything working as expected but for in one scenario i need to call API and get the response and then add those responses on the alter popup as radio buttons. There i am getting response values properly and popup opens and radio buttons are also displaying as expected but didnt see any label for that. Not sure why labels or value are not showing for that radio button. Here is my code and issue screen shot.

Ionic version details:

Error:
image

Code :

if(options[i].indexOf('-')>0){  //THIS BELOW CONDITION IS NOT WORKING. 
          var arrayString=options[i];
          console.log("arrayString:"+arrayString)
            var country = this.restProvider.details.COUNTRY;
            this.restProvider.getResponseOptionsTranslations(arrayString,country).then(res => {
              let transResponses: any =[];
              transResponses = res['value'] as string[];
              for(var i=0;i<transResponses.length;i++){
                if(transResponses[i]["TRANSLATION_VALUE"]!= undefined){
                  var transRes=transResponses[i]["TRANSLATION_VALUE"];
                  alert.addInput({
                    type: 'radio',
                    label:transRes,
                    value:transRes,
                  });
                  console.log("transRes2:"+transRes)
                }
              }
              
            });

Any inputs are highly appreciated.

How to use rating star in ionic 4?

$
0
0

For your ionic-4 applications use this package
Everything you have to do is well documented

It is very easy to integrate to your application

Save the image taken from camera into gallery

$
0
0

Uncomment your line saveToPhotoAlbum: true; and change your destinationType to destinationType : Camera.DestinationType.FILE_URI


Floating Action Button as Input type="file"

$
0
0

SOLVED!

page.html
<ion-fab vertical="bottom" horizontal="center" slot="fixed" >
    <ion-fab-button>
      <label for="input" style="font-size: 20pt; padding: 30px">
        +
      </label>
      <input id="input" type="file" class="hideInput" (change)="changeListener($event)">
    </ion-fab-button>
  </ion-fab>
page.scss
.hideInput{
    position: absolute;
    bottom: -100000000px;
}

What i’ve done?
i put an input (STANDARD, not ion-input) that is not visible, and a label (STANDARD, not ion-label) that has
for = “id-of-input

i expanded the padding of label in order to increase the “tabbable area” of the component

Capacitor help information

$
0
0

By design, Capacitor is simple/easy to get started with. I recommend jumping right in and trying it out. The Camera app guide is a good starting point.

Cordova-plugin-ionic-webview and Capacitor use different 'origins' by default

$
0
0

For apps currently using cordova-plugin-ionic-webview (v4) and planning to migrate to Capacitor, the saved local storage data will get lost due to different default origins.

From cordova-plugin-ionic-webview documentation:

The default origin for requests from the Android WebView is http://localhost .

The default origin for requests from the iOS WebView is ionic://localhost

From Capacitor documentation:

For example, apps running in Capacitor have capacitor://localhost (iOS) or http://localhost (Android) as their origin.

What is the best way to handle this migration? Can we change the origin for Capacitor to match what we have in cordova plugin, or is it better to configure the cordova plugin to use whatever Capacitor will want to use (at least apps not in production yet)?

Couldn’t find this in Capacitor docs. It will help if a section is added to Migration guide at https://capacitor.ionicframework.com/docs/cordova/migrating-from-cordova-to-capacitor

Best would be to have default origins same for Capacitor and cordova-plugin-ionic-webview, but that will break existing apps.

Build Break with aapt error message . why?

$
0
0

Thank you. I changed my project.properties file to match your firebase-* versions. This is how it looks now:

target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.facebook.android:facebook-android-sdk:4.38.1
cordova.gradle.include.1=cordova-plugin-badge/wakacje-badge.gradle
cordova.gradle.include.2=cordova-support-google-services/wakacje-build.gradle
cordova.system.library.2=com.google.firebase:firebase-core:16.0.+
cordova.system.library.3=com.google.firebase:firebase-dynamic-links:16.1.+
cordova.system.library.4=com.android.support:support-v4:24.1.1+
cordova.system.library.5=com.google.android.gms:play-services-auth:11.8.0
cordova.system.library.6=com.google.android.gms:play-services-identity:11.8.0
cordova.system.library.7=com.android.support:support-annotations:27.+
cordova.gradle.include.3=cordova-plugin-firebase/wakacje-build.gradle
cordova.system.library.8=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.9=com.google.firebase:firebase-core:16.0.8
cordova.system.library.10=com.google.firebase:firebase-messaging:17.5.0
cordova.system.library.11=com.google.firebase:firebase-config:16.4.1
cordova.system.library.12=com.google.firebase:firebase-perf:16.2.4
cordova.system.library.13=com.android.support:support-v4:26.+
cordova.gradle.include.4=cordova-plugin-local-notification/wakacje-localnotification.gradle

However I’m still getting error related to firebase-iid:

Dependency failing: com.google.firebase:firebase-messaging:17.5.0 -> com.google.firebase:firebase-iid@[17.1.1], but fire
base-iid version was 19.0.0.

Has anyone got an idea how to fix it?

Radio button label is not showing up

$
0
0

To clarify, you are seeing the values you expect in the console for transRes?

Have you tried hard coding the values as a test? This would remove a ‘variable’ from the process and help you narrow down the issue. If it fails with a fixed value, then it might be a css issue or something else.

Moved code from PC to Mac - Won't compile

$
0
0

I began developing on my Windows 10 PC and my app is working well on the PC and I can even sideload it onto my Android device.

I installed ionic on my macbook air (latest version) and moved the code over but it fails to compile - at least, using ionic lab. No real error messages… just the fail to compile.

Is there something I need to do to make the same code work on a macbook?

Radio button label is not showing up

$
0
0

Thanks for the quick response Chris, I try to hard coded value inside for loop but still didn’t work.

But if i hard code value before getResponseOptionsTranslations() as below then i can able to see hard coded value as well as actual result also.

if(options[i].indexOf(’-’)>0){
var arrayString=options[i];
console.log(“arrayString:”+arrayString)
var country = this.restProvider.details.COUNTRY;
let arrStr=arrayString.split(’-’);
alert.addInput({
type: ‘radio’,
label:arrStr[0],
value:arrStr[0],
});
alert.addInput({
type: ‘radio’,
label:arrStr[1],
value:arrStr[1],
});

            this.restProvider.getResponseOptionsTranslations(arrayString,country).then(res => {
              let transResponses: any =[];
              transResponses = res['value'] as string[];
              for(var i=0;i<transResponses.length;i++){
                if(transResponses[i]["TRANSLATION_VALUE"]!= undefined){
                  var transRes=transResponses[i]["TRANSLATION_VALUE"];
                  alert.addInput({
                    type: 'radio',
                    label:transRes,
                    value:transRes,
                  });
                  console.log("transRes2:"+transRes)
                }
              }
              
            });
        }

below screen shot, english is default result which is coming from just string split. but the spanish translations are coming from data base.

image


APK fails on certain systems: App not installed

$
0
0

I have an Ionic app designed and installed in my device, when I try installing another ionic app which was designed newly I am getting “App not Installed” message.

I have changed widget id in config.xml and also changed in manifest.xml as well. But no luck. Any help on this?

Reading image file into Image()

$
0
0

Hello,

I try to select image from camera roll and use it as .src to Image() instance but unfortunately it doesn’t read the file and Image().onerror triggers.

With cordova-plugin-ionic-webview 1.2.x, I could read file with normalizeUrl() function but couldn’t read it on Android. So I updated to cordova-plugin-ionic-webview 4.1.1 and now couldn’t read it on IOS (tried to use window.Ionic.WebView.convertFileSrc() too, it turns ionic:/// link and error occurs again)

How can I achive this?

Setting native version numbers with capacitor?

$
0
0

Capacitor’s philosophy is to embrace the native project tooling and IDE’s instead of providing an abstracted config file like Cordova. As a general strategy, you’d search for “how to do X in Xcode?” or “… in Android Studio?”

For this question, setting Android version code, see here - most settings are configured in AndroidManifest.xml or the build.gradle.

For CGBundleVersion, it’s in Info.plist.

A few installation issues with capacitor ios guide

$
0
0

Apologies about the documentation mismatch! We are currently in the midst of revamping a bunch of sections within the Ionic docs, including that “Building iOS” page.

In the meantime, please see the Capacitor Required Dependencies page.

How to use Youtube player API with ionic 4 and capacitor for Android and iOS app

$
0
0

Are you referring to this plugin from the Community? Generally, in situations where examples and better docs are missing, I recommend contacting the plugin author (open an issue) to ask if they can clarify in the README, etc.

Viewing all 228529 articles
Browse latest View live


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