Sync Google Calendar with my own Calendar app on Android - 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.

Related

Can I access to this Screen if I use Google's Calendar API?

I'm trying to save events from my app in the Google's calendar. Now, I'm using an intent to launch this preview screen (with the fields already filled in) in case the user wants to modify any field. I want to use the Google's calendar API, I have read the documentation and I have not found the way that this screen appears. Can someone give me a hand? Thank you.
The Google Calendar API is a rest api. It returns data in raw json format. It is up to the developer to format the data and display it as they would like.
I have read the documentation and I have not found the way that this screen appears.
The Google Calendar does not have access to any screens it only has access to data. You will have to create your own screens and extract the data from the Api.
Most of the data in that screen can be found in the event methods found in this section of the documentation events overview

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.

Send Email from android Using Firebase

Can we send emails within android using firebase , i have tried several libraries like GmailBackground,BackgroundMail, custom method of Javax to send mail , but unable to send any email ,not even a simple one.
So I wonder if Firebase give such a feature , it would be great ?
Firebase Email Sending Blog post is showing empty is i think deleted , but why?
if you have any working source or tutorial to sent an email with attachment , it would be great , thanks
I've been researching this all day...
Option with third-party: SendGrid.com
There's actually a blog post by Tyson Bailey where he explains how he managed to get that done using SendGrid.com (monthly fee) here:
http://blog.onaclovtech.com/2014/07/emailster.html
It even includes the link to a Git he created upon it.
The solution in fact uses AngularJS as #Rexford mentioned in his comment.
Other options... None that I know for the moment, and am exactly researching upon a solution through GCP.
I can tell you they have been working since 2014 on something called "Triggers" that would allow triggering API actions from the database changes (which would helps lot), but seems to have been merged into Google Cloud Functions lately which is in Alpha by the time.
The good news is that as of a few days ago Firebase does now support sending emails... Obviously not from Android - that would be horrible - but from Firebase Fucntions - see here for an example.
Don't think Firebase support that yet..
You can use maligun service with this library for now. I have tested, it works.
https://github.com/sargue/mailgun
https://documentation.mailgun.com/en/latest/quickstart-sending.html#how-to-start-sending-email

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

Android application should expire after 1 month of its release [duplicate]

This question already has answers here:
Creating an Android trial application that expires after a fixed time period
(13 answers)
Closed 9 years ago.
My android application should work only for 1 month after its release. What to do for that?
Please see this question, it has a good answer.
I will give you my experience with trials. At first I tried just using the date on the phone, but then realized if they uninstall and re-install this can be bypassed. This could be fixed by storing the install date somewhere on the file system (hidden), but what happens if the user wipes data or finds the file?
I also tried to just check the date/time at a server anywhere (maybe your www site?), but this imposes restrictions on your application because they must have internet. Soon I realized the need for better license management, so the last solution was used.
The last solution would be to setup a server. You can use the device's unique ID (whichever you choose - I went with the Bluetooth MAC ID because my application requires bluetooth as well), post to a server to check if the user has a trial, if they don't I issue them one, if they do I check the expiration. Now I have complete control over when trials expire. Since my application is a business app that is used in the field, this is very handy if a potential buyer needs another week.
The only issue with the last solution is that if you plan on publishing to Market, you must use their payment system.
Good luck!
Just to add a bit more code-related as well:
Use SharedPreferences to store the date on first-start up
Get the date at every start up - you can use for exampe Date.currentTimeMillis() - and calculate if 1 month has passed
Check current date and calculate expiration date.
That should be pretty easy, just read the date on the first start-up and store it, then compare the date for every subsequent start-up with the stored date, if its greater that x days, pop-up a message box saying the app has expired.
Or am I missing something ?
/Tony
Use alarm Reciever instead, and broadcast when it gets expired.
http://developer.android.com/reference/android/app/AlarmManager.html,
here is a tutorial TOO.. http://moazzam-khan.com/blog/?p=157
if you are worried about the data on the device(and you should! unless you encrypt it) you can save the data on a server and retrieve it on each start up.
On the other hand if application crackers worries you, dalvik byte code today is easily reversed using dedexter or smali and with apktools and jarsigner you can actually find the place where the protection is change some jumps, fill the rest of the code with nops to keep it aligned and resign it uploading it to some crackers market where they share it. So it wont help you too much.
You can make life hard for them if you obfuscate your code with proguard, but it will slow them down,wont stop them.
If your app is web based, meaning the user will need to obtain server data from you, create a key for the registered users that will be received from the server (you can base it on their private details + IMEI) and verify your requests with it, if you get wrong\no key from the client reject the request.
It's not 100% proof either since requests could be faked and someone could grab someone else's IMEI and key and face all the requests.
welcome to broken software copy protection world :-)

Categories

Resources