question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple inconsistencies in lib behavior (Android)

See original GitHub issue

Tested on React Native (Android only):

  • 0.59.8
  • 0.60.3
  • 0.62.2

We are trying to integrate this library in a production level. So far, we’ve stumbled upon numerous issues, that do not appear to have been resolved in version 4.1.0.

Xiaomi Redmi Note 8 Pro - MIUI version 11.0.3.0 (based on Android P)

  • Wifi permission request loop that breaks randomly (with or without user interaction)
  • Connects to Wifi with internet connectivity, but cannot perform external API requests

Huawei P30 Lite - EMUI version 9.1.0 (based on Android P)

  • Connects to Wifi with internet connectivity inconsistently
  • Cannot connect to IOT device in the same WLAN

Xiaomi A2 Lite - Android One (Android Q)

  • Connects to Wifi consistently, always without internet connectivity

Example usage:

const connect = () => {
  WifiManager.forceWifiUsage(true);
  WifiManager.connectToProtectedSSID(ssid, password, false)
    .then(() => {
      // do stuff
    })
    .catch(() => {
      // handle error
    })
    .finally(() => WifiManager.forceWifiUsage(false));
};

Based on the information above, can you point me to a certain direction as to what the issue may be?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
Rapsssitocommented, Jun 1, 2020

@dimgrav, looks like forceWifiUsage() causes some connectivity issues (see #76). If you are using a TCP connection to communicate with your IoT devices, a possible workaround is react-native-tcp-socket, it allows you to bind your socket to an specific interface (ethernet, wifi, cellular, etc.) without forcing the whole app to use the WiFi connection.

Disclaimer: I am the creator and mantainer of react-native-tcp-socket

0reactions
eliaslecomtecommented, Aug 4, 2020

Yes it should be fixed.

What’s the code you are currently using?

try {
  await WifiManager.connectToProtectedSSID(ssid, password, false);
  await WifiManager.forceWifiUsage(true)
  // execute api calls here
} finally {
  await WifiManager.forceWifiUsage(false))
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Inconsistent behavior when compiling Android apps
I have two Android apps I'm looking at - one that I created a while back and another that I'm just making now....
Read more >
Detecting Inconsistencies in Multi-Platform Mobile Apps - People
Abstract—Due to the increasing popularity and diversity of mobile devices, developers write the same mobile app for different platforms.
Read more >
Known issues with Android Studio and Android Gradle Plugin
Fixed known issues · Lint exceptions in Kotlin projects: Kotlin projects that set checkDependencies = true may encounter null pointer exceptions or errors...
Read more >
Android 7.0 Behavior Changes
This change in behavior aims to create a consistent app experience across platform updates and different devices. Even though your code might ...
Read more >
Manage manifest files - Android Developers
xml file, but your Android Studio project may contain several—provided by the main source set, build variants, and imported libraries. So when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found