Capacitor.isNativePlatform returns false on android Device

Hi,

We have a setup where we redirect to remote web pages as our ionic app. But Capacitor.isNativePlatform is false on those pages. It is expectedly true on the initial page, an “index.html environment” in the original repository.

The setup is roughly like that:

Repository 1:

  • App starting point, local index.html
  • Packages: Capacitor Core, App, Android

Redirects to:

Repository 2:

  • Other parts of the app which are deployed on another remote URL
  • Packages: Capacitor Core, App, Android

I am testing on an android device via Android Studio.

Specifically, I want to access the resume event of the App Plugin but I get the warning implementation unavailable for: App. It is possible to listen to the Cordova resume event on document, though, but that sounds kinda outdated.

Any ideas how get the native platform correctly recognized? I tried setting window.CapacitorCustomPlatform = "android" early on the remote location. That didn’t help.

Is there a way to manually provide conditions for “nativePlatform” on android? Or does anyone have another idea?

thanks!

If it doesn’t work on remote pages, it can happen for several reasons, like bad certificates on those pages, or not having a head tag in the pages you load or using service workers.

Check logcat, if Capacitor fails to inject itself into the page it should be logging some error message or showing a warning.

Thanks for your reply!

Unfortunately Logcat doesn’t log anything useful. Just Connected to process 15559 on device .... After that there’s nothing.