Problem with mobile application. Meteor connection status

Hello guys!

I have some problem with Meteor.js application after building APK. I tried to develop simple app for Android but I have some issues. So from the beginning…

I’ve installed Meteor.js, Android Studio and all works great. I have an android emulator and when i tried to run application with command:

meteor run android

all worked fine and I have connection with the Meteor.js server (server is on my local computer). I checked it for simple calling method from the user side by putting this simple code on the every click button event:

Meteor.call('test');

and on the server side i set console.log to show random message. In addition, when the user clicks on the button appears alert with Meteor.status().connected information (on the PC android emulator is always “true”).

But when i put my application to APK and ran it (Samsung Galaxy S4) then only once it shows that the connection is true (server shows single information) but after a while my page is white (like a refreshed) and afer a while app appears again… after all, every click on the button fire informs that the connection is false. I tried to put event like that:

window.addEventListener("pageshow", function(){
    Meteor.reconnect();
    alert(Meteor.status().connected);
}, false);

but it doesn’t work. What is also worth mentioning i added an acces rule to my mobile-config.js file:

App.accessRule('*');
App.accessRule('http://192.168.1.107:3000/*');

Thanks for any advice!

The problem is solved. I ran my meteor server by command

meteor run --mobile-server 192.168.1.2:3000

and all works great! I don’t know that I should delete this topic, maybe it could be usable for others :slight_smile:

Hi ,
Please let me know ,Is it working for apk file.
In my case it is not working, I have used meteor ~/path --server Appname.meteor.com and I am unable to connect the server