How to avoid hardcoded urls in IOS/Android app

时间:2016-10-20 18:37:14

标签: android ios django

I'm developing a django web-project and I'm going to develop its IOS and Android API. Is there a way to avoid using hardcoded url addresses in the app code?Something like django url name system

The following problem faces me if there isn't any solution to my question:

If I want to change some of my urls, I should change the app code and also all the previous installed apps on peoples' devices won't work and should be updated.

1 个答案:

答案 0 :(得分:0)

The way I see it, you probably have two options:

a) Code very generic forwarding links into your app, such as:

http://www.example.com?linkid=1

http://www.example.com?linkid=2

You can then, from your side, forward these on to where you need them to go by using the query string ID number.

b) Write a web service to push updated URLs to your app, maybe on load so you're not polling the service all the time.

How often are the URLs likely to change?