Loading app when connected to wifi device

My app opens and loads fine when i run my app with and without mobile data turned on.

However, if i connect my phone to a bluetooth device (which doesn’t have internet) prior to opening the app, then try to open the app, it gets stuck on the splashscreen and it doesn’t actually open.

Is there a way to get around this so the app can run in ‘offline’ mode when connected to this bluetooth device? (essentially i would like it to run the same as if mobile data is off and not connected to any devices)

Thanks

There’s probably an error happening on the device. Try connecting a Remote Console and see if it shows any messages:

Thanks, i was trying to remember Remote Console

This issue only happens on iOS.
Using inspect.dev, i was able to see the error when my app gets stuck on the splashscreen.

Is my app missing something?

Thanks

That message can be ignored - it’s meaningless in this context.

Are you doing this while connected via Bluetooth?

This is connected via Wifi, not bluetooth, sorry. Cannot edit first post.

If the app is already open then i connect to the wifi defice, the app runs fine.

If the app is not open and i have connected to the wifi device already (therefore no internet on phone), then try to open the app, the app only shows the splashscreen and gets stuck there - doesn’t load.

Thanks

Upon further testing, i get this error relating to cordova
image

Does that help?

Thanks

Yes, it does. It looks like you’re trying to use a Cordova plugin before it is done being initialized.

Make sure you are not using any plugins until the Main() function is called.

Having no luck with this.

Couldn’t find any places where Cordova plugins are used before my app is initialized.
So i then tried using the HelloWorld example (single button) and i get the same result when i connect my phone to the wifi device.

This is the config.xml used

<widget 
xmlns = "https://www.w3.org/ns/widgets"
id = "au.com.mydomain.{id}"
android-versionCode = "{phoneGapBuildCounter}"
ios-CFBundleVersion = "{phoneGapBuildCounter}"
version = "{version}">

<name>{title}</name>
<description>{description}</description>

<icon src='{icon}' />
<preference name='SplashScreenDelay' value='2000' />
<preference name='AutoHideSplashScreen' value='true' />
<plugin name='cordova-plugin-splashscreen' source='npm' />

<preference name="permissions" value="none"/>
<!-- sample preference specifications -->
<!-- <preference name="autorotate" value="false" readonly="true"/> -->
<!-- <preference name="orientation" value="default" /> -->
<!-- <preference name="fullscreen" value="true" /> -->

<!-- Platforms: Customize as needed. -->
<platforms>
   <platform name="android" />
   <platform name="ios" />
</platforms>

<plugin name="cordova-plugin-statusbar" source="npm" />
  <preference name="StatusBarOverlaysWebView" value="{phoneGapStatusBarOverlay}" />
  <preference name="StatusBarBackgroundColor" value="{phoneGapStatusBarColor}" />
  <preference name="StatusBarStyle" value="{phoneGapStatusBarStyle}" />
 
  <allow-navigation href="*" />
  <access origin="*" />
  <allow-intent href="*" />

<plugin name="cordova-plugin-wkwebview-engine" source="npm" />
<platform name="ios">
  <preference name="WKWebViewOnly" value="true" />
  <feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
  </feature>
  <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>

</widget>

Not sure what to try next. I tried stripping the config.xml to the minimum and it still behaves the same.
As soon as i disconnect from the wifi device, the app loads.

Thanks

The issue isn’t with config.xml - it’s in the actual code of your app.

What steps do I need to do to reproduce what you are seeing here? I’ll try HelloWorld.

sorry for the interruption,is it because he didn’t initialize cordova?

@tst - no, there isn’t a step for that.

This is what i do.

  1. Connect my phone to the wifi device (some recording equipment). Connects over unsecure wifi connection. My phone loses internet connection due to connection.
  2. Try to open my app (say HelloWorld example as above). App get stuck on splash screen and cordova error appears.
    As soon as i turn off the wifi gear, the app loads fully(assuming because my phone gets internet back again). App also loads fine with and without internet connection when not connected to wifi gear.

Only happens on iOS, not Android.

Thanks

Could iOS be objecting to the unsecure wifi?

I’m not sure I can duplicate what you are seeing from your description.

I don’t think so. I noticed that if i open the app first, then connect to the wifi device, the app works fine. So the cordova error only shows if the app if closed, connect to wifi first, then open the app.

This cordova message appears on a number of forums such as this but i’m not sure if they are applicable.

Thanks

Being able to help on this one depends on us being able to reproduce this here. If you could help us do that (even with HelloWorld), it might make some progress.

Thanks for your help up to this point.
I am not sure if there is any easy way for you reproduce it. At this stage, the only thing we can work off is the error message. For now, i might just have to let the app users know to open the app before connecting to the wifi device.

Thanks