B4A Library ICOSWorldForecast 3.50

View attachment 14755 View attachment 14754 View attachment 16846 Hi guys, ICOSWorldForecast is here.


It's a pleasure to introduce the new library of weather forecast.

The zip include:

The library, and the demo

INSTALLATION:

Copy the Library in your Basic For Android Library.

Copy the folder weathericon is located in files in the demo. In your one.


RENAME:
ICOSWorldForecast2.71.part1.zip and ICOSWorldForecast2.71.part2.zip

TO:
ICOSWorldForecast2.71.part1.rar and ICOSWorldForecast2.71.part1.rar

In this version I add WeatherUrl and 2 more days forecast.

You can use your own icons, instead of my icons.

For this new version 2.71 you need the new key.

You must register to obtain the new key, otherwise you will get error.

Use the address below to register.

World Weather Online - Welcome to the World Weather Online Developer Network!

don't forget to replace the ApiKey="XXXXXXXXXXXXXX" with your private key

This demos, I made with my galaxy tab 7 600x1024

any question or bugs please report to me.

big Thx to warwound for is fantastic auto-generated reference.


ICOSWorldForecast
Author:
Giuseppe Salvi
Version: 2.81
  • ICOSWorldForecast
    Methods:
    • FCDate (index As Int) As String
      Return Date for which the weather is forecasted
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCDate(0)
    • FCIcon (index As Int) As Bitmap
      Return Weather symbol image
      example:
      Dim a As ICOSWorldForecast
      Image1.SetBackgroundImage=a.FCWeatherIcon(0)
    • FCIconUrl (index As Int) As String
      Return URLIcon For Forecast Condition
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCIconUrl(0)
    • FCPrecipitationMM (index As Int) As String
      Return Precipitation amount in millimeter
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCPrecipitationMM(0)
    • FCTempMaxCelsius (index As Int) As String
      Return Day and night max temperature in Celcius
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMaxCelsius(0)
    • FCTempMaxFahrenheit (index As Int) As String
      Return Day and night max temperature in Fahrenheit
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMaxFahrenheit(0)
    • FCTempMinCelsius (index As Int) As String
      Return Day and night min temperature in Celcius
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMinCelsius(0)
    • FCTempMinFahrenheit (index As Int) As String
      Return Day and night max temperature in Fahrenheit
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCTempMinFahrenheit(0)
    • FCWeatherCode (index As Int) As String
      Return Weather Code
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWeatherCode(0)
    • FCWeatherDesc (index As Int) As String
      Return Weather description
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWeatherDesc(0)
    • FCWinddir16Point (index As Int) As String
      Return 16-Point compass wind direction
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWinddir16Point(0)
    • FCWinddirDegree (index As Int) As String
      Return Wind direction in degree
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWinddirDegree(0)
    • FCWinddirection (index As Int) As String
      Return Compass Wind direction
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWinddirection(0)
    • FCWindspeedKmph (index As Int) As String
      Return Wind speed in kilometer per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWindspeedKmph(0)
    • FCWindspeedMiles (index As Int) As String
      Return Wind speed in Miles per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.FCWindspeedMiles(0)
    • FindLatAndLong As String
      Retrieve accurate latitude and longitude from GPS or network services
    • FindLocation As String
      Retrieve accurate location from GPS or network services
    • Full7DayName (day As Int) As String
      Return Full name of the day ( Monday )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Full7DayName(0) ' 0 = today - 1 = tomorrow etc etc
    • GetList (mCity As String) As ArrayList
      Set the City Name you wish to get the weather
      example:
      Dim a As ICOSWorldForecast
      Dim l As List
      Dim lv1 As ListView
      l = a.GetList("Los Angeles")
      For n = 0 To l.Size-1
      lv1.AddSingleLine(l.Get(n))
      Next
      Sub lv1_ItemClick (Position As Int, Value As Object)ics.CityName = lv1.GetItem(Position)
      lv1.Clear
      End Sub
    • Initialize (EventName As String)
      Initilize the object
    • Short7DayName (day As Int) As String
      Return Short name of the day ( Mon )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Short7DayName(0) ' 0 = today - 1 = tomorrow etc etc
    • StringFormat (format As String, object As Object, object1 As Object) As String
      Return Formatted String
      example:
      Label1.Text=StringFormat("Lat: %1$s - Long: %2$s ",Latitude,Longitude)
    • isWiFiConnected As Boolean
      Check if WiFi is Connected
    Permissions:
    • android.permission.ACCESS_ASSISTED_GPS
    • android.permission.ACCESS_COARSE_LOCATION
    • android.permission.ACCESS_FINE_LOCATION
    • android.permission.ACCESS_GPS
    • android.permission.ACCESS_LOCATION_EXTRA_COMMANDS
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.ACCESS_WIFI_STATE
    • android.permission.CONTROL_LOCATION_UPDATES
    • android.permission.INTERNET
    Properties:
    • ApiKey As String [write only]
      Set your personal ApiKey
      example:
      Dim a As ICOSWorldForecast
      a.ApiKey="XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    • AreaName As String [read only]
      Return Name of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.AreaName
    • CCCloudCover As String [read only]
      Return Cloud Cover in %
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCCloudCover
    • CCHumidity As String [read only]
      Return Humidity in %
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCHumidity
    • CCIcon As Bitmap [read only]
      Return Weather symbol image
      example:
      Dim a As ICOSWorldForecast
      Image1.SetBackgroundImage=a.CCWeatherIcon
    • CCIconUrl As String [read only]
      Return URLIcon For Current Condition
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCIconUrl
    • CCLocalObsDateTime As String [read only]
      Return Local Observation date and time
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCLocalObsDateTime
    • CCObservationTime As String [read only]
      Return Observation time (UTC)
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCObservationTime
    • CCPrecipitationMM As String [read only]
      Return Precipitation Amount in Millimeter
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.PrecipitationMM
    • CCPressure As String [read only]
      Return Atmospheric pressure in Milibars
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCPressure
    • CCTempCelsius As String [read only]
      Return Temperature in Celsius
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCTempCelsius
    • CCTempFahrenheit As String [read only]
      Return Temperature in Fahrenheit
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCTempFahrenheit
    • CCVisibility As String [read only]
      Return Visibility kilometers per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCVisibility
    • CCWeatherCode As String [read only]
      Return Weather Code
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWeatherCode
    • CCWeatherDescription As String [read only]
      Return Weather Description
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWeatherDescription
    • CCWinddir16Point As String [read only]
      Return 16-Point wind direction compass
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWinddir16Point
    • CCWinddirDegree As String [read only]
      Return Wind direction in degree
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWinddirDegree
    • CCWindspeedKmph As String [read only]
      Return Wind speed in kilometer per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWindspeedKmph
    • CCWindspeedMiles As String [read only]
      Return Wind speed in Miles per hour
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CCWindspeedMiles
    • CityName As String [write only]
      Set City you wish to get the weather
      example:
      Dim a As ICOSWorldForecast
      a.CityName="New York"
    • Country As String [read only]
      Return Name of the Country
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Country
    • CurrentDate As String [read only]
      Return Current Day,Month,Year ( Friday, 28 September, 2012 )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CurrentDate
    • CurrentTime As String [read only]
      Return Current time ( 02.09 PM )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.CurrentTime
    • DstOffset As String [read only]
      Return DstOffset = ( GMT +2 )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.DstOffset
    • GmtOffset As String [read only]
      Return GmtOffset = ( GMT +1 )
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.GmtOffset
    • LatAndLong As String [write only]
      Set Lat and Long you wish to get the weather
      example:
      Dim a As ICOSWorldForecast
      a.LatAndLong="40.714,-74.006"
    • Latitude As Object [read only]
      Return Latitude of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Latitude
    • Longitude As Object [read only]
      Return Longitude of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Longitude
    • Population As String [read only]
      Return Population of the city
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Population
    • Region As String [read only]
      Return Name of the Region
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Region
    • Sunrise As String [read only]
      Return Sunrise = 06:04
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Sunrise
    • Sunset As String [read only]
      Return Sunset = 19:36
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.Sunset
    • TimeZoneID As String [read only]
      Return TimeZoneID = Europe/Rome
      example:
      Dim a As ICOSWorldForecast
      Label1.Text=a.TimeZoneID
    • Version As Double [read only]
      Return the version of this library
    • WeatherUrl As String [read only]
      Return url of the city [ http://www.worldweatheronline.com/London-weather/City-of-London-Greater-London/GB.aspx ]
      example:
      Dim Webview1 As Webview
      Webview1.LoadUrl(a.WeatherUrl)
 

Attachments

  • ICOSWorldForecast_DEMO.part1.zip
    293 KB · Views: 986
  • ICOSWorldForecast_DEMO.part2.zip
    167.1 KB · Views: 789
  • Main.png
    Main.png
    86.8 KB · Views: 940
  • Widget.jpg
    Widget.jpg
    81.8 KB · Views: 924
  • ICOSWorldForecast.png
    ICOSWorldForecast.png
    156.3 KB · Views: 985
  • ICOSWorldForecastFree_v3.50_lib_fix.zip
    53.9 KB · Views: 535
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hi marco be patience because WorldWeatherOnline still not work some time yes but the most of the day it still not working.

I get the same error because it doesnt find the date.
ok Giuseppe no problem... we wait
Thank you
 

Laurent95

Active Member
Licensed User
Longtime User
Thank you for your reply Giuseppe.
Yes, there is long time i was not here.
I am released of work now :) But not without many things to do before, so i had no time for my hobbies.

Before we can get the weather by the IP address, in fact the server return the city of the Internet connexion management for the user.
That was an interesting possibility because that works in all places and i'm asking myself if i can use it always.
I thanks you for your time to take a look.

I wish you a nice evening.
Regards, Laurent.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi marco be patience because WorldWeatherOnline still not work some time yes but the most of the day it still not working.

I get the same error because it doesnt find the date.

Good Morning Giuseppe.
Today all work ;)
Thank you again
Marco
 

Laurent95

Active Member
Licensed User
Longtime User
Good Morning Giuseppe.
Today all work ;)
Thank you again
Marco

Hi Marco & Giuseppe,
Yes all seems working since yesterday evening.
But i still have some questions for Giuseppe.
1) What's the difference between the new API2 method and the old method on the website ?
2) Can we use the same API keys on the website with API2 url, or we need to have new API keys for version 2 ?
I have try yesterday with the old keys and library v3.5 but i obtain errors.
For be honest it's hard to know now if it's due to the API key or the problems from their website.
3) Giuseppe, have you planned to put conditions weather for ski and marine in the library ?

Thank you for your time Giuseppe, as always you do your best.

Regards, Laurent.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Marco & Giuseppe,
Yes all seems working since yesterday evening.
But i still have some questions for Giuseppe.
1) What's the difference between the new API2 method and the old method on the website ?
2) Can we use the same API keys on the website with API2 url, or we need to have new API keys for version 2 ?
I have try yesterday with the old keys and library v3.5 but i obtain errors.
For be honest it's hard to know now if it's due to the API key or the problems from their website.
3) Giuseppe, have you planned to put conditions weather for ski and marine in the library ?

Thank you for your time Giuseppe, as always you do your best.

Regards, Laurent.

Hi Laurent, the different between api and api2 they just changed the URL from API to API2.

Yes U can still use the old key.

I'm making the new library will include still 5 days and 3, 6, 12 and 24 hourly for the new library U'll need the new key.
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, the different between api and api2 they just changed the URL from API to API2.

Yes U can still use the old key.

I'm making the new library will include still 5 days and 3, 6, 12 and 24 hourly for the new library U'll need the new key.

Hi Giuseppe,

Thanks for the informations.
That will be very nice to have the hourly conditions soon :)

Regards, Laurent.
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent, the different between api and api2 they just changed the URL from API to API2.

Yes U can still use the old key.

I'm making the new library will include still 5 days and 3, 6, 12 and 24 hourly for the new library U'll need the new key.

Hi Giuseppe,

Some news for the new version of the library ?
Because i'm working on a new update of my widget.
That would be nice to put the new hourly datas.

The Website seems not working good many time, have you the same problem ?

Regards, Laurent.
 

coslad

Well-Known Member
Licensed User
Longtime User
Hi Giuseppe, I tried your demo code but it references to the 'ICOSWorldForecast' library, but you attached at the fist post the 'ICOSWorldForecastfree' library. Is there a working demo?

Ciao Giuseppe, ho provato ad eseguire il tuo demo ma la libreria a cui si riferisce non è quella che hai allegato, alcuni metodi sono differenti, hai un demo funzionante ?
 

Laurent95

Active Member
Licensed User
Longtime User
Hi Laurent,.../...
I'm making the new library will include still 5 days and 3, 6, 12 and 24 hourly for the new library U'll need the new key.

Hi Giuseppe,

News about the new library ?
I am not sure i haven't missed something since i was in my new place, i'm still a bit busy.
Thanks for your reply.

Best regards, Laurent
 

MetalOS

Member
Licensed User
Longtime User
Hello, I started on Basic4Android and I just tested the example supplied with your library only I get several errors in the Log. Here is a screenshot to show you the problem. Thank you in advance for your help.

 

Laurent95

Active Member
Licensed User
Longtime User
Hello, I started on Basic4Android and I just tested the example supplied with your library only I get several errors in the Log. Here is a screenshot to show you the problem. Thank you in advance for your help.


Hello,

Your errors are not related to the library.
The variable 'a' is the instance of library, it's what i remember, that's why it generates errors because not assigned.
It's because you don't put the library in your additional library folder or you put it but you don't select it in the libraries tab inside B4A.
Tip : After put library in library additional folder, and select the library in libraries tab, if it's needed, click right and use refresh for B4A knows the new environment.

Regards.
Laurent
 
Last edited:

MetalOS

Member
Licensed User
Longtime User
Hello Laurent, thank you for your help,

The problem is just that I have checked the library in B4A and I still these errors

Bonjour Laurent, merci de ton aide.

Le problème est là justement, j'ai bien coché la librairie dans B4A mais j'obtient ces erreurs.
 

Laurent95

Active Member
Licensed User
Longtime User
Hello Laurent, thank you for your help,

The problem is just that I have checked the library in B4A and I still these errors

Bonjour Laurent, merci de ton aide.

Le problème est là justement, j'ai bien coché la librairie dans B4A mais j'obtient ces erreurs.

Hello,

It's a bit weird, try to declare again the instance of the library in the code.
Or you can try to declare an instance of the library in a new project.
Normally in BA4 if your library is recognized you can access to the object ICOSWorldForecastFree, otherwise you don't see it in the IDE.
Take a look at the print screen below.
EDIT : Code in the print screen is not the example of Giuseppe, no matter if it's different, it's working in same way.

And you can verify if the instance of library is normally declared in the global (or local) module, but in the example normally that's done already.
I say that because the precedent post, indeed in example it's still declared like with the old library, see above : https://www.b4x.com/android/forum/threads/icosworldforecast-3-50.21852/page-24#post-336993
B4X:
Sub Process_Globals
  Dim a As ICOSWorldForecastFree         '< this line.
End Sub

In last, i have seen in posts that if you aren't registered within B4A, you can't access to additional libraries, maybe that's it the problem.
In this case try to contact Erel for that, it's better.

Good luck.

Regards, Laurent.

P.S.: Thank you for French, it's ok, you can use English language. I'm trained all days with my wife, even it's not my native language.:)
And it's better here in English forum.
 

Attachments

  • ba4libraryinIDE.png
    ba4libraryinIDE.png
    80.3 KB · Views: 219
Last edited:

MetalOS

Member
Licensed User
Longtime User
I have a business license B4A that normally allow me to use an external library. I try changing the code as you suggested but I still get errors.
 

Laurent95

Active Member
Licensed User
Longtime User
I have a business license B4A that normally allow me to use an external library. I try changing the code as you suggested but I still get errors.

:confused:
Have you try to do another project with another library and declare the instance of it ?
If that not works also, the problem is not due to the library.
In this last case, it's better to open a new subject because maybe it's related to BA4 or Java directly.

The best way is you post your example that you try to use, Menu File, Export as Zip, and i will try to see where the errors are.
But i can't guarantee that's working at last, because for me the example works fine.

After we still have the church to put a candle :D (joke)
 

MetalOS

Member
Licensed User
Longtime User
I'll find 5 minutes to try a new project and I'll keep you posted. Thanks for your help.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
:confused:
Have you try to do another project with another library and declare the instance of it ?
If that not works also, the problem is not due to the library.
In this last case, it's better to open a new subject because maybe it's related to BA4 or Java directly.

The best way is you post your example that you try to use, Menu File, Export as Zip, and i will try to see where the errors are.
But i can't guarantee that's working at last, because for me the example works fine.

After we still have the church to put a candle :D (joke)


Hi Laurent I'm back.

Sorry for the inconvenience
 

MetalOS

Member
Licensed User
Longtime User
Hello, I started on Basic4Android and I just tested the example supplied with your library only I get several errors in the Log. Here is a screenshot to show you the problem. Thank you in advance for your help.


Hello, I always encounter the same problem when compile the example. anyone have a solution? I use the latest version of Basic4Androidvet I have a business license. I Presice I am new on B4A. Thank you in advance for your help.
 
Top