React-Native simulate device is disconnected - react-native

Turning genymotion (or device) wifi causes app be unable to connect to app bundle and goes to show the red error in react-native. So how can I simulate app behavior when is disconnected from the internet (and also developing to have a good react (I mean it's not just about testing, also developing))?

There are only 4 states possible:
connected with good connection (have access to remote servers)
connected with poor connection (loss percentage is high)
connected with zero connection (have not access to remote servers - 100% loss)
not connected
Simulations way depends on which situation you need and where your app is running (device:iOS, Android?, simulator: mac, windows?)
On iOS you have Developer menu in the preferences and Network Link Conditioner in.
On Mac you can install Network link conditioner by this
I`m sure android has some tool for it.
Can`t say something about windows, sorry

Related

Can the development build installed on my phone be used and debugged through the Internet like Expo Go App does?

Currently I am working on a map app that tracks users position and generate their walking route. I wish I can go outdoor and test if the app can tracks the users' position in time. Currently I have set up a EAS build and now I can connect my developement build to my computer and test it wirelessly through WiFi, but it said it lost connection to Metro once I disconnect the WiFi connection.

React Native Expo can't connect from phone to laptop on same wifi

I am building react native app with expo and I'm currently using public wifi because I'm traveling.
On the bus and in the hostel's wifi I've experienced an issue:
- Phone can't connect to Expo running on Laptop (same LAN wifi)
After trying many times to connect using the wifi, and also trying to see if Windows firewall has something to do with it, I finally found out what might be the issue and a temporary workaround.
Issue:
Some routers have a configuration called AP Isolation, that might be activated on the router/wifi of the public place you're using, to avoid someone hack into someone else's computer. So basically no device on the same network can communicate with the other.
Temporary workaround:
The only way I've got this working was by enabling a Wifi Hotspot on my Android phone and connecting the laptop to it. This means I'm using my phone's 4G connection for internet too. Expo seems like it needs to access the Internet and if you don't have data won't work.
The other way might work is if your Windows or Mac computer is able to create a virtual access point. So instead of connecting laptop to phone, you do it the other way around.
Hope this helps someone!
You should be able to run on a virtual device via expo. On my Macbook I run on iOS if doing work in a place where I do not have internet but on a PC you should be able to run the Android Emulator.
While this might not provide the not intuitive way of doing things as you'll be using a virtual device instead of a physical one, it still is very quick and responsive. Just know that animations may not be as smooth.
I fly frequently and running on virtual devices has enabled me to work when otherwise it would be impossible.

Application loader is waiting and network connection was lost

When I click the send button for sending my app in Application Loader, it is waiting for a response (sent API usage to iTunes Connect, waiting for response) and waiting without error. I am getting a message "the network connection was lost" after a couple minutes. I tried another network connection but the issue was not resolved. Could the issue be on iTunes network?
It should just work if you quit Application Loader, then re-open it.
To submit an application to iTunes Connect, your Mac always need to be up to date, or you will be able to get errors. To do this click on Apple's logo > Software Update. I was having the same problem, and it solved for me. Cheers =)
I had to force quit and the re-open to make it work.
A normal restart did not work, nor did a restart of my Mac. Very weird.
Make sure your iTunes Connect user has admin privileges. I had it set at Technician and everything looked like it was working but it would hang on the "Sending API Usage to iTunes".
None of the above suggestions work for me. Likely the real cause is physical and related how Application Loader is using the internet. I have ADSL connection with a Netgear modem/router assigning each device at home a fixed IP address according to the mac address of the network interface of each device. I had noticed that when Application Loader is uploading, my Windows PC could not connect to the internet. However, if in Mac mini I use Safari doing various things like watching video, my Windows PC can access internet.
Even stranger, when Application Loader is uploading, the modem/router could easily lost connection to the internet, as I could see from the LED lights of the modem. The connection is lost randomly at any progress of uploading the 20 MB file.
So I had turned off Windows PCs, iPads, iPhones and Android device at home, so Mac mini is the only device using the Internet, the Application Loading has finally been able to upload the app successfully in one go.
My guess is, my home phone line has some noise, and Application Loader is using the internet aggressively particularly the up link, so stressing out the modem, then causing other devices like my Windows PC lost connection, not even able to resolve host.
So my working solution is to make Mac be the only device using the Internet, given that the internet connection is already in poor condition with noise, near the edge of losing connection.

Share one android device for developing

We are several people (in different cities) developing on titanium. We have only one device to check how the application works on a real device.
Can we share somehow one device to check how application works on a real device?
The idea is to have one PC with remote access and Titanium running with connected git\mercurial repositories. Android device connected to this PC by USB. The user connects by Remote Control to the PC, pulls data from repository and runs application on the device.
The problem that we have is how to get access to screen of the Android device on the PC to control it.
Does someone have an idea how it could be organized?
This link (http://code.google.com/p/androidscreencast/) says it will help, but it has limitations. I guess this solution would make sense if you are doing most of the testing on the local emulator and the physical device is a final check for functionality.

GPRS on iPhone Simulator

I want to activate/enable GPRS on the iPhone programmatically. What are the APIs I can look into? There is no "Network" option in the settings application on the simulator so do I need to test out the application on the device itself?
Using the SDK, you can't "activate" any sort of network access. Simply try to connect to the remote server.
If the device can connect, it will. If it cannot, you need to detect this and display a warning to the user.
Apple's sample code has plenty of examples on how to detect if a network is active.
The Simulator always connects through the host Mac's internet connection. If you are asking how to test GPRS performance on the simulator then you should buy a USB GPRS radio and test rhrough that. You could also use the built in ipfw to throttle network bandwidth to the simulator and simulate GPRS bandwidth (note that latency would still be that of your hows connection). Throttled provides an easier UI than bare ipfw: http://www.intrarts.com/throttled.html
As August says, you can't switch the network on and off from code however, you can test the connection and suggest the user goes and switches on the connection.
There is good sample code from Apple for testing the connection availability and type: http://developer.apple.com/iphone/library/samplecode/Reachability/index.html