YWeatherGetter4a


Source link: https://github.com/zh-wang/YWeatherGetter4a

YWeatherGetter4a

An Yahoo Weather API wrapper for android

An iOS version can be found here. https://github.com/zh-wang/YWeatherGetter4i

Works on android 2.3 or above.
Sample app can be found on Google Play.
https://play.google.com/store/apps/details?id=zh.wang.android.yweathergetter

Request and response elements are defined here.
https://developer.yahoo.com/weather/documentation.html#response

Check the XML structure returned by Yahoo Weather API here.
Sample Weather API Response - Shanghai

For more information, check Yahoo's document here.
Yahoo Weather.

  • Install

    compile 'zh.wang.android:yweathergetter4a:1.3.0'

  • How to use ( Sample Activity)

    • Implement YahooWeatherInfoListener in your Activity. INTERNET and ACCESS_NETWORK_STATE permissions are required.

      @Override public void gotWeatherInfo(WeatherInfo weatherInfo, YahooWeather.ErrorType errorType) {
      
        if(weatherInfo != null) {
      
      // Add your code here
      
      // weatherInfo object contains all information returned by Yahoo Weather API
      
      // if `weatherInfo` is null, you can get the error from `errorType`
        
      }
       
      }
      
    • Get a instance of YahooWeather class.

      ```java YahooWeather mYahooWeather = YahooWeather.getInstance();
       ``` 
    • Query by place's name. You can replace cityAreaOrLocation to what you want. For example, "Tokyo Japan", "Acaraù Brazil", "Shanghai China", etc.

      ```java public void queryYahooWeatherByPlaceName(final Context context, final String cityAreaOrLocation, final YahooWeatherInfoListener result) ``` 
    • Query by latitude and longitude

      ```java public void queryYahooWeatherByLatLon(final Context context, final String lat, final String lon, final YahooWeatherInfoListener result) ``` 
    • Or use device's gps to detect current location. ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION is required.

      ```java public void queryYahooWeatherByGPS(final Context context, final YahooWeatherInfoListener result) ``` 
  • Other settings

    • You can set connect timeout and socket timeout by setConnectTimeout and setSocketTimeout. Or get the instance by getInstance(int connectTimeout, int socketTimeout).

    • If you use GPS position for query, the result WeatherInfo will contains an Address object, which is the detail address object return from Geocoder. It contains a lot of information but this lib only use locality, adminArea, and countryName by default. See YahooWeather.addressToPlaceName and Geocoder for details.

  • What kind of weather information can I get? You can get

Developed By

Zhenghong Wang - [email protected]

License

Copyright 2017 Zhenghong Wang  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

A simple fake VuMeter (or equalizer) for Android.

A small utility to record Android device screen to an optimized GIF so you can paste it to GitHub or a similar service.

A simple formatter library which formats dates in a fuzzy form for display in apps.

A Powerful Android Content Provider ORM. It uses Content Providers to access the data and internally uses SQLite to actually store the data. It can be used as a typical ORM, by creating Java objects and applying some Annotations and/or by extending QuantumFluxRecord on them and they will be accessed normally and creates ContentProvider.

GraphHopper is a fast and memory efficient Java road routing engine. By default it uses OpenStreetMap data, but can import other data sources.

This plugin provides allows to show drawable resources of the android project, supports IntelliJ IDEA and Android Studio.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes