I cant hit my api through real device


i can hit my api through ionic cordova run browser , but when i try to debug and build it to mobile device , the api wasnt get hitted by my app… any one can help ?

heres my source code:

this.camera.getPicture(options).then((imageData) => {
let base64Image = ‘data:image/jpeg;base64,’ + imageData;
this.userPhoto = base64Image;
let loader = this.loadCtrl.create({
content: “Uploading…”,
let data = {
userId: this.userData.userId,
userPhoto: base64Image
console.log(data,‘untuk di upload’)
this.userService.changePicture(data).subscribe(res => {
}, (err) => {
// Handle error

i try to upload from ionic native, but it keep error while using mobile but from postman or browser it works weell

Have you added the rights in config ?

i think i did

i have following this

but still cant reach my api, the only thing api that cant be reached is the one who has aws service on it

Do you get any err while hitting the api?? If possible share a screenshot of your console.

i try to upload smaller file image, it work, but when i pick the image taking from camera which is the size is more biggger than last one, it send error. is there is a maximun size to upload file to aws ? sorry for oot

Can you share the error that you get while invoking api from the device?

Thanks and Regards
Anand Raj

i made a handle in my server when something wrong it throw to the next one, but it keep throw there. some time it work, some time it doesnt when using real device

do you convert it to base64 before uploading or using file uri??