• Home
  • BG topo map 1933
    • Topo map Rila Mountain
    • Topo map Vitosha Mountain
  • Forum
  • Geocoding Tool
    • Geocoding
  • Shop
  • Trips
  • About
    • Advertise
Mapsys.info
Mapping and geospatial news.

Google Tasks API and OAuth 2.0

Since we launched the Google Tasks API we have received a warm welcome from the developer community on the public forum, and a lot of question on how to make it work with OAuth 2.0 on Android. Let’s see how this can be done.

Android has its own native authorization flow and its own way of handling Google accounts as you can register them on your device. Since Android 2.0, the AccountManager manages the accounts that you have registered – the ones that are listed under Settings > Accounts & sync. Specifically, it handles the authorization flow and can generate authorization tokens that are required to access data using APIs.

Accounts registered in your Android environment

You can use the AccountManager to get the Google account you want to access the Tasks for. Though as the AccountManager also manages accounts from other vendors you can simply instantiate a GoogleAccountManager which is provided in the Google APIs Client library for Java and only handles Google accounts:

GoogleAccountManager googleAccountManager = new GoogleAccountManager(

  activity);

Account[] accounts = accountManager.getAccounts();

If more than one Google accounts are available on the Android device you should prompt the user for the account he wishes to use through a dialog.

Now that the user has chosen an account (or if there was only 1 Google account) you can ask the AccountManager to issue an authorization token for the Tasks API. This is done by calling the AccountManager.getAuthToken() method. The AccountManager will take care of contacting the Google APIs authorization endpoint and run the AccountManagerCallback that you have defined in the method call when it has retrieved an authorization token:

googleAccountManager.manager.getAuthToken(account, AUTH_TOKEN_TYPE, null,

  activity, new AccountManagerCallback() {

    public void run(AccountManagerFuture future) {

    try {

      // If the user has authorized your application to use the tasks API

      // a token is available.

      String token = future.getResult().getString(

        AccountManager.KEY_AUTHTOKEN);

      // Now you can use the Tasks API...

      useTasksAPI(token);

    } catch (OperationCanceledException e) {

      // TODO: The user has denied you access to the API, you

      // should handle that

    } catch (Exception e) {

      handleException(e);

    }

  }

}, null);

The Android AccountManager has support for OAuth 2.0. A user friendly AUTH_TOKEN_TYPE exists for the Tasks API which will make the AccountManager return an OAuth 2.0 access token:

String AUTH_TOKEN_TYPE = ”Manage your tasks”;

During the AccountManager.getAuthToken() call the AccountManager will check if your application has been authorized to access the Tasks API. If your application has not yet been authorized the user will be presented with an authorization dialog so that they can Allow or Deny your application to use the Tasks API on their account.

Authorization dialog

Another piece of getting the Tasks API to work using OAuth 2.0 on Android is that you also need to specify an API Key when making calls to the Tasks API. The API Key is mandatory as it identifies your application and therefore allows the API to deduct quota and use the quota rules defined for your project. You can get it from the Google APIs Console at API Access > Simple API Access > API Key. You need to specify the API Key on your Tasks service Object:

useTasksAPI(String accessToken) {

  // Setting up the Tasks API Service

  HttpTransport transport = AndroidHttp.newCompatibleTransport();

  AccessProtectedResource accessProtectedResource = 

    new GoogleAccessProtectedResource(accessToken);

  Tasks service = new Tasks(transport, accessProtectedResource, 

    new JacksonFactory());

  service.setKey(INSERT_YOUR_API_KEY);

  service.setApplicationName("Google-TasksSample/1.0");


  // TODO: now use the service to query the Tasks API

}

At this point you should have a fully setup Tasks API service Object which you can use to query the API as per the Tasks API developer’s Guide.

If you would like to get more tips and learn more about getting the Google Tasks API and OAuth 2.0 working on Android please have a look at our newly published article.

Also we recently added a new sample to the Google APIs Client Library for Java sample repository to help you getting started with the Tasks API and OAuth 2.0 on Android.

13/09/2011 | Posted in: Access, Android, app, device, Google, IT, map, maps, news, Twitter, Work | Tags: account, api, app, application, client, google-calendar, google-contacts, google-tasks, map, maps, news, nicolas-garnier, tasks | No Comments »

Some New Updates to the Bing Maps Account Center

 

If you manage data sources in Bing Maps then you know we’ve made several updates to the Bing Maps Account Center and the REST Web Services in the last few weeks. We released more changes to the Bing Maps Account Center including bug-fixes, improved usability and some new features for the management of your own points of interest (POI) in the cloud. The top 3 improvements are:

1. Direct Publishing of Data Sources
Management of your own data sources in the cloud is generally possible through the Bing Spatial Data Service API as well as through the Bing Maps Account Center. The Bing Spatial Data Service provides a comprehensive set of REST APIs for batch geocoding and reverse geocoding your own POI data sets, uploading them into the Bing Maps data centers, and querying them.

image

In the past one of the major advantages of the Bing Spatial Data Service over the user interface in the Bing Maps Account Center has been that you were in full control of the data flow. You could decide if you wanted to geocode a data set first or if you just wanted to upload an already geocoded data set. The user interface in the Bing Maps Account Center did not give you that flexibility and would have always geocoded or reverse geocoded your data sets. This could have been particularly unpleasant if you moved your already geocoded data set, for example, from the MapPoint Web Service Customer Data Store or the Multimap Client Zone to Bing Maps. In that case the process behind the user interface would have taken the latitudes and longitudes in your data set, reverse geocoded them, and then would overwrite the address information. With the latest update to the Bing Maps Account Center this limitation has been removed and you are now in full control whether you use the API or the user interface.

image

To just upload a data set, check the box Publish without geocoding.

 

2. Map Navigation for Data Editing
Editing records in a data set has been possible before. However, in order to view the location of a record in the map you always had to click the Edit link. With the latest release you can just mouse over a record and it will show on the map, thus allowing you to have a quick look to decide if editing is necessary at all.

 

3. Enhanced POI Data Search
You can now search for any field in the data set even if it is part of the address or a custom field. This feature has been available in the API before, but is now also available in the user interface.

 

We hope these updates improve your experience with Bing Maps and spatial data services. We are continuing to enhance these services and expand all they can do. Stay tuned for more information coming soon.

 

12/08/2011 | Posted in: bing, Bing Maps, internet, IT, links, mapping | Tags: account, account-center, address, api, bing, bing maps, bing maps account center, bing maps at microsoft, latest, location, mappoint, microsoft, multimap-client, search, tag | No Comments »

The New Account Center, REST Services, and Documentation in Bing Maps

 

Today we are announcing the number of updates that have been made to the Bing Maps Account Center, Bing Maps REST Services and the Bing Maps MSDN documentation.

Bing Maps Account Center

The new updates in the Bing Maps Account Center make it easier to maintain your location data sources through the account center without the need to have to re-upload your entire data source.

The latest updates to the data source management tools allow you to:

Add or create a new dataset record in an existing data source. Before this update adding a new record to an existing data source required making the addition to a local copy of the data source and then re-uploading the complete data source.

Edit a Data Sources Schema. You can now edit the schema of data sources that are already uploaded to the Bing Spatial Data Service. You can add a new property field or edit the data type of an existing field. This saves you the time of having to re-upload your complete data source.

Upload Tab of Pipe delimited data source files. Originally only the Bing Spatial Data Service XML file schema was supported by the Bing Maps Account Center. Now you can upload Tab and Pipe delimited data sources that meet the schema requirements outline here. Note that Tab delimited files work great with Microsoft Excel.

Besides updates to the data source management tools you also now have the ability to:

Watch a Video Tutorial on how to create a Bing Maps Key. A link is provided in the left hand menu that takes you to a video tutorial giving an overview of the Bing Maps Account Center and explains how to create a Bing Maps Key. This video and other videos on Bing Maps news can also be found here.

Experience Improved Performance. Several performance enhancements have been made to the service to allow for an improved user experience. In addition several bug fixes were included which helped to not only improve performance but also improve the stability of the service.

In addition to updating the Bing Maps Account Center Help documentation for the new data source upload capability (including a new topic Deleting a Data Source), there is a new topic Updating Your Bing Maps Account that includes instructions about how to change the Live ID associated with your Bing Maps Account.

Bing Maps REST Service Updates

The Bing Maps REST Imagery Service has had an additional parameter added to it that now allows you to generate static map images with the pushpins de-cluttered. To use this new feature simply add one of the following to your REST call: “declutterPins=1” or “dcl=1”

Here is an example that creates a map with road imagery and specifies two pushpins that are located very close together. The declutterPins (dcl) parameter is set so that the pushpins both appear separately. If the declutterPins parameter were not set, the pushpins would overlap. Maps for both cases are shown below.

Here is an example with de-cluttering enabled:

http://dev.virtualearth.net/REST/v1/Imagery/Map/Road/47.6156352,-122.2043549/12?pp=47.6156352,-122.2043549;;1&pp=47.612441,-122.204533;;2&declutterPins=1&key=BingMapsKey

 

 

Making the same request but without enabling de-cluttering would return the following:

 

Bing Maps MSDN documentation Updates

There have been a number of new useful articles added to the MSDN documentation on Bing Maps. Code samples were added the Bing Spatial Data Services Query API that show how to use the query API in C# and VB.

Two cross platform API articles were written:

Show Bing Results on a Map: This article shows how to build a web page that uses the Bing API, Version 2 to search for Phonebook entries near a location and then displays the results on a map by using the Bing Maps AJAX Control, Version 7.0 (interactive map) or the Bing Maps REST Services (static map). The Bing Maps REST Services is used to geocode the specified location.

Show Spatial Data Search Results on a Map : This article shows how to build a web page that uses Bing Spatial Data Services to search a data source for entries near a location and then displays the results on a map by using the Bing Maps AJAX Control, Version 7.0 (interactive map) or the Bing Maps REST Services (static map). The Bing Maps REST Services is used to geocode the specified location. The public FourthCoffeeSample data source is used as the sample data source in this example.

 

 

30/07/2011 | Posted in: bing, Bing Maps, internet, IT, links, mapping | Tags: account, ajax, api, article, live, location, map, maps, news, pushpins, rest, services, source, tutorial, videos | No Comments »
« Older Entries
  • AXESSIVE.COM – Online shop for axes!


  • Shoping list

    Your list is empty
  • Last Entries

    • My new power hammer!!!
    • Tsar Kaloyan – Rex Blachorum et Bulgarorum
    • Веселина Вл. Георгиева – баронеса Лина Ротшилд
    • Europe Beer map
    • savethepostoffice.com
    • Политика в България
    • Top 100 Green Blogs To Follow In 2013 [Infographic]
    • Australia Added New Colors to the Weather Map
    • Happy New Year!
    • Bomb Sight interactive map – London Blitz
  • Social Networks

    Google+
     
    Linked In
     
    YouTube
     
    Facebook
     
    Twitter

  • Count & Feeds

    Enter your email address:

    Delivered by FeedBurner




    Free Page Rank Tool

  • Interesting and useful

    • AXESSIVE.COM
    • Extreme Java GPS Aplication
    • Funny Photos
    • Geospatial Blog
    • GISLounge
    • Great Google Maps tutorial site
    • Mapping and GIS news
    • Mappoint Forum
    • The Art Of Maps
  • News by Date

    January 2023
    M T W T F S S
    « Jan    
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    3031  

© 2011 mapsys.info . All information under Creative Commons License.Powered by WordPress.Edited and modified By Ivan Tasev