Android Question Google Calendar API

Discussion in 'Android Questions' started by LucaMs, Jul 22, 2015.

  1. LucaMs

    LucaMs Expert Licensed User

    I used the library Calendar2; it allows me to create an event, but this event takes several minutes before appearing in my calendars (I use a webview in my app and it shows the new event only after a few minutes).

    I've read that the library Calendar2 uses an "unofficial method" for managing Google calendars.

    How can I use (if it is possible) the inline Java code, taking the code from these two links below, to create an event?

    Insert

    JavaQuickStart


    Thank you
     
  2. DonManfred

    DonManfred Expert Licensed User

    Start a google calendar sync after you added the new event.
    The Event is synced with google when using the sync-function... Maybe it needs a few minutes to be active.

    You even can use the http-api from google (from your pc or from php). Here the event will show up much faster in your google-calendar...

    From Android you cannot use the http api tough; here you need to use a instance of googleclient (java) with the scope set right to get the best results. But i cannot provide an example, sorry. It is one of the things i want to do - maybe - in future
     
    lemonisdead likes this.
  3. LucaMs

    LucaMs Expert Licensed User

    I do not understand. I read your answer quickly because I came back here to write that the question had to be eliminated, because I have the same problems of delays on reading events, so it would require an entire library.

    (But I will read calmly your answer :))


    Thanks
     
  4. DonManfred

    DonManfred Expert Licensed User

    The problem is the same... The Sync with google-calender on the device will need a few minutes to transport (in this case show) new events
     
  5. LucaMs

    LucaMs Expert Licensed User

    Thanks to your previous answer, searching "google calendar sync", now I understand that the Calendar Library builds Calendar Intents.

    Now I have to understand the paragraph: "Sync Adapters" in the same page, maybe it can be usefull.

    Thanks
     
  6. LucaMs

    LucaMs Expert Licensed User

    Well, I'm lost.

    I state that the app as it is, based on the Calendar Library, with those delays of minutes, is unusable.


    The question is complex (also my english is poor, as you know...!).


    I have to back down: the library Calendar2 does not use Intents.

    I think, I guess I understand, that there are 3 ways to use Google Calendar:

    1) by commands, which operate on the Calendar Provider (this seems to be the method used by the library);

    2) via Intents; but if you prepare an Intent and you start it, the application that is capable of handling this Intent installed on your device will start (ie a calendar) then I can not use this method.

    3) via Sync Adapters; this method, however, requires account name and account type which I would (should?) avoid (also, it is not so simple).


    All this should make me give up, but I have one more question:

    If I create an event via browser on my PC it is immediately updated / synchronized with the calendar on my tablet:
    so, which method it uses?


    Thanks for your answers.



    [P.S. BTW, trying to understand something more, I downloaded a sample (BasicSyncAdapter) from developer.android.com then I opened it in Android Studio; for start-up of Android Studio and for loading the project, I had to wait only a few... years :D ]
     
    Last edited: Jul 23, 2015
  7. DonManfred

    DonManfred Expert Licensed User

    4) Via HTTP-API

    5) The way google suggest to use:
    https://developers.google.com/google-apps/calendar/quickstart/android
    This is the most complex version as it is based on
    com.android.support:appcompat-v7:22.1.1, 'com.google.android.gms:play-services:7.3.0, 'com.google.api-client:google-api-client:1.20.0', 'com.google.api-client:google-api-client-android:1.20.0', 'com.google.api-client:google-api-client-gson:1.20.0' and 'com.google.apis:google-api-services-calendar:v3-rev125-1.20.0
     
    Last edited: Jul 23, 2015
  8. LucaMs

    LucaMs Expert Licensed User


    Thank you, ma even that method requires too many stuff :

    ...
    1. Select an EMAIL ADDRESS, enter a PRODUCT NAME if not already set, and click the Save button.
    2. In the sidebar on the left, select APIs & auth and then Credentials. In the new tab that opens, click Create new Client ID.
    ...

    Mainly, an app registered.
     
  9. DonManfred

    DonManfred Expert Licensed User

    Creating the Client-ID and getting the credentials is probably the smallest problem :D
     
  10. LucaMs

    LucaMs Expert Licensed User

    I can not imagine how this thing works on browsers (PC).
     
  11. DonManfred

    DonManfred Expert Licensed User

  12. LucaMs

    LucaMs Expert Licensed User

  13. DonManfred

    DonManfred Expert Licensed User

    On PC you can even use .net, python, java
     
  14. LucaMs

    LucaMs Expert Licensed User

    I fear that without registrations, permissions etc, the only way is the library.

    But, I repeat, each command takes minutes.
    It is strange that no one has mentioned in its thread to these delays, however.
     
  15. LucaMs

    LucaMs Expert Licensed User

    I need to create an app; I just was thinking if I can use the same method used "by the browser", but I don't think.
     
  16. DonManfred

    DonManfred Expert Licensed User

    you can for sure use the JS api ;)
     
Loading...