[SOLVED] $state.go not working without internet


#1

Hello!
My app works fine on device when internet is available.
But when the internet is turned off on device, the $state.go doesn´t work…
I´m using this:

$state.go('tab.home');

I already changed the “cache: false” on app.js…
Somebody already faced this problem, or have a hint?
Thanks!


#2

Have you looked at the console using Chrome remote debugging to inspect your app on your your real device plugged in usb port? Maybe you may find some failed request to access remote assets.


#3

$state.go is nothing related to the internet. It will work even in offline mode also. Did you check your console. There might be something wrong while the function is getting executed. If you are testing it in the real device connect the device through USB and run the command ionic run ios --device -l -c. This will show all the logs in the terminal, which might help you in understanding what’s going wrong.


#4

Hello @gmarziou and @rajeshwarpatlolla !

Your suggestion to try the chrome remote debugging and ionic run --device doesn´t help, because when you try to do this without internet on device, you see an error to connect to http://computer_ip:8100

Just to check, I´ve made another app using the “blank” template and tried:

ionic start myapp blank
ionic platform add android
cd myapp
ionic run android --device -l -c

On device I can see the error informing that the web page is unavailable on http://172.16.0.50:8100 (172.16.0.50 is my computer IP, of course).

So, I ask: can you successfully use “ionic run android --device -l -c” if your device internet is off on device? Already tried?

If this debug method doesn´t work without internet, will not help me to find the problem with state.go not working without internet… =(

And I need my app working if internet is off too… Thanks!


#5

I test my app without internet connected through USB without any problem using ‘ìonic run android’, I don’t need the other options cause I’m using Chrome remote debugging and only USB is required to do so. I suspect these options you use require more.


#6

@gmarziou you are right… using only “ionic run android” the app runs ok without internet. So, I tried the Chrome remote debugging using my app and still can´t see nothing wrong. But I will keep trying, and post here when solved. Thanks for the tip =)


#7

@gmarziou my bad… the Chrome remote debugging is very good. I just forgot to click on “inspect” again.

As you said, it helped me to see “failed request to access remote assets”, because of a problematic $cordovaNetwork.isOnline()

Thanks, many thanks!!! =)