App doesn't load on device when not connected to Wifi - reactjs

Not sure where to go with this one as I am not sure if it is code related or something else. I have a working React Native app that works great on the simulator and also on the device when connected to the wifi or plugged into the Mac.
Now I have noticed that when I remove the device and place it on 4G/3G the app does not load and hangs on the loading screen. It may take a number of re-opens of the app before I can get it to run once. Funny thing is that at the minute the app only has the UI built so there are no calls to remote servers etc that may be causing it to hang.
Any ideas?

For iOs, in Xcode you can go Product > Scheme > Edit Scheme... > Run & set the Build Configuration to Release. Then run it on your device & it will be a release build that won't try to connect to your packager, but won't have the sometimes useful developer options at your disposal.

Related

React UI does not make a request to an API on Android device but it does it in Linux

I am writing an app in React in order to make a beautiful UI for my API. When I run it in Arch Linux's Firefox it works well. However, when I run it in my Android device, it seems like the initial API call (inside the useEffect of the App.js) is not done, not in Firefox neither in Chrome.
I am serving the app in the computer and then opening it with my local IP address (not localhost, obviously) with my phone.
Does anyone know why isn't that working in the phone even though it is working in my Linux machine?
The source code (of the UI and of the API) is in my Github (https://github.com/ToniIvars/Localdrive).
Thank you in advance.
I suffer a similar problem recently, may relate to unreachable IP address or some security problem.
I recommend using the chrome remote debug tool to make everything clear, in short that's how to do that:
First, open your phone debug mode, connect it to the PC with adb debug enable
Open chrome on your phone
Open chrome on your PC, go to 'chrome://inspect#devices'
Wait for a second and you should see your device, click inspect on it
Soon you can find out what cause the problem
Here's a full tutorial: https://developer.chrome.com/docs/devtools/remote-debugging/

Dev Tools Inspect Devices very unreliable

I'm currently going through the codelab Enable local fulfillment for smart home Actions. I managed to get (mostly) everything working.
But when I try to debug the typescript app Chrome using the Chrome Dev Tools (chrome://inspect/) I do sometimes see my Google Nest Mini to which the "local execution app" is deployed. But most of the times I do not. All my devices (Dev notebook and Google Nest Mini) are in the same IP subnet.
Any hints or ideas how to troubleshoot that?
The problem is solved. I cleared the list of " Target discovery settings", added the Google Nest Mini IP again and rebooted a few times. Since then it works always.

EXPO React Native App Won't Load From Windows

Hi all,
I am starting a project with one of my team members. Our goal is to create a React Native app with Expo. This isn't the first time I've used Expo or React Native.
The problem:
I use Ubuntu 18.04 and my friend uses Windows 10. As usual Windows is screwing something up. When my friend runs expo start in the same project as me he won't be able to connect to the project from his phone, not am I. But when I start the Expo project with expo start everything works just fine for both him and me.
After testing everything we came to the conclusion that it is not his/my phone or internet. It is his machine that is blocking something and we don't know how to resolve it.
We've tried old projects that run fine on my machine with both phones.
We've tried multiple devices and internet connections.
We've tried turning of all firewalls on his machine.
I posted the original help request on Expo Forums.
I hope someone is able to help!
I found out what the problem was. It seems to be VMware/Virtualbox.
Here is a quoted solution which I found here.
Solution for windows 10.
Go to cmd and write ipconfig. Look what is
the first Ethernet adapter. It should be Ethernet adapter Ethernet. If
it is not and it is something like Ethernet adapter Virtualbox... Then
this is the problem voalaa. Expo is taking the ip adress of the
virtualbox. So go to "Network connections" right click on the adapter
you want disable and change the status to disable. Connect you
computer to ethernet and you phone to the same wifi network. Restart
Expo, then the default url should be changed. Select host->lan, start
the app and then -> run on android. That's it.
I hope that this will help other people!

Force phonegap disconnect

I need to test the online and offline events written in my app. I'm testing the app through my browser so I'd like some code that simulates a disconnect from the internet in phonegap. As in forcing it to go offline then back online, client side. How can I do this?
Have you already tried use PhoneGap Emulation? There is a lot of features.
You can also test directly on device. Android logcat can receive the console.log of browser. I belive this works with xcode too.

Monitor URLs accessed by mobile app

I have downloaded an Android app (which is also available for iPhone and ipad). I want to monitor which URLs it is accessing. On the desktop, you can use tools like Chrome dev tools for browser traffic and Charles Proxy (http://www.charlesproxy.com/) for other app traffic. Is there a similar way to set a proxy for the app from outside it, and then view any connection attempts, possibly with headers and responses?
I only need to do it once, to ensure the app isn't malicious, so the process doesn't have to be the most convenient method in the world. For example, it could involve setting up a proxy app on the desktop and then connecting through that, or running the Android or iOS version on a desktop-based simulator and monitoring that.
When searching SO, a lot is to be found on this topic. The best solution seems to be setting up a desktop to be an access point for the android device and run wireshark on it like suggested here
Capturing mobile phone traffic on wireshark
your best bet is charles proxy trial version
to set up charles proxy is like butter
1) Make sure both computer and device are on the same network
2) Download charles proxy on computer
3) On device go to wifi--> connection name--> hold on to it --> modify --> manual proxy --> give your ip address and port 8888
4) keep charles open on computer while you are doing this
5) you will get a pop up in charles regarding the connection and will start showing you the traffic being captured from the app..

Resources