Bo Huang
Bo Huang

Reputation: 375

Xamarin.Forms or Xamarin.Android/Xamarin.IOS

I am new to Xamarin and not sure if chose Xamarin.Forms to create a application for ios and android platform has a problem or not.

The application has some features below:

  1. The application will be able to running some code in background without launching application by user.

  2. The application can be launched by a href link or a notification.

  3. The application is able to launch a builtin Camera application, and receive picture data from Camera application.

Thanks, Bo

Upvotes: 1

Views: 251

Answers (1)

Gerald Versluis
Gerald Versluis

Reputation: 34013

The features you are mentioning can be done with both. Actually, anything you can do on Xamarin.iOS and Xamarin.Android can be done with Forms. Because Forms is only an abstraction layer for the UI which is installed by a NuGet package.

Now, having that said when to use Forms or when to use iOS/Android? It is mostly about UI. Are you going to do some advanced or platform specific stuff is is easier to implement that with the platform specific project.

If you UI will be the same in both platforms and mostly consists of some lists and input fields, then that is a very good candidate for a Forms project.

Notice how I said it is easier to do in the platform specific projects. Again here, you can do anything in Forms as well by the means of Custom Renderers, it is just a bit harder to do.

Ideally try it out yourself and see what suits you best.

In regard with your need to execute code in the background. This will be tricky and is very dependent on the platform that you're on. You will definitely have to write platform specific code for that for which you can use the DependencyService to abstract it to your shared code.

However like AlancLui mentioned executing code in the background isn't something that is easy to do on mobile. On iOS it is restricted to accessing location data or playing music, but still your app needs to be running (in the background). Android has something called Services for this, which makes it a bit easier.

Upvotes: 4

Related Questions