Xively: Unauthorized when getting data - android

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

Related

Development Logs and Testing for OpenLocate

I'm hoping to use the OpenLocate library to help post location data in my application. I've been trying to test that it is working before I start posting events over HTTP calls sent somewhere.
I want to verify two main things
Events are being collected at the frequency I expect
Events are being stored in the database
I've verified that OpenLocate is tracking when I run the app by printing out the OpenLocate.getInstance().isTracking() flag. I've also tried using Stetho to inspect my package to see if I could read the db, but unfortunately nothing shows up.
If anyone has some experience with OpenLocate and can give me some info that would be great.

Access other (not mine) google accounts public calendars in 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.

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.

Android : How to get unique Sequence Number for every response on every request sent

I am creating the app i.e instant messaging android app on version 4.0.3. I have to create a sequence number for every response I get from the server, so that I cant repeat the message which I get from the server/client.
I have done google & visited many sites but dint get proper way or an idea to solve it.
If any idea or help will appreciated.
Many Thanks..

Is there a way to track how many users open your app(hourly,daily,etc)?

So does anyone know if there is a program that will allow me to track how many times my app is opened daily?
I'm not looking to track the users behavior or anything, I just what stats on the average use of my app.
To know this you need to send information to a server somehow. On the device you would need some kind of library or code that posts this information. On the server you need some service that receives it.
There's a number of tools that let you do that. Analytics tools for example: http://code.google.com/mobile/analytics/docs/
If you don't want to use a pre-made tool you could simply use an HttpClient and you could make a simple Servlet on the server that dumps the use count into a database.
Tow more details:
1- Make sure you ask the user for permission the first time he runs your app. This could be problematic for him because of privacy and bandwith.
2- I would batch this and send it to the server once per day (midnight).
I hope this helps.
Emmanuel
If want something easy to implement, you can use http://www.localytics.com/ I've used it for a couple of apps and it works really well.

Categories

Resources