Xamarin.Forms or Xamarin.Android/Xamarin.IOS - 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:
The application will be able to running some code in background without launching application by user.
The application can be launched by a href link or a notification.
The application is able to launch a builtin Camera application, and receive picture data from Camera application.
Thanks,
Bo

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.

Related

Business app made in Unity

Have freelance job on VR - Business app and need to make it in VR and noVR modes.
Can I develop it in Unity and what problems can I face? Or can I make noVR-part in Android studio and then combine it with Unity VR-part?
Searching on the internet and can't find a proper answer.
Unity 4.6+ has a new UI thats canvas based, its pretty ok but not as nice as a modern MVVM enabled UI frameworks. There are assets you can buy that enable MVVM in Unity UI. I would recommend this if your UI is complex
https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=rating/query=mvvm
The big problem with using Unity for any kind of business app type thing is that when entering text into GUI.TextFields you can't edit the text directly in the textbox. For any kind of form that has a bunch of textboxes and things to interact with, you need to do it in UIKit.I myself wouldnt use unity for what you want to do, try to look into the google Android SDK.

Xamarin.Forms + Custom Renderers vs. Xamarin.iOS/Xamarin.Android

I recently started using Xamarin.Forms for a project. Like the documentation mentions, it's great for prototyping. However, I'm really starting to notice limitations of the shared concepts for UI design. In particular, the inability to set custom button content (such as an image) is aggravating. I'm sure there will be several instances where I'll want to change how controls work.
The way I see it, there are two routes I could take. One, continue using Xamarin.Forms and make use of custom renderers. Considering I would still like my UI code to be shared, but also customized from the basic Xamarin.Forms controls, I'm leaning towards this option. Two, use the native Xamarin projects (Xamarin.iOS, Xamarin.Android). This would give me full control over the UI for each platform, but it would also mean more code to maintain.
Like I mentioned, I'm currently favoring the option to use custom renderers with Xamarin.Forms. Could I get some insight from those who have used one or (preferably) both options?
I've mainly used Xamarin.Forms. For the right kinds of apps (ones that are, well, "Forms"-like), it works pretty well.
Writing custom renderers isn't that hard, but the documentation is, unfortunately, not that great. Depending on what you're doing, it can be a bit tricky at times translating between the native control and the Forms layout engine. However once you get the hang of it, it makes sense, and now that the code is open source, you can peek inside to see how the "built-in" controls work.
There are various extensions that add more controls. Some are free and open source, like XLabs.Forms. So the control you need might be out there already.
You can use mechanisms like TapGestureRecognizer to turn an Image or a Label into a button, so just because the built-in Forms Button is really, really lacking in customizability, you can sometimes find other ways to get the same effect and still stay within pure Xamarin.Forms.
Hope that helps!
XamarinForms is good for sample application who don't need to use a lot of specificity of the device.
For complex applications, I advise you to start on Xamarin Ios and Android.
It will take more time to take charge but you will see it is much more permissive

Convert Objective C project to Xamarin

We have an app written in Objective C. It uses CoreData, RestKit, about 10 viewcontrollers.
We would like to migrate it to Xamarin (so we can target Android and Windows).
I was hoping there was a way to bind the current code to a Xamarin solution and kind of rewrite features step by step within Xamarin (eg: replacing a viewcontroller at a time, and at the end replacing RestKit+CoreData, by SQLite + ServiceStack).
I am aware of the binding to Objective C option that they provide, however, it doesn't look to be the appropriate fit for this (way too complex, probably easier to rewrite the app from scratch).
Is there a way to migrate our current project to Xamarin so we can convert? or do we start from scratch?
Thanks.
Options:
Migrate full project - no;
Automatically create binding for libraries, rewrite business-code, UI-code - yes;
Rewrite from scratch using .Net/Mono classes - yes.
If code size is relatively small, you should rewrite the whole app. Moreover, thus you could have a chance to separate business-logic from UI code and tools libraries (RestKit, CoreData). In perspective, that code will be more reliable and cross-platformish.
This tool can help. It does Obj-c to C# translation (some manual cleanup required):
Automagical
Quite probably, a re-write, from scratch. One thing to keep in mind, if your back-end is .net.. and you are using DTO's.. like with AutoMapper from Entity Framework objects.. you'll be able to re-use those DTO objects on your mobile side with Xamarin. If you are using OData, I'm not sure if this is still a problem, but Xamarin studio wasn't generating OData service clients. So you had to generate them in Visual Studio, then take the generated client code and throw them into your Mobile projects.
sqllite-net is awesome. I've never had any problems with it.
https://github.com/praeclarum/sqlite-net
I currently have a project, with DTO Objects from an Azure WCF service, that I push directly down into SQLLite objects on IOS and Android with Xamarin. I use RestSharp, rather than Service Stack. I should probably go learn the difference.
If you are looking to use SQLCipher from the Component store, to encrypt your sqllite db locally on your device (Good advice to do so), you should be aware that there is an issue in android.. going to 2.2 or 2.3 with SQLCipher. Works for ICS and above though, if I remember right.
Just be careful on your security implementation for allowing clients to connect. I want to say.. don't take too much advice.. and don't take too little either. : )

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.

Is it possible to modify code generated by PhoneGap and how would this effect apps market application process?

Is it possible to modify/supplement code generated by PhoneGap to modify/add functionality? And how does this effect the application's likelihood of being accepted into the apps market?
The reason I am asking is because there are certain components of the desired iPhone application that we would like to have that we can not achieve with our converted CakePHP web application. These desired items include QR code scanning and augmented reality.
Yes, you can do that.
https://github.com/phonegap/phonegap-plugins
You can look there for already written (and validated) plugins.
If I remember correctly, a qrscanner plugin already exists.
Augmented reality it not really possible with phonegap. (At least not as far as I know) As you can't manipulate the camera view with phonegap.
Maby if you would write a plugin for it. But that would mean writing almost the whole application in objective-C.

Resources