Search code examples
androidopenweathermapweather-api

Multiple weather API keys in one app


Weather APIs (e.g. OpenWeatherMap) have limits of calls, If u exceed the limit API stops working. Those limits are linked to API key. What if I used multiple API keys in one app? Theoretically I could have a file which stores multiple free keys, everytime I connect with api I could random one of those keys to bypass the limits this way. Other option would be to store those keys online in database and download one, which didnt exceed limit. Would such solutions be viable?


Solution

  • This should work because it is the user who initiates the request so it will be received from different IP addresses. If you don't set user agent it will report as something like

    Dalvik/2.1.0 (Linux; U; Android 6.0.1; SM-G935F Build/MMB29K)
    

    I don't think the restrict mobile apps but in case they do you can set the user agent yourself ie. to

    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36 
    

    and you should be fine.