Android Question Setup file

Alex_197

Active Member
Licensed User
Hi all.

I have a question. My app connects to the server to exchange a data. All works fine. Currently I hardcoded server's IP address. It's not on a public domain.
But what if the url will change later?

My question is - how can I create a text file with url and add it into my apk so the app will be able to open this file and read whee the server is.
 

Sandman

Well-Known Member
Licensed User
I would instead recommend relying on DNS to solve this problem for you.

Note that you can create your own domain to point to anything, you don't need to rely on a previously existing domain, if that's a concern to you.

Doing it like this would mean you can update the IP without having to update the app.
 

JohnC

Well-Known Member
Licensed User
Maybe this would work:

 

Alex_197

Active Member
Licensed User
I would instead recommend relying on DNS to solve this problem for you.

Note that you can create your own domain to point to anything, you don't need to rely on a previously existing domain, if that's a concern to you.

Doing it like this would mean you can update the IP without having to update the app.
I know, but it's not up to me. The web site that this app will be connected is not quite ready.
So now it's under IP only.

But this is also arise another question - how to update this setup file itself after the web site will be put under domain without updating the app itself?
 

Alex_197

Active Member
Licensed User
Maybe this would work:

I read this text.
But this is also arise another question - how to update this setup file itself after the web site will be put under domain without updating the app itself?
 

JohnC

Well-Known Member
Licensed User
The web site that this app will be connected is not quite ready.
So now it's under IP only.
A website's address should never change, and if it does, your hosting provider should automatically update it's DNS servers to the new ip address so your domain name will always resolve correctly and you don't have to do anything. So, once your new website is fully running under its domain name, there is no reason to update the app.

But if there is a chance that the domain name needs to change for some reason, you could put an error message in your app for when it can't access the website (the old domain name doesn't work anymore) it will say "Can not access cloud service. Please check the Play Store to see if there is an update to this app.".

So, if the domain name ever needs to change, then you can simply upload a new update for your app with the new domain name and the error message in the old version of the app will direct the users to install the new update.

In summary, you should not release the app until the IP address of your website propagates so the app can access your website using the domain name.
 

Alex_197

Active Member
Licensed User
A website's address should never change, and if it does, your hosting provider should automatically update it's DNS servers to the new ip address so your domain name will always resolve correctly and you don't have to do anything. So, once your new website is fully running under its domain name, there is no reason to update the app.

But if there is a chance that the domain name needs to change for some reason, you could put an error message in your app for when it can't access the website (the old domain name doesn't work anymore) it will say "Can not access cloud service. Please check the Play Store to see if there is an update to this app.".

So, if the domain name ever needs to change, then you can simply upload a new update for your app with the new domain name and the error message in the old version of the app will direct the users to install the new update.
Thanks
 

Sandman

Well-Known Member
Licensed User
I know, but it's not up to me.
Sure it is. I think you missed my point completely.

I'll give it another shot. Let's say the server is located at 1.2.3.4 at the moment. You don't know what the finalized IP address will be, nor do you know what the actual domain name will be, as the customer haven't decided yet. That is not a problem. You could just register your own domain to 1.2.3.4, and use that domain in the app. So, for instance, you could register alex197project2020.com and point that at 1.2.3.4. In your app you just use that domain. After a while your customer decides that the actual IP for the server should be 9.8.7.6 and they will use the domain server.example.com. Their domain name is of no interest to you, you and your app will continue to use the one you registered. The only thing you will need to do is point alex197project2020.com to 9.8.7.6 and you are golden - no changes to the app needed.

A website's address should never change
I have no idea how you can say that. The IP address can easily change if you change hosting provider, for instance. (That's not an uncommon thing.) And that's not a big deal, as you just update the DNS record to point to the new provider.

your hosting provider should automatically update it's DNS servers
This makes me think you assume that you use the same provider for DNS and hosting. That is far from true for all cases. I would actually say it's more likely for smaller sites to have both those eggs in the same basket. I have lots of domains, and I use one provider to handle my DNS records, as they are doing a good job at that. And I'm using another hosting provider for my many servers, as they are doing a good job at that.
 

JohnC

Well-Known Member
Licensed User
I have no idea how you can say that. The IP address can easily change if you change to hosting provider, for instance. (That's not an uncommon thing.)
I did not know that people change hosting providers often because the only time I ever change hosting providers if one starts to offer poor service, which rarely happens. Do you switch providers commonly?

This makes me think you assume that you use the same provider for DNS and hosting. That is far from true for all cases.
What I meant, is that if you do change domains (or hosting providers for that matter), you do NOT have to change the domain name in the app because the name servers for the new domain/hoster name servers will take care of deciding what IP address to direct it to.
 

Sandman

Well-Known Member
Licensed User
I did not know that people change hosting providers often
You are misquoting me. I did not say "often", I said "if you change hosting provider" ...

only time I ever change is if a hosting provider starts to offer poor service, which rarely happens
... which is a good example for what I wrote.

if you do change domains (or hosting providers for that matter), you do NOT have to change the domain name in the app because the name servers for the new domain/hoster will take care of deciding what IP address to direct it to.
I absolutely agree. My recommendation was based on the fact that the IP did not yet have a public domain name, so instead one could create a domain name for it instead of waiting for the customer.
 

JohnC

Well-Known Member
Licensed User
I absolutely agree. My recommendation was based on the fact that the IP did not yet have a public domain name, so instead one could create a domain name for it instead of waiting for the customer.
Yes, the developer could use their own custom name server to do the redirecting. But I doubt the client would be OK with that (having their app totally rely on the developers name server to forever keep working) when everything goes live. So, this would mean that the app would need to be re-released at some point anyway with a version that will use the real domain name and not an IP address.

So, my recommendation is to keep the app as-is using the IP address of the server so everything can be tested.

Then when the site goes live, release the final version of the app that uses the domain name instead of its IP address.
 
Last edited:

Alex_197

Active Member
Licensed User
A website's address should never change, and if it does, your hosting provider should automatically update it's DNS servers to the new ip address so your domain name will always resolve correctly and you don't have to do anything. So, once your new website is fully running under its domain name, there is no reason to update the app.

But if there is a chance that the domain name needs to change for some reason, you could put an error message in your app for when it can't access the website (the old domain name doesn't work anymore) it will say "Can not access cloud service. Please check the Play Store to see if there is an update to this app.".

So, if the domain name ever needs to change, then you can simply upload a new update for your app with the new domain name and the error message in the old version of the app will direct the users to install the new update.

In summary, you should not release the app until the IP address of your website propagates so the app can access your website using the domain name.
My client wants to start now. Even though the web site is not quite ready.
 

JohnC

Well-Known Member
Licensed User
My client wants to start now. Even though the web site is not quite ready.
You have two recommendations - just choose the one that best meets your particular needs.
 
Top