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

Is there an ion-select ok event?

$
0
0

Is there an ion-select ok event like the ionCancel event?
In my case i prepopulate an ion-select and the user has to confirm the selected option or change to another one.
If he changes the option thats ok because i can use ionChange on the ion-select to call my function.
But i need to call the same function when the user presses ok.

How to do this?


How to check a web api call through the interceptor?

$
0
0

Friends,
I am new in interceptor concept of ionic 3. As a requirement i need to check the net connectivity before calling a web service. I call web services through ‘providers’. I created a request interceptor with code

import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse }
  from '@angular/common/http';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/do';

@Injectable()
export class RequestInterceptor implements HttpInterceptor {
  intercept(
    req: HttpRequest<any>,
    next: HttpHandler
  ): Observable<HttpEvent<any>> {

    return next.handle(req).do(evt => {
      if (evt instanceof HttpResponse) {
        console.log('---> status:', evt.status);
        console.log('---> filter:', req.params.get('filter'));
      }
    });

  }
}

and included in app.module.ts.

My doubt is how this interceptor can check the web service call ? please provide a sample code to clarify the idea…

Thanks
Anes

Error connection result

$
0
0

any help please … I’m blocked in this error

Integration with CCAVENUE PAYMENT GATEWAY with IOINC 2 or IONIC 3?

$
0
0

Hey IONIC Team,
Is there any plugin or chance to work on the CCAVENUE PAYMENT GATEWAY INTEGRATION with IONIC 2/3 ? Please update. Thanks.

Ionic View and Ionic DevApp useless when trying to upload images

$
0
0

No. My initial post wasn’t about deprecated or sunsetted plug-ins. It was clearly about how to do it without those plug-ins.
My thoughts about View and DevApp are on how it could be that I am the only one who has problems to deal with images on those tools.
So long:
A suggestion from a moderator to not use those tools (that’s why I flagged the answer: a suggestion to not use the tools from the Ionic Team, from a moderator of the forum!)
An answer, not to the question, but a praise for pro Ionic services.
A suggestion to use even another solution (Capacitator) and a doubt on if this tool is yet ready.
An accusation of being frustrated.
Another answer treating me as an idiot because it is easy to find angular third party libraries on npm.
The last one is a penalty for not doing my homework and a disclaimer for not following your advice. Even when I did and the main question is not about the unavailability of the plug-ins, but a clear Typescript/Angular/Ionic question derived from the way done under your advice!

But also so long no references at all of how to create a File Object from camera.getPicture outcomming data.

Ionic View - HTTP

$
0
0

Having trouble getting the Native HTTP plugin to work from within Ionic View.
If I print out the error of the http get call, I get “plugin_not_installed”

I do see that the plugin is supported: https://ionicframework.com/docs/pro/view.html#plugin-support
My version is: <plugin name="cordova-plugin-advanced-http" spec="^1.10.2" />

So the steps I followed was:

  • Created a new blank ionic project with the latest CLI (Ionic 3)
  • Then linked the project to my Ionic Pro account and ran git push ionic master (no gitignore file)
  • I then deployed the successful build, but when I open Ionic View on my phone and test it I get the above error as soon as I press the button

Does this have anything to do with CORS?
The HTTP call obviously works if I install the apk on my phone.

This is my source code:

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

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

  data: any;
  error: any;

  constructor(public navCtrl: NavController, private http: HTTP) {

  }

  getStuff() {

    let url = 'http://myurl.com';

    this.http.get(url, {}, {})
    .then(data => {

      this.data = JSON.parse(data.data);

    })
    .catch(error => {

      this.error = error;

    });

  }

}
<ion-header>
  <ion-navbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
  <button ion-button (click)="getStuff()">Get Stuff</button>
  <p>Data: {{data}}</p>
  <p>Error: {{error}}</p>
</ion-content>
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { HTTP } from '@ionic-native/http';
import { HttpModule } from '@angular/http';
import { HttpClientModule } from '@angular/common/http'

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';

@NgModule({
  declarations: [
    MyApp,
    HomePage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    HttpModule,
    HttpClientModule
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    HTTP
  ]
})
export class AppModule {}

OneSignal coding push problem

$
0
0

Hi,
In an ionic project, I tried to send push when press a button, the code is like below:

message: any = {
app_id:"wikdffjf-cfa1-49k1-b309-333b81ff64kkb",
contents: {"en": "This is content"},
headings:{"en":"This is title"},
included_segments: ["All"]
};

and the function is like below:

sendNotification(message) {
const body = JSON.stringify(message);
const headers:any = new Headers();
headers.append('Authorization', 'Basic XXXXXXXddkdkctM2FmNS00N2EwLWIwZmEtYTg1NjgyNTliYTUx');
headers.append('Content-Type', 'application/json');
return this.https.post(this.url, body, {
headers: headers
}).map((data: Response) => data.json());
};

Show no error so far, but when I click the button, nothing happen.
I am sure that the app id and the api key are correct. But it just won’t work, could someone please help me to check what’s wrong with the code? Thank you.

Unable to find network status

$
0
0

exactly but don’t know whats going wrong??/?


Problems with text to speech

$
0
0

Hi,
I am trying to use TTS.tts and passing a long string approx 5000 charecters but it it not speaking while shrten the string with less then 4000 charetcerts, it is speaking the text.

$scope.speakText = function(text) {
console.log(text);
console.log($scope.data[text]);
$scope.showSpeakBtn = false;
$scope.showStopBtn = true;

if (window.cordova) {
TTS.speak({
text: $scope.data[text],
locale: ‘en-US’,
rate: 1.0
}, function () {

       // Do Something after success

   }, function (reason) {
       // Handle the error case
   });
}

}

Please suggest how to resolve this.

Ionchange Freez App

$
0
0

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

In Ionic Ion-segment-button

App Freeze in ios while tapping

$
0
0

Hi community,
Iam facing an issue of freezing the app in ios build.There is no issue in android build.
The app is freezing at the time of tapping on drop down
Is there any solution for this.
Any reply appreciable
Thanks,

Continuesly app run in background

$
0
0

I want to play an audio continuesly when app is on background mode. I dod the following thing. But it is not working. Why?

constructor(
  private backgroundMode: BackgroundMode,
  private nativeAudio: NativeAudio) {
  this.backgroundMode.on("activate").subscribe(() => {
	this.nativeAudio.preloadComplex('newAlarm', 'assets/media/alert.MP3', 1, 1, 0);
	setInterval(this.alarm, 10000);
  });
  this.backgroundMode.enable();
}

getNewHire = () => {
  this.nativeAudio.play('newHire');
}

I did this like the examples in this link.

https://www.javascripttuts.com/mixing-local-notifications-and-background-geolocation-in-ionic/

Transfer to native file.dataDirectory() from Assets folder

$
0
0

Did you ever get anywhere with this? I’ve got the exact same issue. The only thing im trying to do is open a local PDF file. I thought copying it to the external storage would mean I could then open it in the In App Browser which doesnt seem to be able to access the local assets folder. But im getting the same “ENCODING_ERR”. :frowning:

Ionic build error - Error at processDebugResources

$
0
0

Hi, i have problem with running ionic cordova run – prod

yesterday it was all working ok, problem started this morning. I didnt add/update any plugins or other components. I tried to delete whole project, then clone repository from github and npm install, but it didnt help. Any ideas how to solve this?

Weird thing is, that iam getting this error even when iam trying to build my other app.

Error looks like this:

:processDebugResources
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex


FAILED


BUILD FAILED

Total time: 49.418 secs
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':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.
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

my ionic info looks like this:

cli packages: (C:\Users\Vartex\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : not installed

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.9.0
    npm  : 5.6.0
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy

and my ionic cordova requirements looks like this:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-27,android-26,android-25,android-24,Google Inc.:Google APIs:24
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-2.14.1\bin\gradle

Login Page with credentials to appear First in Priority

$
0
0

Hello ,
i wanna create a login page with credentials for the End-User.
The concept is :
After the authentication login screen disappears and home page appears.
If we don’t have the right credentials then Try Again.

I have created a new page inside Pages named loginScreen
My question is how can i set the loginScreen page to appears first in priority before Home page?

Thank you

Can we navigate to another page from Model

$
0
0

I create a model like menu and I want to link pages to it is it possible to move another page

Ionic size differences

$
0
0

I have decided to move my project away from ionic, and i successfully finished it. :slight_smile:

The main reason was the size, the too many bugs, which is not maintained for years and i was not able to introduce angular 5 on time. Later on i realized that i would like to move away from angular also, and going to react like direction.

Size: It started from 2.5MB + 460KB css (css now is around 5KB), and when i removed all ionic part from my code it did go 754KB with ionic included (485KB with angular cli). The last 40KB reduction was only an AlertController and Gesture stuff, which i already modified as it’s not used some functionality of Hammer.

I’m using some test data which is included in the bundle under data folder, so the real replacement of the ionic is 150KB at the moment, after cleanup it will go around 100KB very likely. It replaces angular event system also, and using generated forms also, which saves a lot on ngFactory classes size (as there is no template for them - i slashed hundred KB-s on that part). (coming from server) The first idea was to share it, just the concept, but after all my whole app is 95% reusable, so it would be quite risky. To make a working project, you only need to define the data folder in json. (without any code)

My next step to process cordova, i saw also an interesting, but finished project called Microsoft Ace.
When cordova was started, very likely android and ios were a little bit odd framework. At least what i saw that you can replace cordova with 5-10 lines of code.

I jumped also to some native browser component, instead of using ionic, because the majority of the browser already implemented that stuff. I was not focusing on toast and cards, footer / header, which are really just pain on the ass. (you can do it with divs, or css grid)

I have made a special container, which split up the tab component. The tab buttons in my case is independent line of buttons.

With Ionic:

Without Ionic: (after 4 month ui development)

OneSignal Ionic Native not working

$
0
0

Hi All,

Having some trouble with OneSignal Ionic Native.

I’ve tried testing it on a real device using BrowserStack App live. Its registering a new user,
though not one that I can send notifications to.

I have a pod installed for OneSignal and I’ve added the required code in iOS to use the SDK as follows:

var iosSettings = {};
          iosSettings["kOSSettingsKeyAutoPrompt"] = false; // will not prompt users when start app 1st time
          iosSettings["kOSSettingsKeyInAppLaunchURL"] = false; // false opens safari with Launch URL
          // OneSignal Code start:
          // Enable to debug issues.
          // window["plugins"].OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});

          try{
               this.oneSignal.startInit('@@@@@@@@', '@@@@@@@');
               this.oneSignal.registerForPushNotifications();
               this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);

               this.oneSignal.handleNotificationReceived().subscribe(() => {
                // do something when notification is received

                console.log('Notification Received!');
                
               });
               
               this.oneSignal.handleNotificationOpened().subscribe(() => {
                 // do something when a notification is opened
               });
               
               this.oneSignal.endInit();

               var iosSettings = {};
               iosSettings["kOSSettingsKeyAutoPrompt"] = false; // will not prompt users when start app 1st time
               iosSettings["kOSSettingsKeyInAppLaunchURL"] = false; // false opens safari with Launch URL
               // OneSignal Code start:
               // Enable to debug issues.
               // window["plugins"].OneSignal.setLogLevel({logLevel: 4, visualLevel: 4});
               var notificationOpenedCallback = function(jsonData) {
                 console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
                 if (jsonData.notification.payload.additionalData != null) {
                   console.log("Here we access addtional data");
                   if (jsonData.notification.payload.additionalData.openURL != null) {
                     console.log("Here we access the openURL sent in the notification data");
         
                   }
                 }
               };
         
               window["plugins"].OneSignal
                 .startInit('@@@@@@@@@@@@@')
                 .iOSSettings(iosSettings) // only needed if added Optional OneSignal code for iOS above
                 .inFocusDisplaying(window["plugins"].OneSignal.OSInFocusDisplayOption.Notification)
                 .handleNotificationOpened(notificationOpenedCallback)
                 .endInit();
           
    

Any help would be greatly appreciated.

Thanks

Add flag Module

Viewing all 230064 articles
Browse latest View live


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