开发者

How to develop an application for Android which uses Google Calendar API

I just started doing some Android app development, and I decided I'm going to write an app to work with Google Calendar.

The first problem that came to me is that I can't add any Gmail account on the emulator. When I go to settings -> accounts, I can only add an Exchange account.

This raises a question how should I develop such appli开发者_如何学Ccation. I know that I should mock the API while I'm running tests, but how am I supposed to run the app on the emulator?

Should I just test it on mocked API with JUnit and then run it on production phone?


As for the emulator set up for a Google account, well, it depends on the Android version you have in your AVD: for example for 2.2, go to Settings/Accounts & Sync, click on Add account and Google, etc.

As for the Google Calendar access, the best way is to use the Google Calendar API.

Please note: there is not yet an official Android SDK API for the Calendar access.


There is a good example of accessing Google Calendar Data API from Android using the Google API Client Library for Java at calendar-v2-atom-android-sample. There are detailed instructions there for setting up the proper package:

  • Window > Android SDK and AVD Manager
    • Follow instructions to install Package "Google API's by Google Inc., Android API 8"
    • Follow instructions to create a new Android Virtual Device based on target "Google API's (Google Inc.) - API Level 8"
    • Click "Start..." (wait a while...)
    • On home screen in emulator, click Menu button, Settings
    • Click on "Accounts and Sync"
    • Click on "Add Account"
    • Click "Google" and follow instructions

Disclaimer: I am an owner of the Google API Client Library for Java project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜