Xamarin and Mono compared to ADT - visual-studio-2010

I'm a developer, with years of experience in C# as well as Java.
I have developed a few ADT projects for my Nexus One Android 2.23 phone.
I am considering further mobile development and I heard of Mono for Android/iOS and Xamarin. At first I thought Mono would recode to Java, but now I understand that it compiles to native C code and runs over mono libs.
So I was wondering how much bloat does this add to apps, as I believe size of download is directly linked to number of downloads (I myself sometimes don't download something due to it being > 1MB)
If there is someone here who uses Mono I would love to hear from your experiences.
I understand there is a Visual Studio 2010 Plugin for Mono. Do you recommend it?

So I was wondering how much bloat does this add to apps, as I believe size of download is directly linked to number of downloads (I myself sometimes don't download something due to it being >1MB .... )
Monodroid apps are usually somewhat around 5 Megabytes (if Linked) because the runtime is embedded in the app.
If there is someone here who uses Mono I would love to hear from your experiences.
All in all i'm pretty happy with Monodroid. Java tutorials on Android are easy to translate or if too big you can create Bindings. I've only done one project on Mono so my experiences are limited but thus far i've expected nothing that would make me regret my choice. On the other hand, if you're familiar with Java (and like coding in Java) their is no reason to switch over except for Cross Plattform apps (see Monocross).
The VisualStudio plugin is necessary to develop in VisualStudio. The new version comes with a Layout Designer like the Android Eclipse plugin. I'd recommend you download the trail version from Xamarin and try it (the trail has no expiration date, it lets you only deploy to an emulator)

Related

Does MvvmCross work in Xamarin Studio?

I'm having a time getting a straight answer on this, I've done a lot of searches and reading, and tried a lot of stuff. It sometimes sounds possible and other times only sounds possible by doing linking and what-not, which is something I'm trying to avoid. I'm a big fan of PCLs.
I've created a solution using Visual Studio 2012, Xamarin, and MvvmCross which works great, I can deploy to an iOS device, a Droid device, Windows --- what have you. Visual Studio can build working applications that I can deploy to specific platforms.
However, I was informed recently that our company requires that when we go to deploy, the code must be built on a Mac using Xamarin Studio by their build server. So since then I've been working on trying to open and build everything using Xamarin Studio, and I'm close, but the infamous ICommand issue is my final hurdle.
Is there, or is there not, a way to get ICommands and the System.Windows library ported in correctly in Xamarin Studio? Am I truly stuck until Xamarin releases their PCL support?
Does MvvmCross work in Xamarin Studio?
Yes
To prove it:
quite a few of the N+1 videos show this being used.
lots of the samples (all of the non-nuget ones) build and run from XS
Is there, or is there not, a way to get ICommands and the System.Windows library ported in correctly in Xamarin Studio?
The problem currently is that on the Stable branch, the xamarin compiler doesn't like the PCL import of MvxCommand which inherits from ICommand
A hard way around this problem is:
rewrite the Xamarin tools to support PCLs - this is what the brilliant, lovely and very clever Xamarin monkeys are currently doing :)
Or... a slightly easier way around this problem is:
replace the nuget references to the PC-built libraries with references to the Xamarin-Mac-built libraries instead - these Xamarin-Mac-built libraries are available in https://github.com/slodge/MvvmCross-Binaries/
Or... a really easy way around the problem is:
instead of using MvxCommand in your view models, just implement your own MyCommand class to implement System.Windows.Input.ICommand (e.g. use the implementation at http://www.lines-davies.net/blog/?p=24)
Am I truly stuck until Xamarin releases their PCL support?
I don't think so - but where you do hit problems:
please do come back to sites like StackOverflow with one specific problem at a time - this site is great for finding solutions one at a time :)
talk to Xamarin support - they are generally very helpful in trying to resolve issues.
What's more, even if you were stuck waiting... then Xamarin have already released their PCL support to the Alpha channel - so the wait is almost over already :)

Desktop publishing platform closely tied to PhoneGap?

I'm looking for a desktop publishing platform for Mac, Windows, and Linux that is closely tied to PhoneGap in terms of the concept. I know that there's Titanium for Desktop (TideSDK?) but as far as I've used it before, it requires the end-users to download a big 70mb-ish runtime file once. What I liked about PhoneGap is that it doesn't require any of that (it works out of the box). I'm looking for something similar, only, instead of being meant for the mobile development, it 's targeted at desktop application development.
Perhaps I failed to mention it but if you are not aware of what I'm specifically talking about, I'm talking about an environment of sort that will let me code via an HTML base and output a native for said platforms. Both TideSDK and PhoneGap does this.
I would highly recommend giving TideSDK another chance, I have developed large, data driven applications on it in the past, and deployed to OSX and Windows and have personally been very satisfied with it. Also, it is now an open source project managed and maintained by a very good team with some oversight and help from Appcelerator (the original creators).
Theyre are two benefits to TideSDk as I see it:
License - TideSDK is open source licensed under a liberal Apache 2.0 license. As opposed to QT which is under the restrictive GNU Lesser Public, and commercial license.
Power - TideSDK allows you to leverage native API's (like phonegap) but access them in your favorite programming language (well, choose between Ruby, PHP, and Python). Your only options with QT are C++.
As for what you said about the 70MB runtime, this is not true, I built the runtime in with my last project, and the binary I gave to my clients (OSX) was only 15.3MB.
Hope this helps you come to a decision.
There is a way to run a PhoneGap HTML5 App on the Desktop with the help of Adobe AIR like described here: http://www.tricedesigns.com/2012/02/17/repurposing-phonegap-apps-as-desktop-apps/
But I am also looking for a less bloaty approach. Maybe based on Xulrunner/Prism/WebRT thing (or Chrome).
Tidesdk is the easiest, xml file is almost identical to the phonegap, provides powerful api and the best part you can package your app with runtime. I think you should stick to tidesdk.
I was looking for the same and found this implementation for windows ony: https://github.com/davejohnson/phonegap-windows
I did not tried it though.

Tutorials for Writing Common Code for use on Windows, OS X, iOS, and potentially Android

I'm looking at writing an application that I would like to use on Windows, OSX, and iOS (maybe pushing into Android if other people want to use it). I want to duplicate as little work as possible and I'm having a hard time finding information on the best way to do this.
From what I've found so far I can't use a framework like QT because iOS doesn't support QT so it looks like I'm stuck recreating the interface for each target. I'm looking at writing the business logic in C++ because it seems to be supported by the native tools (Visual Studio and xCode).
Has anyone had experience with a setup like this and if so can you point me towards a good reference for this kind of development?
Really there it not a lot of choice right now. Qt is certainly coming to iOS and WP7 so C++ is a good solid evolving platform.
However there is also the mono project which offers C# across platforms.
http://xamarin.com/monoforandroid
From my understanding, you write in c# and it compiles to the platforms preferred language.

MS Windows Programming advice for Mac/Unix developer

I have a few years of experience writing Unix command line tools (no GUI experience) in python, C and C++, and only recently crossed into the GUI world (Cocoa and IOS only). I've learned quite a bit of objective-C and am getting to understand how cocoa MVC works. However, one of the apps I am developing needs a Windows version and I was wondering what a good place to start would be given that I have absolutely no Windows development experience.
I was thinking about using Visual C++ 2010 Express as my development platform (because it's free and because I don't need to learn C++). My application is relatively simple, it will have only two windows and spend most of the time running in the background. It will however need to communicate with the OS (load dll's etc) and an online server (HTTP methods) and I'm not sure whether Visual C++ Express edition gives me access to the required API's. Would a Windows Forms application suffice? Am I going about this the wrong way? Do I need to learn C#? Any advice will be appreciated.
If you are already happy with proper c++, visual Studio C++ express should suit you fine. Given that you are not making a complicated GUI, you don't even need to dip into the managed code - C++ express allows you to create proper c++ console and GUI apps. You also don't need to install the platform SDK - it is part of VS C++ express.
Not being managed C++, you will be able to share source files between your various projects. managed c++, despite the c++ in the name, really is a different enough language that it will be annoying to work with if you simultaneously have to deal with iso C++.
--
Note: The native windows API is a C api, not a C++ framework. So it does not provide a rich set of classes in a coherent framework to deal with. On the other hand, while, large, it is actually quite simple to work with.
Also: Given that you are already familiar with Mac development, there is a LGPL (iirc) package called CFLite that builds on windows and that implements the C api that underlays the Objective-C Cocoa API.
If you use its abstratcions you can share a greater part of code between windows and Mac (and other platforms).
Other C++ IDE's you might want to consider:
Code::Blocks
QT Creator
both of which can be configured to use the MINGW port of GCC to windows.
you'll be better off with c++ than c# if you need more "low-level" stuff. Loading dlls (that is, libs) is simple (pragma comment lib...), as is pure HTTP transfer and communication.
So, VC++ with windows form will suffice, and it is "very c++".
You have access to all global APIs, and loading specific apis like http requires only two lines: one to include wininet header, and other lib (libs are actually "references" to dlls).
If you go the C++ Express way then you need to install Windows SDK separately, and set it up for Visual Studio to use it. And you can't use MFC.
I would however, suggest C#, because it feels like putting little toy bricks together. Easier to debug and maintain. Problem with C# is that it has so many library functions that you can not possibly know if what you want is already made to a function. But that's why we are here :-) If you feel that something you want to do should already exist then ask a question about it. One notable feature that C# lacks is zip archives (it has something similar, but not quite). For zips you can use public libraries, like SharpZipLib or DotNetZip.
If I were you, I wouldn't jump into a whole new API so quickly. Have you considered using Python on Windows? Most of the Python packages I've seen are also available for Windows, so you'll feel at home. And if you need some GUI, you can opt for wxPython, pyGTK or something similar.
For Windows specific things, you can always use ctypes. Especially if they're as simple as loading a DLL.
have you considered approaching Adobe AIR? it allows you to deploy on Mac, Linux, Windows, iOS, etc. communicating with and launching native processes has been possible since 2.0 and the the latest 2.5 SDK can target Android OS and TVs. with your experience you should be able to pick up ActionScript3 / MXML in no time.
additionally, there are a handful of free IDEs you can use with the Flex and AIR SDKs. or, if you're a student or low-income developer, you can get a free copy of Flash Builder 4 from Adobe: http://www.adobe.com/devnet-archive/flex/free/
edit: i believe deploying AIR applications on iPhone requires Flash Professional CS5, which includes the packager for iPhone options. at the same time, i've read that AIR and other cross-compilers for iOS are painfully slow, so it's perhaps best to develop natively in Objective-C for iOS.

C# mono from windows to mac

I wanted to know what i shouldn't do in code that will prevent my C# app from running on mac.
In general you shouldn't use anything from the Microsoft.* namespaces, no PInvoke (DllImport in C#) and UI might be problematic as well.
Further information on Mono compatibility is contained in the Mono Guide Porting Winforms Applications. Existing applications can be checked for compatibility using the Migration Analyzer tool.
UPDATE: PInvoke actually works in Mono, but if you want to have it working cross-platform you must provide a native shared library with the same interface for each platform (i.e. Win API most likely will not work).
Mono's Application Portability guide is a good reference.
In addition to divo's recommendations, I would recommend the Mono Migration Analyzer (MoMA) tool: "The Mono Migration Analyzer (MoMA) tool helps you identify issues you may have when porting your .Net application to Mono"
Also, I would keep an eye on Miguel de Icaza's blog, and the Mono Project website.
In his presentation for the Boston.NET Users Group this month, he showed a preview of a Visual Studio plugin that launches your app on Mono using a VM! This lets you test compatibility during the development process.
I believe their goal was to release it at TechEd 2009, so look for an update over the next month or so.
You will, at the very least, want to try and avoid using Windows Forms, since that is just a paper-thin layer on top of the Windows native UI.
Mono emulates it somewhat with help from WINE, but I wouldn't trust that.
Mono did this a while ago but the effort was abandoned. See WinForms on Mono for more information. Thanks jpobst.
Try using GTK# or Qt# (although I'm not too sure the latter one actually exists) for cross platform support. You might also consider using Java with SWT or even Swing instead of C#, but that will probably not be an option you're willing to consider.
Using anything related to P/Invoke is probably also a bad idea, since that invokes native code which will probably not be portable (unless you write it yourself, then you can choose to make it portable).
I'm not sure if it is possible with mono, but WIN32 API calls will definitly not work ;)

Resources