Quantcast
Viewing all 70863 articles
Browse latest View live

Ionic 4 native http timeout when 2+ devices are in the same wifi network

Hi! Im using ionic-native-http / cordova-plugin-advanced-http.

The app makes api rest calls (GET, POST, PATCH) to my server hosted on goDaddy (Economic, cPanel, No SSL).

Everything works perfectly when testing from 1 device(Mobile data or Wifi), responses within 200ms with payload and response size < 1Kb.

The problem comes when I try to use the app in 2+ devices in the same Wifi network, the error is:

{
"status":-4,
"error": "Request timed out: java.net.SocketTimeoutException: failed to connect to subdomain.mydomain.com/(serverIP) (port 80) from /(localIP) (port 39900) after 10000ms"
}

When I test the app in N devices all with their own mobile data all works fine. The only problem is when 2+ devices are in the same network (wifi / mobile data).

  • Tested with the app open and working on runtime:
    • 2+ devices same wifi = Timeout
    • 2+ devices same mobile data = Timeout
    • DeviceA wifi, DeviceB mobile data = Perfect
    • DeviceA mobile data, DeviceB wifi = Perfect
    • 2+ devices with their own mobile data = Perfect

Please help, I’ve searched everywhere without success, I have no clue what could be happening or causing this issue.

Thank you!

1 post - 1 participant

Read full topic


Local Notifications: schedule to a time and repeat after that

So… I have been losing my mind with this over the last few days. I’m using the Local Notifications plugin and I need to send the notifications after scheduling them to a specific time. Such as scheduling the notification to 5h30am and then repeat it every 12 hours.

  schedulePushNotification(id, date : Date, message: string, repeat = -1, endDate: Date = undefined, includeTime: boolean = false){
     var datetime = date; 

     if(!includeTime){ //Set time to 9am if time is irrelevant
      datetime.setHours(9); 
      datetime.setMinutes(0);
     }
      
      //Cancel notification if it exists.
      this.localNotifications.cancel(id).then(()=>{
        if(repeat > 0){
            if(endDate != undefined){
              this.localNotifications.schedule({
                id: id,
                text: message,
                trigger: {firstAt: datetime, in: repeat, every: ELocalNotificationTriggerUnit.SECOND, before: endDate},
                foreground: true
                
              });
            }

What is wrong with this? I tried with just “at” instead of firstAt but didn’t do anything as well. Also, I read on the plugin’s github that firstAt isn’t supported on iOS. How should I approach this issue then, without the firstAt?

If it’s relevant, the problem is to notify the user to take her medicine, after selecting the date and time she took it and the period of the medicine should be applied again.

1 post - 1 participant

Read full topic

Issue with iontextarea

Import React, {useState}from ‘react’;
.
.
.
Const example:React.FC =() =>{
Const { text , setText }= useState ();

Return(

<IonTextarea placeholder value={ text} onIonChange={e => setText ( e.detail.value!)}>
);

}

I followed exactly what is said in ionicframework’s official docs but i get the error as
Property ‘text’ doesn’t exist on type ‘[string | undefined, Dispatch<SetStateAction>]’
Property ‘setText’ doesn’t exist on type ‘[string | undefined, Dispatch<SetStateAction>]’

1 post - 1 participant

Read full topic

Ionic React - IonRouterOutlet - Animation Builder

Has anyone here tried to override the animation for navigation? Docs about AnimationBuilder was pretty vague i dont know where to look at, Main issue was the double rendering of IonPage for every route, since it cannot be avoided without replacing it with Switch, Im planning to override the animation so it wont look as bad as it is now HELPPP

1 post - 1 participant

Read full topic

How can I show an ion-datepicker as popover in iPad

How can I show an ion-datepicker as a popover only on iPad?

I have no problem showing the picker, the problem is that I want to show it as a popover, like on an iPad (same style)

Example:

Image may be NSFW.
Clik here to view.

I’ve been digging around in the documentation but I can’t find the solution.

1 post - 1 participant

Read full topic

Open existing DB

Hello, I’m novice in IONIC.

I’m trying open existing DB (SQLite) with a table and this table is populated with data.
I copy my DB into *www* folder directory of Windows10

My code:

this.sqlite.create({
name: ‘Keeper.db3’,
location: ‘default’,

DB is opened correctly (i have log) but there’s no data retrievend because rows.lenght returned is not greater than 0.

My Code:

str1: String;
let str1 = “select * from users”;
db.executeSql(str1, ).then(res => {
if (res.rows.lenght > 0)
{
alert(“there are rows”);
}
else
{
alert(“there aren’t rows”);
}

Can you help me?

1 post - 1 participant

Read full topic

Ionic 5 - iOS Rendering

Hi,
i’m using Ionic 5 to develop my application. If i run the application forcing mode on ‘md’ in the browser simulation it works well (User Interface) on android or ios device, but if i run the application with --lab options the application is not showed well on iOS Simulator. Same thing on phisical devices. On android all work well but on iOS the graphic is not the same, despite i have forced md mode in IonicModule.forRoot. Why?

Thanks.

1 post - 1 participant

Read full topic

Will ionic can detect ng -if dom rerendering in ionic view did load?

will ionic can detect ng -if dom rerendering in ionic view did load, else how we can get event trigger

1 post - 1 participant

Read full topic


Ionic 5 - Select Option InterfaceOptions Doesn't Work

Hi,
i’m using select option in my Ionic 5 application and i’m using ion-select component with action-sheet interface. If i pass the interfaceOptions parameter with header and buttons, only header is updated, the buttons are ignored. Why? I would like to change the text of cancel button.

Thanks in advance.

1 post - 1 participant

Read full topic

Determine if site accessed by webview or in app browser on ionic

I create an app (ionic-react /will not matter) that has In app browser implemented.
I have auto fullscreen on that website(will be visited by inappbrowser) that will cause error on InAppBrowser. How can I determine, if website was accessed by webview/InAppBrowser so that I can disable the auto fullscreen on that site.

1 post - 1 participant

Read full topic

In Ionic Framework (v5), how do you use blob images saved in the data directory as inline and background images?

I have also posted this on Stack Overflow

I created a function for downloading and saving the blob images so that if the user is offline, the images can still be rendered. I have to do it this way as the products are managed via a CMS.

Here is the function:

downloadProductImages(products) {
  return new Promise((resolve, reject) => {
    this.platform.ready()
      .then(() => {
        for (let i = 0; i < products.length; i++) {
          const productImageUrl = SERVER_URL + products[i].imageUrl,
                fileName = products[i].image;
          this.http
            .sendRequest(productImageUrl, {
              method: 'download',
              filePath: this.directoryPath + fileName,
              responseType: 'blob'
            })
            .then((response: any) => {
              this.file.writeFile(this.directory, fileName, response, {replace: true})
                .then(_ => {
                  resolve();
                })
                .catch(error => {
                  reject();
                });
            })
            .catch(error => {
              reject();
            });
        }
      });
  });
}

Here is the page view I would like the images to render:

<div [ngStyle]="{'background-image': 'url(\'' + (productImage !== '' ? productImage : '../../assets/images/image-not-available.png' | sanitizeUrl) + '\')'}">
  <ion-row>
    <ion-col size="12" size-sm="6">
      <div class="show-mobile">
        <img [src]="(productImage !== '' ? productImage : '../../assets/images/image-not-available.png' | sanitizeUrl)" class="img-responsive">
      </div>
    </ion-col>
  </ion-row>
</div>

1 post - 1 participant

Read full topic

Emulate mouse click/drag as tap/swipe

I am using Ionic Framework 5 for app development.

I have created app that is designed for touch screen. I can try it quite well in iOS simulator or Android emulator. However, since I don’t have a touch screen with me now, I cannot test if touch event is worked if I compiled as Electron app and run it on Raspberry Pi with touch screen. Therefore I would like to simulate the swipe gesture by mouse drag.

For example, if I put an image on page. In mobile OS, the swipe can trigger correctly to swipe page, but on Pi or Windows, regardless running Browser or Electron, dragging mouse does not swipe page at all (and even drag the image out if dragging on image). Is there any way to emulate touch behavior on Browser or Electron?

Even fully disable mouse event is fine because mouse is not supposed to be used at all.

1 post - 1 participant

Read full topic

How to preload modules only if run on device?

How to use preload all strategy on device and nopreload on browser?
we can load all module like this:

imports: [
    CommonModule,
    RouterModule.forRoot(appRoutes, { preloadingStrategy: PreloadAllModules }),
    ...
  ],

This will preload all module in any platform,
But i want to prevent preload when running in browser. And only preload on device.

1 post - 1 participant

Read full topic

Ionic 5 capacitor call-number failing

@ionic-native/call-number@5.26.0
call-number@1.0.1

Installed with:

npm install call-number
npm install @ionic-native/call-number
ionic cap sync

In package.json:

"dependencies": {
    "@agm/core": "^1.1.0",
    "@angular/common": "~9.1.6",
    "@angular/core": "~9.1.6",
    "@angular/forms": "~9.1.6",
    "@angular/platform-browser": "~9.1.6",
    "@angular/platform-browser-dynamic": "~9.1.6",
    "@angular/router": "~9.1.6",
    "@capacitor/android": "^2.1.0",
    "@capacitor/core": "2.1.0",
    "@capacitor/ios": "^2.1.0",
    "@ionic-native/call-number": "^5.26.0",
    "@ionic-native/clipboard": "^5.26.0",
    "@ionic-native/core": "^5.0.7",
    "@ionic-native/in-app-browser": "^5.26.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^5.0.0",
    "call-number": "^1.0.1",
    "lodash": "^4.17.15",
    "moment": "^2.26.0",
    "moment-timezone": "^0.5.31",
    "rxjs": "~6.5.1",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  }

Installed and copied over to both Android and iOS using `ionic capacitor sync". I note that although it finds the plugin there is an error for iOS. I am on Ubuntu, so assume this to be because of that:

✔ Copying web assets from www to android/app/src/main/assets/public in 432.91ms
✔ Copying native bridge in 583.86μp
✔ Copying capacitor.config.json in 554.20μp
  Found 1 Cordova plugin for android
    call-number (1.0.1)
✔ copy in 469.95ms
✔ Updating Android plugins in 5.92ms
  Found 0 Capacitor plugins for android:
  Found 1 Cordova plugin for android
    call-number (1.0.1)
✔ update android in 24.66ms
✔ Copying web assets from www to ios/App/public in 218.04ms
✔ Copying native bridge in 248.80μp
✔ Copying capacitor.config.json in 211.39μp
  Found 1 Cordova plugin for ios
    call-number (1.0.1)
✔ copy in 228.51ms
✔ Updating iOS plugins in 4.77ms
  Found 0 Capacitor plugins for ios:
  Found 1 Cordova plugin for ios
    call-number (1.0.1)
✖ Updating iOS native dependencies with "pod install" (may take several minutes): 
✖ update ios: 
[error] Error running update: /bin/sh: 1: pod: not found

✔ copy in 277.02μp
✔ update web in 3.80μp
Sync finished in 0.75s

In app.module I have:

...
import { CallNumber } from '@ionic-native/call-number/ngx';
...
@NgModule({
 ...
  providers: [
    ...
    CallNumber
  ],
  ...
})
export class AppModule {}

In service code I have:

...
import { CallNumber } from '@ionic-native/call-number/ngx';
...
@Injectable({
  providedIn: 'root'
})
export class UtilsService {

  constructor(
    private callNumber: CallNumber
  ) { }

  public CallPhoneNumber(phoneNumber) : void{
    this.callNumber.callNumber(phoneNumber, true)
      .then(() => console.log('Launched dialer!'))
      .catch(() => console.log('Error launching dialer'));
  }
}

Calling this from a component appears to work in Android emulator, but when compiled in the online AppFlow and deployed as development build to physical iPhone pressing the “call” button which calls this CallPhoneNumber() function does nothing.

I note that it says:

  Found 0 Capacitor plugins for ios:
  Found 1 Cordova plugin for ios
    call-number (1.0.1)

I’m not sure if that’s normal?

Any idea why this isn’t working please?

1 post - 1 participant

Read full topic

Ionic Angular - How to render documents(.xlsx, .docx, .ppt)

Hello,

Is anyone knows how to render documents(.xlsx, .docx, .ppt) inside the Ionic application without any third-party apps?

Thanks in advance.

1 post - 1 participant

Read full topic


Adding a resource in order to use it in local notifications plugin

Hello, I’m using Loca Notifications plugin from capacitator and I’m trying to customize the notifications by adding an icon and a sound but I have no idea where exactly should I put the files in order for them to be in the Android build.

A path to the folder would be amazing.

1 post - 1 participant

Read full topic

Ionic video editor is not working with latest android devices

Hello Team,
I am trying to make a video uploading app. To reduce the size of the videos I am using native ionic video editor plugin. For up to android version 8 plugin is working fine, but for above version 8 plugin is throwing an error for video transcoding:
video transcode error net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Non-baseline AVC video profile is not supported by Android OS, actual profile_idc: 100

My Ionic Info:
Ionic:

Ionic CLI : 5.2.5 (C:\Users\HP\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.8
@angular-devkit/build-angular : 0.13.10
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:

Cordova CLI : not installed
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 12 other plugins)

Utility:

cordova-res : 0.6.0 (update available: 0.14.0)
native-run : 0.2.8 (update available: 1.0.0)

System:

NodeJS : v10.16.3 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10

@ionic-native/video-editor”: “^5.26.0”,
“cordova-plugin-video-editor”: “^1.1.3”,

Please help me in resolving this issue. Any help will be greatly appreciated.

1 post - 1 participant

Read full topic

Wrong video duration with video editor plugin

Hi,
I am working on ionic-v4. While retrieving the file info i’m getting wrong video duration.
I want to validate video under 120 seconds with this wrong duration info i couldn’t proceed with the validation.

The video i try to get info is 71 seconds video. But the below info is what i’m receiving from video editor plugin. Kindly, help me to solve it. Thanks in advance.

videoInfo-
bitrate: 1142270.5
duration: 10660.650390625
height: 720
orientation: “landscape”
size: 11300258
width: 1280

1 post - 1 participant

Read full topic

Phonegap Barcode scanner issue in io13

Recently build ionic app with xCode 11 and testing on iOS 13 iphone. Phonegap barcode scanner opens in background and i have to close the app and then click again then ask for camera permission and open the scanner.
Appreciate your help.

regards
Vinod

1 post - 1 participant

Read full topic

IonViewDidEnter not firing on stacked navigation

I’m facing an issue when navigating with ion-item routerLink.

<ion-item lines="none" routerLink="user/orders">
    <ion-label> 📃 My Orders</ion-label>
</ion-item>

As I initially load my Orders page user/orders, and then navigate to other pages, the event ionViewDidEnter() doesn’t run again when I go back to my Orders page. Once my orders are constantly changing, I need the event to run every time the page is shown (whether it was in pages stack or not) in order to load my orders:

== orders.page.ts ==

ionViewDidEnter() {
    this.orderService.fetchOrders().subscribe(result => {
      this.dataLoaded = true;
    });
  }

Is there anything I’ve been missing? ionViewDidEnter() wasn’t supposed to fire every time the view is shown, regardless of previously being on the pages stack? If not, what ionic life cycle event should I use instead?

1 post - 1 participant

Read full topic

Viewing all 70863 articles
Browse latest View live


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