Web api call is failing in higher versions of android


#1

In Ionic 3 Angualar 5 application. The below MVC call is failing in Android 7 and above works fine in Android 5. Any guess why?

> import { HttpClient } from '@angular/common/http';
> 
> 
> ```
> >   constructor(private http: HttpClient) {}
> > .........
> > .........
> > > this.http.post('http://www.mymvcsite.com/controller/action' +'?param1=val1&param2=val2&param3=val3', null).pipe(
> > >     map(this.extractData),
> > >     catchError(this.handleError)
> > >    );
> ```

I am in doubt that because the site is insecure (http not https) the upgraded android versions must be preventing the call, but not sure if that is the cause, I am not android programming expert, please help.


#2

Use angular observable instead http plugin.


#3

Thanks can you please suggest a sample code


#4

sure i will share example. can i know in which platform are you facing problem like browser or android or ios?


#5

The code failed in Android version 7. The same code worked fine in Android 5 and while tested in chrome using >ionic serve command
I have checked one of the sample code https://scotch.io/tutorials/angular-2-http-requests-with-observables my code uses @angular/common/http instead @angular/http


#6

Your are using right one.


#7

can you post any error log, which you are getting in android version 7?


#8

Unfortunately I don’t have this android version in my test environment, I could notice only in the production right now, ionic simulator only simulates cordova version, for simulating specific android version i need to use android studio. can I execute the generated .apk in android studio emulator?


#9

without error log how can we assume what is exact error.