How to create a Weather Forecasting App using Google Cloud API and IBM Weather Company Data Service?

Weather forecasting app, as the name suggests, a simple weather app which will display current weather and forecast to the end user. Not only current weather, but users will also be able to get hourly, daily and many other forecasts based on their geolocation coordinates. This is a really easy tutorial which uses Google Maps API key to fetch data.

It can be used for fetching real time weather forecasting for any location which can help you or your business to solve various problems related to weather. You can integrate and use this method to use the fetched data in any of your app made with Android studio. Moreover you can also get a similar working Weather forecasting app for iOS devices.

In this tutorial you’ll learn:

  1. Integration of Weather data services.
  2. How to use IBM cloud services.
  3. How to use geographical info by user to get weather data with Google Maps API.

Before you begin

Make sure you have all the development tools installed on your rig, also get a Google Map API key, you can check the prerequisites below and go further.


  1. Make sure you have the updated Android Studio and Gradle on your device.
  2. Get Google Maps API Key.
  3. Create Weather Data instance.

Download or update Android studio and gradle, also get the API keys from Google Maps before you begin.

Steps to create Weather forecasting App

  1. Install all the required development tools, mentioned above and create a new project in Android studio. Make sure you have the latest gradle installed to avoid unwanted compilation errors.
  2. Once the gradle sync is over, Find your Google Maps API key and copy it.
  3. Now go to res/values/google_maps_api.xml
  4. Once you open that file, enter your API key there.

    <string name=”google_maps_key” templateMergeStrategy=”preserve” translatable=”false”>YOUR_KEY_HERE</string>

    Replace YOUR_KEY_HERE with the key you got from Google Maps API.        

  5. If you have already created a Weather service instance then open res/values/weather_credentials.xml and enter your credentials in the following manner.

    <string name=”weather_username”>YOUR_USERNAME_HERE</string>
    <string name=”weather_password”>YOUR_PASSWORD_HERE</string>
    <string name=”weather_host”>YOUR_HOST_HERE</string></resources>

Replace YOUR_USERNAME_HERE, YOUR_PASSWORD_HERE and YOUR_HOST_HERE with the credentials you got with IBM Weather Company Data instance.

Tip – If you get & (and character) in your credentials don’t forget to escape it as &amp;

Now sync the gradle again, build APK and run it on Emulator or on your device.

Kudos! That was all to create a weather forecasting app using IBM weather data and Google Maps API.

Now you can move that pointer anywhere and long press on it to get a popup which will show you the weather forecast for that location. You can use this in your business app to solve problems which are related to weather in realtime.

Feel Free to share your thoughts in the comment section below.
Don't forget to follow us on Twitter, like our Facebook Fan Page and Add us to your circles on Google+ to keep you updated with the latest technology news, gadget reviews, launches around the world and much more