MonoTouch - cross-platform API abstraction layer? - xamarin.ios

I understand that with MonoTouch and MonoDroid that you develop against the native UI layer, which is a good thing. However, I was wondering if there were any cross platform Mono API layers for features such as camera, location, storage, notifications etc... ?
PhoneGap supplies a JavaScript a abstraction layer that does just this. Is there a Mono equivalent?

There is an official monomobile api project from xamarin - that provides camera, contacts and gps abstractions, plus there are discussions (but not firm roadmaps) about extending this further. See http://blog.xamarin.com/2011/11/22/introducing-the-xamarin-mobile-api/ for an intro
Beyond that:
some api's exist cross platform from the start - eg isolated storage can be used on all platforms.
I've seen a few other GitHub projects started - eg chrisntr's mono extensions
I've written a few abstractions (e.g. File, gps, camera) in http://GitHub.com/slodge/mvvmcross

I recently came across MonoDroid.Dialog. I have yet to use it, but if it is as easy as MonoTouch.Dialog to do tables then I will be very happy with it.

Related

How to develop Spotify Desktop Applications, now Libspotify is discontinued

have done my due diligence, and not found any other posts that answer this question, but as usual, if you know a similar question, point me that way!
I noticed a long time back that Libspotify has been dicontinued:
(https://developer.spotify.com/technologies/libspotify/)
So, my question is - what should we do for developing Desktop applications?
They do state: "We hope to be able to provide you with a new library for other platforms." But, this has been going on since 2015!
I have seen many projects in GitHub still using Libspotify - so what should we do? An update was promised "in the upcoming months" but I've not seen anything yet.
What should we do for developing Desktop Applications?
We at Spotify don't currently provide playback as part of our platform offering outside of our iOS and Android SDKs, and I don't have any updates on that at the moment. As mentioned on the website, we hope to be able to provide playback SDKs for more platforms in the future. We don't support any new development on libspotify.
You can use the Spotify Web API to interact with Spotify in a variety of ways, including getting information about metadata, and accessing/modifying user libraries and playlists, which may be useful. You can also use the Applescript API to control playback on macOS, which may also help.
The Spotify Web API is pretty straight forward to use. Of course it defines the protocol rather than implements it so it is OS independent.
I put together a few classes to help unwrap some of the JSON parameters simply. These were written in Swift for macOS.

Chrome Apps UX guidelines

In the Google Cast SDK Overview video published on YouTube by Google, the presenter says
There are design implications that are driven from the Design Checklist so in addition to the platform specific guidelines for Android, iOS and Chrome, it is important to do a thorough review of the Google Cast Design Checklist.
The sentence reads like legal-speak, but more importantly, it mentions existence of platform specific design guidelines for Chrome. I never knew that there is anything like that. I attempted googling around, I could find guidelines for Android, iOS, but nothing for Chrome. Does anybody know where the Chrome guidelines can be found?
The design checklist is here: https://developers.google.com/cast/docs/design_checklist
The starting point for Chromecast developer doc is here: https://developers.google.com/cast/
There is an unified design guide for both Android and Web Apps that was announced on June 25 2014 at the Google I/O keynote. It is available at the https://www.google.com/design/ site. Regarding Google endorsed UI frameworks, there are two. Polymer Paper and Google Web Starter Kit. Additionally, there are stylesheets on GitHub from various people that aim to replicate the look and feel of the Chrome Settings page as well as various widely-used opinionated Responsive CSS Frameworks that can provide design clues, most notably Twitter Bootstrap and Foundation.
Polymer Paper
Polymer Paper is a set of Polymer Web Components which implements the unified mobile and web UI concept called Material Design. Some of the distinctive characteristics is the use of drop shadows and animated transitions to hide latency and give feeling of responsiveness. The components are built with the Polymer framework on top of web components, so it works best in cutting edge browsers.
Google Web Starter Kit
Together with the Google Web Fundamentals developer guide the Starter Kit provides a starting point regarding look and feel for your web app (a style guide with UI elements, e.g. sandwich sidebar), as well as preconfigured selection of helper tools to better manage your CSS styles, minify resources, keep performance considerations in mind and so on. The Starter Kit employs production ready tools and procedures that can be used today.
There is nothing like that, the presenter probably just misspoke. The Thinking in Web Apps page on Google Developers could give you some hints, but it feels outdated in many aspects.ยจ
Just some more general advice on that:
People tend to gravitate towards Twitter Bootstrap these days, so base your design on that and you will play well with others.
Watch the trends and adopt what the big players are using. For example, the sliding drawer on the side seems to be big now.
Regarding the ongoing effort by Google to allow easy porting of Chrome Apps to mobile phones, looking at the Android and iOS guides may help. Most importantly try to optimize your app for touch, avoiding hover, right clicking and minimize the need to type.

How well would MvvmCross and CSLA.net work together in a multi-platform strategy (ASP.NET MVC, WP, WPF, WinRT, Win8, Android, iOS)

Long time lurker, first time questioner here :)
I have been looking into our company's next software system architecture. We have been using CSLA.net, to some extent, as our business object framework and are thinking of building our new architecture around it. CSLA.net has support for the platforms mentioned in the title and we are looking for mvvm framework that would work well with it.
At the moment we only support windows environments but are also looking to support at least Android and iOS (also mono in general is under consideration). We are looking to share as much of the code as possible between the platforms and MvvmCross seems like really nice piece of mvvm (+) framework, especially in that context. I have watched few n+1 videos and what I have seen so far has been very impressive. I also like the Stuart's style of introducing the framework and concepts around it.
Has anyone tried to build a cross platform application that uses both of these frameworks (CSLA.net and MvvmCross)? If yes, what have been your experiences like? Also if Stuart could comment on the issue of how to merg the viewmodels of the two frameworks. I remember Rocky (Rockford Lhotka) recommending, as a general tip when working with mvvm frameworks, to inherit CSLA.net viewmodelbase(not viewmodel) and implement also mvvm framework's requirements into that class. You can find source of the viewmodelbase from https://github.com/MarimerLLC/csla/blob/master/Source/Csla.Xaml/ViewModelBase.cs.
Any input would be much appreciated.
Regards,
Harri
ps. I think, that this would make a great n+ video. Wouldn't it ;)
I've personally never used CSLA, but I have talked with it's original author, Rocky, both by email and in person.
CSLA presents itself as a business model object layer and that it can very successfully interoperate with independent Mvvm frameworks - see Rocky's post on CSLA+Mvvm
MvvmCross provides the more application and UI level support - and leaves application authors free to choose how they write their business services and models.
Because of this, yes I think it should be possible and even straight-forward to use both of the frameworks together if you want to. To get started, it might be useful to write some prototypes - and perhaps to look at the way other integration has been done - e.g. CSLA+Caliburn integration
ps. I think, that this would make a great n+ video.
I'd much rather see this type of article from someone who understands and uses CSLA. I would encourage all members of the MvvmCross community to contribute their own blog posts, articles, videos and github samples.
One caveat to this advice: I don't know if CSLA support Portable Class Libraries - if it doesn't then you'll probably need to use file-linking rather than PCLs in your app
Yes, you can use a multitude of MVVM frameworks; I've used CaliburnMicro and our own custom MVVM with success. If you haven't checked out Rocky's eBook series, you should definitely do so. One of the big gotchas is the limitations on reflection in Silverlight, hence also in WP8 and WinRT, so some reading up on that is well-advised.
Regarding Portable Class Libraries, you can't those for CSLA business objects (they require more stuff than is available in PCLs), so you do have to do the project linking. Typically, write the complete class in the .NET libary w/ pre-compiler directives, such as
#if !SILVERLIGHT
around code that can't be complied for Silverlight/WP8. I do use PCLs for some basic stuff, like enums and constants, but not for the business classes.
Xamarin have just released some updates that mean the latest framework 4.5 with async features can shortly be implemented...

Porting Windows Phone game with Xamarin

I currently have a very simple memory game for Windows Phone that I would like to port over to iOS, Android and possibly Win8 using Xamarin tools.
I would like to centralize my business logic in one assembly and simply create the UI for each platform.
For the most part, the code is simple C#, but I do make use of Bitmaps to show the cards in the game. However, from what I've read, there is no standard support across the different platforms for using Bitmaps.
What would be a recommended approach to this problem?
I'm thinking I have to use something like MonoGame, but feel that is overkill for what I want to do.
You say your code is in C#. As far as I know Xamarin is the only way to get C# code to run on Android and iOS. Xamarin has a free starter edition that you might be able to use but your app will be size limited. Once you hit the size limit you'll need to pay for a license.
After you've decided to pay for a license there are no other costs involved if you want to use MonoGame for the port. If your game is already using XNA or you have some XNA experience I recommend using MonoGame. MonoGame is a port of XNA and is designed for making games, so many game related tasks are easier.
The alternative is to build your game as an app using the standard app building API. This is possible but I can't see any advantages doing it this way unless you are trying to save money by using Xamarin's free edition. If you plan to make more games in the future, you'd be better off biting the bullet and learning MonoGame.
Using bitmaps with MonoGame shouldn't be a problem. Although, you may need to convert them to PNG's first.
Centralizing the business logic in one assembly is sort of possible using Portable Class Libraries but due to the limitations of PCL's it's often easier to use file sharing. Basically you have a soft link to the files in each project. Updating the files updates them in all projects at the same time, but adding new files requires you to add them to each project individually. It's a little bit of a maintenance pain, but not much.
For sure, as a starting point you should separate UI and logic.
To reach this I highly recommend you to make console version of game. Using console it is possible only send commands with parameters to application. No mouse or real-time keyboards usages. All UI-related tasks will be left. Only business logic and commands to use will remain.
Then, you should try MonoGame. It's reliable enough for 2D games. Even more, If IL-code is not too much, it's free for iOS and Android!
Other way is... Unity 3D. Using that engine is depends of code you wrote. In some cases it's possible to use that game engine with shared business logic. Thanks to new Unity 3D policy, indie game developers could make and deploy their games for free.
In short, plan is:
Implement core functionality (with console I/O);
Then, choose engine and implement UI for target platforms.

Code sharing between MonoTouch and MonoForAndroid

What would be the best practice to share busines logic c# code between MonoTouch and Mono For Android projects?
Edited:
Initially, my question was about the physical file sharing:
What do you propose to use: network file sharing or some code
version control (git, svn)? In my case I am using two workstations -
Mac (MonoDevelop with MonoTouch) and PC (Visual Studio with
MonoDroid).
What about Solution/Project folder structure? In
"Blog Post: Xamarin Mobile World Congress 2012 Unofficial
Conference App Released!" example structure is quite confusing:
several solutions in one folder and then different platform projects in one
subfolder with different folder and project names. It can not be accomplished nativly
with IDE. Are they editing content of solution files and folder names manualy
outside of IDE environment?
And for projects of common code what kind of profile (template) to
use? Monotouch has several: Empty Project, MonoTouch Library
Project and MonoTouch Binding Projects? In Android i supose -
Android class library?
This is a very general question, but here are a few resources that may help you get started:
Video: Cross-platform Mobile Development
Blog Post: Shared Libraries For Windows Phone 7, MonoDroid and Beyond
Book: Mobile Development with C#
Blog Post: Xamarin Mobile World Congress 2012 Unofficial Conference App Released!
Edit (to answer your new questions)
The idea behind linking files across projects is that there is only one actual copy of the file, rather than having to manage multiple copies and keep them in sync yourself. The file will actually exist in just one project and be linked into the others, but when the projects are compiled it treats the file as if it were actually there.
I can't speak to exactly how they created their folder structure, but I know there have been many cases where I would manually edit project or solution files to get the folder structure I want, because there was no way to get what I wanted through the IDE alone. This really boils down to personal preference on how you want your folders to be structured.
In the end, what you need is a class library project for every platform you want to target. When going with the linked file approach, it's totally up to you where you put the physical files. One approach I use often is to actually create a standard .NET 4.0 class library, put the files in there, and then link them into my Mono for Android and MonoTouch class libraries. If all you care about is targeting iOS and Android, that may be more trouble than it's worth, and you can just let the files live in one project and link them into the other.
Disclaimer: I've got a particular Mvvm methodology that I use for sharing code across multi-platform projects...
Despite this, I genuinely don't believe in "one size fits all" frameworks - I think you need to be careful to pick an approach that best suits your project, your developers and your organisation.
With that said, some of the tools you can use within the Mono development approach are:
using Portable Class Libraries to share exactly the same code between platforms
using platform specific Class Libraries to share code between platforms, linking these using the Project Linker tool from Microsoft
using #define code within your class libraries to provide platform specific implementations of the projects (I personally try to avoid this approach, but it does often provide the quickest route to market)
using DI/IoC techniques to provide components for those occasions when platform specific implementations really are required.
using a assembly linking to provide IoC - e.g. this is what the Xamarin MobileAPI does
using server-based logic for genuine shared functionality - e.g. using REST or SOAP-XML services to implement logic
sharing tests (e.g. NUnit) between platforms to assure the quality of your logic
using shared code techniques - MVC (MonoCross) or MVVM (MonoMobile.Views or MvvmCross) for UI "controller" logic; MonoTouch.Dialog and MonoDroid.Dialog for "View-level" abstractions; CrossGraphics for UI "drawing"; SQLite.Net for database; etc.
I'm finding the MonoTouch, MonoDroid and the Microsoft tools provide real and signigicant benefits in developing cross platform code - but you do have to work and think to achieve this.

Resources