Access other (not mine) google accounts public calendars in android - android

here I am once again asking what might be something obvious for some of you, but that troubled me for a while.
I'm trying to make an app for a friend, he wants this app to be able to access all the events of public calendars owned by a list of google users (so not owned by the user logged in the device).
Once gathered these events, they should be viewed in some kind of list. Only viewed, not modified.
The question is, is it possible to access other accounts public calendars? And If so, how can I do that? I've tried to check the documentation but I couldn't find anything :/
EDIT: these are the only "useful" thing I've found on internet, the Calendar API Documentation, an Android Quickstart with calendar, and a link to what looks like something close to what I want but done manually, through the web interface
I've managed to get the REST request set to the server to get MY events. It looks like this:
https://content.googleapis.com/calendar/v3/users/me/calendarList?key=<API_key>
I see there is written me after users so I've tried to put my friend's email to try and get his public calendar, but the server replied with 404 Not Found.
END EDIT
Thanks!

Ok, so I've found the solution, at least one that works for me. If anyone has a better one feel free to share.
I've made a really basic "how to", here is the link to the PDF.

Related

Xively: Unauthorized when getting data

I'm trying to make an app using the xively api. The thing is, I can't get the information because I get the "Unauthorized" error. I even made the data public, and waited 12hrs now, but still same problem. I can log into my account through my web browser but not through the app.
How can I log in to the service IN my app so I can fetch the information?
I'm programming in Android.
Here is a public test device which is supposed to be "public":
https://api.xively.com/v2/feeds/1635144724
Edit: It seems like I need an api key which i do have however, I don't know where or how to use it. Sorry, but I'm new to API world.
Thanks a lot in Advance!
-Celina
Ok, so after a many hours, I found out that I needed to set a header in my application.
I had to use:
httpGet.setHeader("X-ApiKey","YourApiKey");
-Celina

How to fetch city events?

I wanted to venture into making apps. I wanted to make an app that gathers the events around the user location wise. I want the app to show the events close to user using the GPS of the phone. There is a city page where all the events are listed but I don't have any ideas how I will be able to fetch the data. What are the other ways I can go forward with this? It would be encouraging so that I can research further.
try this
http://www.last.fm/api/show/geo.getEvents
login this and get the api calls and use it in your code
i think you can use a combination of api's to give you the data you are looking for, one such provider i found was http://api.eventful.com/, you can probably even try including foursqaure and meetup's api and even facebook opengraph event api can also provide some handy data.

Sync Google Calendar with my own Calendar app on Android

Hello I'm stuck on this past few days with searching a lot, now I'm confusing what to do.
Trying to do: Created my own calendar and show all events on Calendar. I had all events in XML file for now, everything works fine. Now I'm connecting my calendar app with my OWN google calendar account to fetch (read only) all events from my own Google Calendar account because I dont want to use the XML file anymore. It's not a good idea when I want to update events later on. I dont want users have to enter username/pass to connect with Google Calendar. I would like to HARDCODED it.
Problems: I'm done something like this for iphone by using G-Data Google Api, it works exactly what I want to. However, G-Data Google Api is not compatible with Android. Then I searched and found ppl recommend use Google_api_java_client instead.
This is link where it can connect with a google Calendar account by letting user enter username& password. However, this is not I want. I want to hard coded username and password inside my code, but they are using OAuth then I can't hard coded my username/pass. I also tried ClientLogin from this link, but it doesn't work too. It keeps throw me error "GoogleTransport cannot be resolved". I searched solution for this error, ppl recommend me back to OAuth. This is really make me confusing now.
I hope someone experienced this and have solution, please help me/ guide me how to implement this on android. I just want to read data from my own google calendar account only, PLEASE not from native calendar app.
Last information that I found is by sending an authenticated GET request to the allcalendars feed URL. However, I never done this, if you think it should work, please assist me with that.
I really appreciated any helps. Thank you very much.
You already got the Android calendar creation part right, you now only need to read events from your google calendar to add them to your newly created Android calendar.
It's easy.
Make your calendar public from the Google calendar web app. (anyway embedding your login/pwd in your app is a bad idea, anyone could steal it).
On the "agenda parameter" page, near the Public Calendar URL section, you will be able to copy the public AgendaId (in the form xxxYYYzzz#group.calendar.google.com).
From your app, do an http GET request to this url https://www.google.com/calendar/feeds/AgendaId%40group.calendar.google.com/public/full?alt=json&orderby=starttime&max-results=15&singleevents=true&sortorder=ascending&futureevents=true (replace AgendaId by the real value) and you will be able to read future events in json format.
To tweak the format (json/xml) or the number of returned entries, please read the documentation here: https://developers.google.com/gdata/docs/2.0/reference#Queries
Also, note this is the old API. The new API needs you to register an account to use it and is limited to 10 000 free requests per day.

How to update Contact without removing already stored data?

I'm trying to do a sync adapter to sync my contacts with an webstorage.
When I ask this server for any contactupdates on the server-side I get a list of all the new informations added/changed. To update them I'm using the preferred method described here
My problem is that when I make a ContactOperations.newUpdate() and feed it with all the new/changed informations I got from the webserver and then apply it to the ContactsContract.AUTHORITY all the informations already stored on the phone are erased?!?
I make an example to make thinks clear:
I have an contact saved on my phone named: John 'Dady' Doe. Now the SyncAdapter ist invoked by the system, he ask the server for any contactchanges and the server says, that the familyname of this contact now is "Jones". With that information I construct a new ContactProviderOperation.newUpdate() and feed it via .withValue() and apply it. But what Android really does is: It flushes all othere columns and now my contact is named "Jones" (givenName and middleName missing -.-).
Is there any way to prevent Android from doing so? Can I pass any parameter like the CALLER_IS_SYNCADAPTER? Or do I need to make my own workaround (hopefully not), like reading the data record first, apply the updates and then apply it to the ContactsContract.AUTHORITY?
Any hint is really appreciated!
/edit: I did further studies by looking at the SyncAdapterExample, especially at the "update a contact"-part, but what I saw kinda shocked me: Google actually does read the contact first, then apply the updates from the server and reapply it to the ContactsContract.AUTHORITY. But they only handle first- and lastname, one email and two phones (normal and mobile). In my case I wan't to handle ALL contactinformations, so it's not feasible to do such a workaround, except there is no other way, which I hope not. Hopefully someone can head me in the right direction for this.
Totally my fault :/
Android is doing everything right, I just failed as hard as this guy ...

How to best add a comment/rating system to an android app

I already published an android app where you can see a list of specific objects and detailed informations about them. The list changes every day but some of the objects can appear again.
The application is communicating with a PHP server over HTTP and periodically pulls the list of objects.
I now plan to extend the app to make it possible to rate the objects and add a comment similar to how it is done in the android market. I'd like to avoid forcing the user to sign up for an account for being able to comment.
I see two problems:
The comment-system could be abused by spammers
A comment could be added from another system
So my questions are:
How to protect the system from spam?
How to authenticate the application with the server?
How do I limit the number of comments to one per user and object?
What about the androids device id? Is it unique enough to use it as identifier for the user?
Which other problems do you see?
2020 Commenting/Rating/Reviews Options
Since Socialize is out, here are a few options you can explore:
Build your own comment/rating implementation. Personally I love reddit and how it handles nested comments and ratings. Here's a library I found that implements it beautifully. Please note you'll need to tie this with a cloud-database. This is based on groupie. Article & implementation. Many ways to do this - https://stackoverflow.com/a/59472206/668240
Disqus - SDK's coming soon to iOS and Android.
BazaarVoice - commercial
Social Networks SDKs like Facebook, Twitter, etc. Personally I dislike this as we'll need to authenticate users with respective networks to use the APIs. It's like we are shipping off users of our apps to social networks. If you don't have a problem with that - then it might be for you
Legacy Option in 2014:
You can try out Socialize SDK which is open-source and a really good SDK for the rating and commenting you are looking for. It already has a well-functioning Commenting system built-in along with a 'like/love' facility and sharing to FB and Twitter. Each 'entity' (object in your case) can have metadata associated with it. So all you have to do is construct/use a rating widget, then send that rating with the entity attached to your object. To display your rating/comment is as simple as retrieving them from Socialize.
Each object (element from your app) should be associated with an entity which has a unique key in the form of a URL - sort of like a primary key to recognize your items. This entity can have meta-data - any data that you can insert on behalf of your object. Once you do that, you can retrieve that metadata any time you want.
I've been using Socialize for around a year now. They've matured over this period and are always aspiring to be the best at what they do.
Look at the Socialize Bar at the bottom. Its can be customized to your needs.
What's more - Socialize is free.
As for your questions:
There is comment moderation built into the Socialize Web Component
where you can filter out anything you feel is out of place.
Socialize allows you to authenticate through Facebook and Twitter.
Limiting to one comment per user can be achieved by using their User
and Comments API.
Socialize has both Anonymous authentication as well as Social A/c
authentication. I believe you can remove anonymous auth. So that
ensure that every user is authenticated before rating/commenting.
For authentication, you could use OpenID like StackOverflow does or Facebook authentication. Once you have them authentication, it shoud be easy to limit the number of comments to one per user per object. As far as spam, you could follow StackOverflow's model and allow users to vote comments up or down or flag as spam. Perhaps users with comments that have been voted up would have more power and be able to flag comments as spam.
You'll need some sort of rate limiting. I've used this one in this example before.
So you need a table with the user's ID and how many api calls they have left, and then when their last api call was. Then use the algorithm to update the values in the table every time a method is called.
Read through this, I think it should be possible to create an UUID for every case:
http://android-developers.blogspot.de/2011/03/identifying-app-installations.html
And then keep a hidden api key which is hard coded, or at least get's everytime calculated the same or in enigma style influenced by the time it is used. But you will be never be sure, that it won't be find out by crackers/hackers and maybe abused, you will always have this Problem.
Authenticate with the UUID of the user + api-key.

Categories

Resources