ios Add Event to google calendar - iphone

I have searching how to add event t users google calendar. In my project I have database with events(title,startDate,endDate etc). When user clicks sync button all this events should be add to users google calendar.
I downloaded api from here. But its for MAC OS. Since I never worked on MAC OS application I cant understand how to use it in IOS app.
Please help me and tell which view controller to use asking for username and password, then login to google calendar service and add event in it.
Thank you.
I got http://code.google.com/p/google-api-objectivec-client/. But its difficult to understand. It takes username and password from preferences. Then gets calendars and adds events, but to add we need ticket and some more things. This code did some things.
In their add event method I wrote my own event object and tried to add that, but its not working. Here is the code:
- (void)insertCalendarEvent:(GDataEntryCalendarEvent *)event toCalendar:(GDataEntryCalendar *)calendar
{
NSLog(#"adding event");
GDataDateTime *time = [GDataDateTime dateTimeWithDate:[NSDate date] timeZone:(NSTimeZone*)[NSTimeZone timeZoneForSecondsFromGMT:0]];
GDataEntryCalendarEvent *newEntry = [GDataEntryCalendarEvent calendarEvent];
[newEntry setTitleWithString:#"title"];
[newEntry addLocation:[GDataWhere whereWithString:#"pune"]];
[newEntry addTime:[GDataWhen whenWithStartTime:time endTime:time]];
[googleCalendarService fetchEntryByInsertingEntry:newEntry
forFeedURL:[[calendar alternateLink] URL]
delegate:self
didFinishSelector:#selector( insertTicket:finishedWithEntry:error: )];
}
My requirement is simple. I just want add my custom events to google calendar. Get calendar, get ticket, and in for loop add all my events.

Instead of using Google API and a new window where the user needs to be login again, you should use the EventKit, it's pretty easy stuff and you could sync to the Calendar where the user wants, not only Google cal.

I have the same requirement like yours to integrate google calendar and syncing events. I researched and found documentation from here but I didn't understand it clearly, so later I found another good tutorial for accessing google calendar API's. You can try this for your requirement.

As #Tuss Laszlo mentioned, the Google API Client library is your best option to add events only to a Google Calendar. Google has a calendar sample in their example code. See the example for the full implementation of adding calendar events.

Related

how to get user's posts & updates from Google plus like facebook

I want to get all wall updates of user's google plus account like facebook.
I have seen official link for it which is
Google Plus Documentation for iOS
& I have downloaded sample from there which is here Google Plus SDK Sample
it works well for getting user's information like email id,profile name,user's friend list with images & for posting on google plus.
but I am not getting user's post & updates.
all I want is user's wall updates & user's friends updates from google plus like facebook does.
but from above link i have found nothing for getting wall updates.
I have searched google for this also & get nothing regarding above problem.
any help for above problem appreciated.
Thanks in advance
From a backend server you can easily perform this API call to read a user's public activities. You can see the REST API here:
https://developers.google.com/apis-explorer/#p/plus/v1/plus.activities.list
Combine this with a people.list and you can query for a user's friend activities on Google+.
On iOS, you probably don't want to make these API calls directly from a user's device. If you can, you should offload the work to a backend server to avoid overworking the mobile client. That said, you can perform an API query similar to listing people in circles:
GTLQueryPlus *query =
[GTLQueryPlus queryForActivitiesListWithUserId:#"me" collection:#"public"];
[[[GPPSignIn sharedInstance] plusService] executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLPlusActivityFeed *actFeed,
NSError *error) {
}
If you put a breakpoint in the application on the function, the activities feed will be something like as follows:
(lldb) po actFeed
{
nextPageToken:"CAIQ44qZ58DgtwIgFCgB"
etag:""DOKFJGXi7L9ogpHc3dzouWOBEEg/UMVQXfw8ynZaTz31tpuZo473TsQ""
title:"Google+ List of Activities for Collection PUBLIC"
updated:"2013-07-16T04:04:34.697Z"
kind:"plus#activityFeed" items:[20]
}
The items array contains the actual activities that a user has publicly written on Google+.

Google Analytics Event and Social Reporting on iOS

I'm using the latest version of Google analytics for iOS (up to this post date).
The pageViews are logged and reported correctly but the events and social events aren't. Here are some snippets of my code:
#interface RootViewController : GAITrackedViewController
All my ViewControllers inherit the GAITrackedViewController
[self.tracker sendEventWithCategory:#"Twitter" withAction:#"Tweet" withLabel:#"Tweet App Info" withValue:nil];
[self.tracker sendSocial:#"Twitter" withAction:#"Tweet App Info" withTarget:nil];
I call this from my view controller to log an event of sending a tweet, but when I check my Google analytics (Engagement->Events->OverView) no events are logged. This is not real time data, I'm talking about 3 days of testing without events reported.
I'm following this guide by Google Mobile App Analytics, but when using
[tracker sendEvent]
I get errors so I use
[self.tracker sendEvent]
and I think it uses the default tracker of the app.
Any help with this problem ?
for me, the [self.tracker ...] or [tracker ...] calls did not work. I ended up using the shared instance default tracker as follows:
[[GAI sharedInstance].defaultTracker sendEventWithCategory:#"TAC_Agree" withAction:#"buttonClick" withLabel:#"" withValue:[NSNumber numberWithInt:0]];
This definitely works for me.

Google+ integration in iPhone [duplicate]

I have been searching for tutorials on google for posting some text on google plus. But it seems like there are none.
I have also tried to go through the docs provided by google for developers of mac and iPhone but can't find anything that will solve my problem. Also there are little information on how to get the user login to there google plus account.
I am not sure what to do for the user login, do I have to use some GTLObject or use UIWebView like foursquare for user login.
Here is a list of docs that I had went through.
http://code.google.com/p/google-api-objectivec-client/wiki/Introduction
http://code.google.com/p/google-api-objectivec-client/wiki/BuildingTheLibrary
http://code.google.com/p/gtm-oauth2/
As it turns out there are only a limited number of api's available for google + developers and that also only as GET calls according to the developer of google + page my question will not get any definite answers as google is in the process of creating new api's for accessing user information on google plus.
https://developers.google.com/+/api/
Also you can use the google client sdk provided by google but it is much easier to show a webview for user login. I managed to get the people list from google plus.
The steps are same as for getting the access token as in foursquare. Just with some small changes.
in viewdidload method.
NSString *authStr = #"https://accounts.google.com/o/oauth2/auth?client_id=client_id&redirect_uri=http://somevalidurl.com&scope=https://www.googleapis.com/auth/plus.me&response_type=token";
as a url for loading request in webview. People should note one thing here that you need to create a client id in api console for your app that is web based and not as installed for this purpose as you wont we getting any option to enter any website url for callback which is very important in this case.
and in webview delegate method webViewDidFinishLoad:
NSString *urlStr = [[webView.request URL] absoluteString];
NSArray *array = [urlStr componentsSeparatedByString:#"access_token="];
if(array.count > 1)
{
NSString *oauth_token = [[[array objectAtIndex:1] componentsSeparatedByString:#"&"] objectAtIndex:0];
//do something with the oauth token after this.
}
I wrote a code snippet to signin and post simple text to Google Plus with URL and thumb Image URL.
Try it
Take a look here:
http://code.google.com/p/google-api-objectivec-client/source/browse/#svn%2Ftrunk%2FExamples%2FBooksSample
http://code.google.com/p/google-api-objectivec-client/

Disabling automatic message box on ShareKit on IOS

we trying to disable the automatic message box when we authenticate twitter on an Ios App. We click connect, once it's authenticated, it opens up a message box. We just want to connect, thats it without the box. Anyone came across this?
It is simple, just do not share, only authorize:
SHKTwitter *twSharer = [[SHKTwitter alloc] init];
[twSharer authorize];
[twSharer release];
If you wish to get authorised user info (in the form of dictionary in NSUserDefaults), such as username run
[SHKTwitter getUserInfo];
for more info see ShareKit 2.0 FAQ
Mentioned behaviour is corresponding with pre iOS 5 implementation. If you use iOS 5 everything is handled by native iOS Twitter framework

How to use the Facebook API, and how can I post a link with status on the users wall via my app?

I'm trying to post a link + status through my app, using this "popup" facebook window where the user is asked to log in, then asked to allow my app to his profile. Then I want him to be able to write a status, with a link I specify attached. This facebook popup would be triggered by a button, not at start of my app (in the documentation I found that they want me to implement it in the appDidFinish launching method...) But I don't want that, I want it like the popup facebook window is only triggered per button tap.
I'm trying to figure this out for a few days now, but finding that all tutorials are out-dated and the Facebook Developer documentation is very weak- atleast for for me. I already downloaded the Facebook-iOS-SDK with the API and JSON included from GitHub. I already did a few attempts, but the furthest I got is that the user was asked to log in, but not through my app, instead Safari opened and the log in field were there, not in my app.
Could someone please post some code, a basic tutorial I might find helpful, or point me to a good online tutorial? I already tried to post to iPhone Dev SDK forums, where other people also asked for this, but never got any help. So could someone out here please put together something that would help out all the newbies?
I want my login screen look like this, and the rest should be in a popup too:
http://www.facebook.com/photo.php?pid=439332&l=c04b210914&id=100001688115647
Thanks a lot in advance!
There is already a sample code in facebook-ios sdk you can see that there are already the code available for some things. Here is a code snippet from the older facebook API but this should work with the newer graph api too
- (void)setStatus:(id)target {
NSString *statusString = #"Testing iPhone Connect SDK";
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
statusString, #"status",
#"true", #"status_includes_verb",
nil];
[[FBRequest requestWithDelegate:self] call:#"facebook.users.setStatus" params:params];
}
WHat you can do is create a controller to handle all the facebook requests like a singleton class and on tap of button do something like this
- (IBAction)showFBLoginDialog:(id)sender {
if(LoggedInFacebook == NO) {
FBLoginDialog *dlg = [[[FBLoginDialog alloc] initWithSession:faceBookController._session] autorelease];
[dlg show];
}
else {
[faceBookController logoutUser];
}
}
If you need further help search on google and stackoverflow you will find a bunch of.