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

Ionic Native - Encode file to base64


How to enable app shortcuts option in ionic apps?

$
0
0

@abhi123 wrote:

I want to add some shortcuts in my ionic app which will be shown to user when he long presses my app icon on homescreen like this.

shortcuts

How can i implement this thing in my ionic app.

Posts: 1

Participants: 1

Read full topic

FileTransfer writing in my binary?

$
0
0

@crosskpixel wrote:

My code

ionic


upload (file: any, url) {

    let options: FileUploadOptions = {
        httpMethod: 'POST'
    };

    for (var i = 0; i <file.length; i ++) {
        this.fileTransfer.upload (file [i], url, options, false)
            .then ((date) => {
                console.log (data);
            }, (err) => {
                console.log (err);
            });
    }
}

node server


app.post (’/ upload’, function (req, res) {
req.setEncoding (‘binary’);
var body = ‘’;

req.on (‘data’, function (data) {
body + = data;
});

req.on (‘end’, function () {
fs.writeFileSync (__ dirname + ‘/00.jpg’, body, ‘binary’, function (err) {
console.log (err);
});
});
});


the problem is!
that the filetransfer is writing this in my binary, leaving my file useless! unless I manually remove it.

binary


  • +++++
    Content-Disposition: form-data; name = “file”; filename = "image.jpg"
    Content-Type: image / jpeg

ÿØÿà JFIF ÿÛ C a ÿÀ Ð " ÿ
ÿ}!! 1 #
(Continued)

  • +++++

(I.e.
Anyone know how I can handle this? !!!
Thank you

I’m brazilian

Posts: 1

Participants: 1

Read full topic

Custom buttons view inside ion-card

$
0
0

@HamdySdiri wrote:

Hello,
I want to display two buttons inside ion-card on the end of item.
I want my interface to be like the above:
buttons

I try to do that and I get this as a result:
buttonnn

this is my view:

<ion-list no-lines *ngFor=" let list of Lists; let i = index">

      <ion-card>
        <ion-row [style.background-color]="getStyle(i, prelevement.lock,1,prelevement.strategeCode)">
                {{list.name}} -
          </ion-col>
          <ion-col  col-3>
                <button width="10%" ion-button color="secondary" (click)="launchPrelevement( prelevement.type)">
                  <div  [hidden]="list .modify!=1">
                    MODIFIER
                  </div>
                  <div   [hidden]="list .modify==1">
                    DEMARRER
                  </div>
                </button>
          </ion-col>
        </ion-row>
      </ion-card>
    </ion-list>

the css:

  .button-md {
    height: 6.6rem!important;
  }

I have another probelm. When i change the size of the screen I got different view from the buttons.

How I can resolve that

Posts: 1

Participants: 1

Read full topic

Ionic tabs with custom button at center

$
0
0

@shinz6 wrote:

Hi there,
I would like to customize my ionic tabs menu like the one in the image below. I am using ionic2. Any idea how?

custom_tabs

Posts: 1

Participants: 1

Read full topic

Why does Ionic Cli remove command parameters passed to the cordova hooks?

$
0
0

@fernandoleal wrote:

I’m implementing a Hook in before_prepare and I need to pass a parameter to my command. Only I realized that the parameter was not being sent to the cordova, not getting into my script, then removes the ionic from the command and the parameter arrives in the script correctly.

Here’s what’s happening:

config.xml:

// ...
<hook src="hooks/build-environment-config.js" type="before_prepare" />
// ...

hooks/build-environment-config.js:

module.exports = function (ctx) {
    console.log(ctx.opts.options);
    console.log(ctx.cmdLine);
};

Outputs:

$ cordova prepare android --flavor=dev
{ flavor: 'dev', argv: [], fetch: true }
C:\Program Files\nodejs\node.exe C:\Users\Usuario\AppData\Roaming\npm\node_modules\cordova\bin\cordova prepare android --flavor=dev
$ ionic cordova prepare android --flavor=dev
> cordova prepare android
{ argv: [], fetch: true }
C:\Program Files\nodejs\node.exe C:\Users\Usuario\AppData\Roaming\npm\node_modules\cordova\bin\cordova prepare android

What can I do so I can perform the command with ionic and pass the parameter to the cordova hook script?

Environment:

Ionic CLI: 3.13.2
Cordova: 7.1.0

Posts: 3

Participants: 2

Read full topic

Publishing ionic app - Error - Calling function 'makeDecorator', function calls are not supported

$
0
0

@jooo13 wrote:

I’m trying to publish my ionic application using the following command line :

ionic cordova build android --release --prod

but I encountred the following problem :

Error: Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in D:/projet/node_modules/@cloudinary/angular/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in D:/projet/node_modules/@cloudinary/angular/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in D:/projet/node_modules/@cloudinary/angular/node_modules/@angular/core/src/di/opaque_token.d.ts

PS: I’m using cloudinary API to store images in the could.
Can anyone help.

Posts: 1

Participants: 1

Read full topic

Ionic app restarts do default

$
0
0

@phlelism wrote:

When i install The APK Android rum The app It works perfectly bit when i close The app Android start It once again The app loaded os The starter app frontal tabs whats going on ?

Posts: 1

Participants: 1

Read full topic


I just updated Ionic to prepare for Ionic Pro migration, now I'm forced to use "ionic cordova" CLI and my project is broken

$
0
0

@RSF_Deus wrote:

  • When building the platform with ionic cordova platform add android, getting plugin from specific git branches doesn’t work anymore, so I can’t install all plugins, resulting in a broken running app
  • Platform now default builds with target 26, even if target 22 is specified in XML, it was building 22 before (I need 22 max for reasons too long to explain here)
  • “ionic cordova run android” doesn’t detect active emulators anymore and launches android studio emulator.

(I may update this list after that)

ermmm… what I am supposed to do here ? And it’s not like I have a choce, I need Ionic services (deploy, etc…) so I have to make the update.

Posts: 1

Participants: 1

Read full topic

Sqllite database size limit

$
0
0

@proiertti wrote:

I’m using the sqllite cordova plugin. I use this code to initilize my db.

this.mydb = win.sqlitePlugin.openDatabase({
name: this.DB_NAME,
location: 2,
createFromLocation: 0
});

How I can set/detect the size of the database? How much data I can store?

Posts: 1

Participants: 1

Read full topic

Error Property 'data' does not exist on type 'string'

Navigate to page and keep the toolbar with menu toggle button

$
0
0

@aelhobbi wrote:

Hi, is there a way to navigate to another page and keep the toolbar with the Menu toggle button?

What is the best way to achieve this in ionic? NavPush pushes to a new page with a back button. But this is not what a aim to do. I have a page with many links to other pages. Is it ok if i use an “html” tag (a)

Thanks

Posts: 1

Participants: 1

Read full topic

How to create a cricket field like Knob in ionic

$
0
0

@YAsh0011 wrote:

i am building a cricket scoring application using ionic3. But i am stuck in direction features. similar to this one built on ionic1

I have find the plugin which this app is using (http://anthonyterrien.com/demo/knob/ - Infinite || iPod click wheel). But i am unable to use it on my project as it require jQuery

I am not bound to use this specific plugin. I just want to build a selectable circle which is like an cricket match ground & user can select different direction from the cricle

Posts: 2

Participants: 2

Read full topic

How to keep the checkbox checked by default

$
0
0

@dougPeddi wrote:

Here is my code:

I want to keep my checkbox checked when I load and reload the page and get the value.

HTML

<ion-item style="background-color: rgba(0,0,0,0); width:100%" >
     <ion-label> Add (10%) </ion-label>
      <ion-checkbox item-right class="checkbox-right" #checkbox
      (ionChange)="addService(checkbox.checked)"></ion-checkbox>
</ion-item>

FILE.ts

addService(service : boolean) { if(servico === true) { this._service = this._total * 10 / 100 } else { this._service = 0; } }

Posts: 1

Participants: 1

Read full topic

camera.getPicture returns error 20

$
0
0

@obinnae wrote:

I’m building an Ionic 3 app for Android, and am using the camera plugin for choosing a pic from the camera or the photo gallery. It works fine when testing on Samsung Galaxy S4 running Android 5.1, and worked on the Android emulator as well as Nexus 6, but lately, instead of showing the gallery, it returns error message ‘20’ (no description, nada, just the number 20).
Here’s part of the code…

Camera.getPicture({
                quality : 75,
                destinationType : Camera.DestinationType.DATA_URL,
                sourceType : Camera.PictureSourceType.CAMERA,
                allowEdit : true,
                encodingType: Camera.EncodingType.JPEG,
                targetWidth: 300,
                targetHeight: 300,
                saveToPhotoAlbum: false
            }).then(imageData => {
                this.base64Image = "data:image/jpeg;base64," + imageData;
                this.newRequest.photo = imageData;
                this.photo = this.base64Image;
            }, error => {
                console.log("ERROR -> " + JSON.stringify(error)); // This line shows ERROR -> 20
            });

This only happens on the emulator and Nexus 6 - it works fine on the Galaxy S4.
Any ideas or suggestions? Thanks.

Posts: 1

Participants: 1

Read full topic


Ionic 3: All my observables send back error on Safari ios with TypeError: null is not an object (evaluating 'this._parentSubscriber.unsubscribe')

$
0
0

@millerf wrote:

Hi,
All my observable are sending this error on ios Safari.

The error is:

TypeError: null is not an object (evaluating 'this._parentSubscriber.unsubscribe')

I get those with any subscription to an observable. For example:

import { Component, ElementRef, Input } from '@angular/core';
import { THEME_DIR } from '../../app.settings';
import { Log } from 'ng2-logger';
import { Http } from '@angular/http';

@Component({
    selector: 'mzk-svg',
    template: '<ng-template></ng-template>',
})
export class MzkSvgDirective {

    private log = Log.create('SvgDirective');

    constructor(private http: Http, private el: ElementRef) {
    }

    @Input()
    set svg(value: string) {
        this.log.info(value);
        let imgUrl = THEME_DIR + 'svg/' + value + '.template.svg';
        this.http.get(imgUrl).subscribe(
            (content) => {
                this.log.info('content', content);
                this.el.nativeElement.innerHTML =  content.text();
            },
            (error) => {
                this.log.error('Couldn\'t retrieve:', imgUrl, error);
            },
            () => {
                this.log.info('complete');
            },
        );
    }
}

dependencies:
"@agm/core": “^1.0.0-beta.0”,
"@angular/animations": “4.4.3”,
"@angular/cdk": “2.0.0-beta.11”,
"@angular/common": “4.4.3”,
"@angular/compiler": “4.4.3”,
"@angular/compiler-cli": “4.4.3”,
"@angular/core": “4.4.3”,
"@angular/forms": “4.4.3”,
"@angular/http": “4.4.3”,
"@angular/material": “2.0.0-beta.11”,
"@angular/platform-browser": “4.4.3”,
"@angular/platform-browser-dynamic": “4.4.3”,
"@angular/tsc-wrapped": “4.4.3”,
"@ionic-native/app-availability": “^4.3.0”,
"@ionic-native/app-version": “^4.3.1”,
"@ionic-native/core": “^4.2.0”,
"@ionic-native/device": “^4.3.1”,
"@ionic-native/device-orientation": “^4.3.1”,
"@ionic-native/ibeacon": “^4.3.1”,
"@ionic-native/in-app-browser": “^4.3.0”,
"@ionic-native/screen-orientation": “^4.3.1”,
"@ionic-native/splash-screen": “4.0.0”,
"@ionic-native/status-bar": “^4.3.1”,
"@ionic/cli-plugin-ionic-angular": “^1.4.1”,
"@ionic/pro": “^1.0.9”,
"@ionic/storage": “2.0.1”,
“rxjs”: “^5.5.0”,

cli packages: (/Users/millerf/Documents/www/Mozaik/mzk_app/node_modules)

@ionic/cli-utils  : 1.13.1
ionic (Ionic CLI) : 3.13.1

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : ios 4.5.2
Ionic Framework    : ionic-angular 3.7.1

System:

ios-sim : 6.1.2
Node    : v6.11.1
npm     : 5.5.1
OS      : macOS Sierra
Xcode   : Xcode 9.0 Build version 9A235

Misc:

backend : legacy

Posts: 1

Participants: 1

Read full topic

Rubber band effect on ios

$
0
0

@emiljenson wrote:

While building in ios, when a page is selected there is a rubber band effect for every page. This isnt required as i am not using pull down refresh… So can anybody help me remove this effect .??

I have tried disallowed overscoll in my config file,…but that didnt work,
And here is a part pf my config file -----

 <preference name="webviewbounce" value="false" />
 <preference name="UIWebViewBounce" value="false" />
 <preference name="DisallowOverscroll" value="true" />

Posts: 1

Participants: 1

Read full topic

Building ionic on ubuntu 16.04 falied

$
0
0

@vicsoft wrote:

:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders
:CordovaLib:generateDebugAssets
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:processDebugResources/opt/android-sdk/build-tools/26.0.2/aapt: 1: /opt/android-sdk/build-tools/26.0.2/aapt: Syntax error: “(” unexpected

FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:CordovaLib:processDebugResources’.

com.android.ide.common.process.ProcessException: Failed to execute aapt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.755 secs
Error: /home/vicsoft/Desktop/nyscPrjct/platforms/android/gradlew: Command failed with exit code 1 Error output:
/opt/android-sdk/build-tools/26.0.2/aapt: 1: /opt/android-sdk/build-tools/26.0.2/aapt: Syntax error: “(” unexpected

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:CordovaLib:processDebugResources’.

com.android.ide.common.process.ProcessException: Failed to execute aapt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

i’ve tried to remove android platform and add it again and also tried to update sdk manager…all was to no avail…please kindly assist me on this issue…i have been on it for some days now…i need to roll out my project for testing but this keep delayin me…

Posts: 1

Participants: 1

Read full topic

Array JSON body - HTTP POST request

$
0
0

@joterito wrote:

I need to send a JSON array in a POST request body. I’m using HTTP native. I have explored some different ways in order to get it:
1.-
let body = [];
body.push({ userId: 1, msg: ‘comment A’ });
body.push({ userId: 2, msg: ‘comment D’ });
body.push({ userId: 3, msg: ‘comment C’ });
HTTPResponse = await this.http.post(url, body, headers);
2.-
body : string = ‘[ { “userId”: 1, “msg”: “comment A” }, { “userId”: 2, “msg”: “comment B” },{ “userId”: 3, “msg”: “comment C” }]’;
HTTPResponse = await this.http.post(url, body, headers);
or
HTTPResponse = await this.http.post(url, JSON.parse(body), headers);

Nothing is going fine, Any help?

Posts: 1

Participants: 1

Read full topic

Generate source map in release build?

$
0
0

@Rasioc wrote:

Hi,
I’m sorry I didn’t find anything related in the docs or forum (only for older versions which do not apply anymore), but I guess it should be somewhere already.

I’m using Sentry for error logging in my application. Sentry supports that you upload source files for JS sources per app version, so they would transform the uglified stacktraces into better readable errors.

So can anybody tell me how I can make ionic to generate JS source files also for productive releases, but on a path which is not included in the final app output, as this must not be part of the compiled app?

A hint in the docs would ne nice about how to do this.

Thanks!

Greetings

Posts: 1

Participants: 1

Read full topic

Viewing all 70889 articles
Browse latest View live


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