Forum Xamarin.iOS

How can I use Google's API in Xamarin for an iOS app using C# (not Obj-C)

Hi, I want to be able to use Google's API to communicate with a Google Spreadsheet within an iOS application that I'm building in Xamarin. I am familiar with C# but not Obj-C, hence why I'm using Xamarin (C#) and not Xcode (Obj-C).

I have found the .NET installation instructions at the link below but it is a .msi file for Windows only and I'm using a Mac so I don't know how to install it and use it within Xamarin (or even if that's possible!).

https://developers.google.com/google-apps/spreadsheets/#setting_up_your_client_library

I have found the Obj-C library available here: http://code.google.com/p/gdata-objectivec-client/

But if it can be avoided I'd much prefer to do it all in C# / Xamarin. If it can't be done then that's fine I just need to know if it can be as I'd much prefer to do it that way.

If I absolutely have to to do it by using the Obj-C Google library then is that doable when mainly creating the app from Xamarin? Are there any major considerations or issues that I might find?

Any thoughts or help is much appreciated, thanks.

[Post on StackOverflow: http://stackoverflow.com/questions/19605788/how-can-i-use-googles-api-in-xamarin-for-an-ios-app-using-c-sharp-not-obj-c]

Posts

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Looking at the link you provided, it says that a static library is available. Therefore it should be possible to create a Xamarin binding for this, with which you can then use the API from C#. I wouldn't be surprised if someone hasn't already created a binding for this.

    A long shot is that the .NET client library doesn't make use of libraries outside the Mono stack, and so you can use the .NET client library from Xamarin.iOS. Obviously you'll need to download and install on a PC to get the libraries out of the MSI, and then transfer across to your Mac.

  • JasonHodgesJasonHodges GBMember

    Thanks for your response James.

    I wasn't able to find a Xamarin binding online for this.

    I thought I'd found it with this;

    https://github.com/xamarin/google-apis

    However it seems to be only for Android as the iOS samples don't seem to work (unless I'm missing something which is highly likely!)

    Do you or anyone else know if there is a binding already made to be able to access Google spreadsheets through their API within Xamarin for iOS. (Long winded but just stating for clarity!)

    If there isn't one, it seems from the docs at the link below that it would take quite a long time to set up. Is that right or is it quite quick and easy for an absolute newbie? :)

    http://docs.xamarin.com/guides/ios/advanced_topics/binding_objective-c/binding_objc_libs/

    Thanks for the help again.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    Right - just out of interest I've scanned the .NET assemblies and they're not cross-platform ready.

    Regarding producing a binding, the complexity depends on the number of methods and types which need to be bound. If we have access to the static library for iOS, then we can assess what needs to be done. I'll take a look.

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭✭

    @jason I've built the static library for GData. However, looking at the header for the spreadsheets client, it looks like a lot of work to create a binding, as it's a pretty massive library.

    It would be interesting to see if anyone has made more progress with this.

    I wonder whether it would be possible to just communicate using HTTP and JSON, without the need for a native library. However, I'm probably missing something here!

  • JasonHodgesJasonHodges GBMember

    James thanks so much for helping me with this. I've looked at it as well and it does seem pretty daunting to me especially as I haven't done any binding before!

    My main problem that I'm trying to solve is that I have a spreadsheet (which is currently as an excel document) that I need the app to communicate with. The app sends a number to the spreadsheet which then returns a new number to the app after doing a load of calculations.

    Considering the amount of work that seems to be involved in setting it up with a google spreadsheet and all of the apparent headaches that are involved there I'm not 100% sure that it's my best way of doing this. Time is of a great priority for me so that is my main concern. My second concern is speed of the communication between the app and the spreadsheet whether it's online or within the app itself.

    I've found a tool that seems to allow me to have a spreadsheet within the app itself but it seems as though the app will need to be rebuilt every time I want to update the spreadsheet unlike the convenient Google spreadsheet. It's called FlexCel and I'm not too sure whether it will work how I want it to by just letting me communicate with my already made spreadsheet within the app and quickly. I'm going to head in this direction for now unless you have any other ideas as to how I could best achieve what I’m trying to do?

    It’s expensive for me as an indie developer but it seems like it will save me time and money in the long run to buy this. http://www.tmssoftware.com/site/flexcelnet.asp

    Thanks so much for your help so far James I really appreciate it.

  • JeffWard.8680JeffWard.8680 USUniversity ✭✭

    It looks like google may now be supporting PCL libraries in it's new (Beta) API bindings:
    https://developers.google.com/api-client-library/dotnet/apis/

Sign In or Register to comment.