I'm trying to create an Android app with Ionic to send messages to a Node.js server. I'm using socket.io#2.3.0 for the server and socket.io-client#2.3.0 for the Ionic app. The Ionic app is supposed to open a socket.io connection with the server, then send the message "Hello, World!". The Ionic app build for the web works properly, I tried running it from other devices (my laptop and my phone) and in both cases the socket.io connection worked and the server printed out the message received from the Ionic app.
// Server output
Server running on port 5000.
New connection from 7rI7qvo9gNjVD5ElAAAA
Hello, World!
But when I build the Ionic app for Android using the commands:
ionic cap add android
ionic cap open android
And then debug from Android Studio, the app launches, but I don't see any message from the server, and I don't even see an error message in the Android Studio debug tab.
// Server output
Server running on port 5000.
At first I thought this was a network problem so I made sure the AndroidManifest.xml file included the permissions INTERNET and ACCESS_NETWORK_STATE, I tried building an APK and running it on my phone, but it still doesn't work so I don't know what I should do.
I'm using the version 5.4.16 of Ionic.
Thanks for reading this, have a nice day :)
I fixed this issue by hosting the Node.js server on Heroku, now everything works fine, I'm not sure why though. Since the protocol changes from http to https when I host the server on Heroku, I'm guessing Android doesn't like the http protocol.
Related
I have this ionic app that consumes from a server api (Spring). When i use capacitor to use the android version it works fine on the emulator from android studio, but when using a real device the http requests doesn't work. It retrives the message: "Msg: Status: 0, Message: Http failure response for http:///login: 0 Unknown Error". Things i tried: Disabled the firewall and use the same wi-fi from server.
message from server
I have a probleme with Http angular in ionic. I made some post requests to my server and everything work in the browser and the mobile with the devapp (ionic serve --devapp), but when i build my apk, then sign it, i install the apk in my android phone, the the post dont work !
I tried also with the native http, but it dont work also !
Any help please
I was using ws://example.com:3000/websocket for connecting Android-ddp to meteor app. Meteor was runing on example.com:3000. It was working fine.
Now I deployed the app using mup on the same URL, example.com and port: 3000. I am able to access the app on browser but can't get it working with Android-ddp. It just won't connect.
What I might be doing wrong?
Analyze the logs on both server and client side to obtain more details on the problem.
I built a react-meteor android app, which I signed with Android Studio for a release.
The app is loading with a splash screen and then stuck in den loading screen of my React Komposer ( I guess the subscription does not get ready ).
However running the app via:
meteor run android-device --mobile-server https://fuldacity.de
runs the app successful, as well as running from signed debug apk.
I really do not now where to start to debug this problem. I guess there is a possiblity to get some error logs out of Android Studio? I would be really glad on any inspiration on how to tackle this problem!
Furthermore I have the feeling it is connected to my setup. I have a domain hosted by domainfactory, where I also get my https certificate from. The domain is then redirected to Heroku, where my App is hosted. I furthermore redirect all http:// accesses to https:// via the Meteor package force-ssl.
`
Try like this:
meteor add-platform android
After
meteor install-sdk android
After
meteor run android-device --mobile-server https://fuldacity.de
Long story short the error was on domainfactory where I have choosen the IP instead of the domainname as A configuration for the nameserver.
Domainfactory does not allow a the correct settings for usage of heroku. Now I use the nameservers of Route 53 which could setup the right CNAME settings to heroku.
For the debugging I also learned that you can
meteor run android-device --server https://fuldacity
then go to your chrome browser (on your pc) open the developer tools and there you can find remote devices which gives you all the error outputs from the client side!
This let me to the network error, which only appeared on the mobile devices.
I'm making a todo list app, using meteor and cordova full code is at: github.
I've added an Android app version. Login is via accounts-password.
The server is running via nodejs with an nginx frontend.
The problem:
If I build the server with the android-platform then connect an android device to it the login buttons appear briefly but then the screen refreshes and they're gone and will not return unless the app cache is cleared.
If I build the server without the android-platform then it works fine. This happens with meteor run android (emulated). meteor run android-device and via loading an APK from the play store.
I assume what is happening is building the server with android platform results in a different version of the code being put on the server which then gets pushed to the phone when it connects.
But I have no clue how to debug this.