[Solved] Android app server communication only for the first launch!

Hi there,
I made a small and very simple app and finally passed all the process to publish it on google play store :smiley:

But now I have an unpredicted problem :persevere:

The application is quite long to launch and works only the first time after having installed it from the play store. If I kill it and click on the icon again, I’ll just have the static elements (title) but nothing related to the appear…
The same thing also happens when I click on a link listed by the app to open it internally and go back to the list although it works well during development ($ meteor run android-device).

I tried it on 2 different phones, removed eventual dev installs, built the server again but it doesn’t fix it, I have no clue on where the problem could come from.

My app works well on this link: https://interesting-links.luteciacorp.org/
You can try the android client by yourself here : https://play.google.com/stor/apps/details?id=com.interesting_links.release
public git: https://gitlab.com/bidetaggle/interesting-links

Build command:

$ meteor build ../build --server https://interesting-links.luteciacorp.org --directory

Command on the server:

$ nohup `PORT=3000 MONGO_URL=mongodb://db-user:db-password@localhost:27017/db-name ROOT_URL=http://interesting-links.luteciacorp.org node main.js` &

mobile-config.js:

App.info({
    id: 'com.interesting_links.release',
    name: 'Interesting links',
    version: "0.0.2"
});

App.icons({
    'android_mdpi': 'icons/thelema-48x48.png',
    'android_hdpi': 'icons/thelema-72x72.png',
    'android_xhdpi': 'icons/thelema-96x96.png',
    'android_xxhdpi': 'icons/thelema-144x144.png',
    'android_xxxhdpi': 'icons/thelema-192x192.png'
});

App.launchScreens({
    'android_mdpi_portrait': 'icons/launchscreen-320x480.png',
    'android_hdpi_portrait': 'icons/launchscreen-480x800.png',
    'android_xhdpi_portrait': 'icons/launchscreen-720x1280.png',
    'android_xxhdpi_portrait': 'icons/launchscreen-960x1600.png',
    'android_xxxhdpi_portrait': 'icons/launchscreen-1280x1920.png'
});

App.setPreference('BackgroundColor', '0xff272931');
App.setPreference('HideKeyboardFormAccessoryBar', false);

App.accessRule('http://*', {type: 'navigation'});
App.accessRule('https://*', {type: 'navigation'});

Did you use --mobile-settings during build of the apk?

I did that to build the android apk

$ meteor build ../build --server https://interesting-links.luteciacorp.org --directory

I didn’t use --mobile-settings, I have no settings.json file, is it necessary ?

By the way, an idea about why it does work only the first time, then I have to reinstall it to make it work again ?

I have the same problem! ,

Hi, I’ve fixed this problem using PORT=3000 ROOT_URL=http://localhost with an apache config

...
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
...

It looks like a dirty hack but it is actually the only thing I’ve found working. You can see my full working configuration on this post Is it ok if http://myapp.domain.com:3000 is reachable? where I was looking for a feedback about my solution.

I hope it can helps you, let me know about it :slight_smile:

Nice , I try you way ! It works ! It look like the cordova app can only connect the port 80 or 443 , other port 3000 count’t work !

I build my app ,use
meteor build /apk --server=m.mydomain.com

server side run at port 3000

nginx proxy it
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# the root path (/) MUST NOT be cached
if ($uri != ‘/’) {
expires 30d;
}
}

1 Like