Xamarin Forms Cross Platform Persistent Storage - xamarin

I'm looking for a way to persist settings (KVPs) in a Xamarin Forms app.
I'd like the settings to be easily bound and notified, very much like the SimpleSettings NuGet. The only problem with SimpleSettings is that it doesn't support UWP. Any ideas on a package that supports all.
Thanks

Take a look at SettingsPlugin by James Montemagno. It's supported on all platform and uses the native setttings API's (NSUserDefaults, SharedPreferences, etc) in the background.
Here's the documentation on how to get started: https://jamesmontemagno.github.io/SettingsPlugin/

Related

TokBox OpenTok SDK for Xamarin Forms

I have made proof of concept app for a video chat application in Xamarin Native using the below nuget packages (it works like a charm the source code is done by provider available here https://github.com/DreamTeamMobile/Xamarin.Opentok.Samples/tree/code-improvements)
https://www.nuget.org/packages/Xamarin.OpenTok.Android/
https://www.nuget.org/packages/Xamarin.OpenTok.iOS/
These nuget packages are basically a port of the native iOS/Android SDK's by TokBox for Xamarin, Created by DreamTeamMobile. I want to make use of them to for creating a Xamarin Forms application, I need some guidance how I can make the same functionality available to a Forms Project, considering that the package provider doesn't provides Xamarin Forms implementation. Would custom renderers help here.
In my case using Xamarin Forms (Shared Project), I used native views ref to made Room page and I used the given services to streaming from the Sample code ref, basically was copy and paste the services. Each service and whatever I needed from Android or iOS was included with Conditional compiler ref.
I hope it's useful.

How to include 'Zendesk' mobile chat support in xamarin forms application

I want to introduce 'Zendesk' chat support in my application. I have tried to search but not get the process of including. Please suggest any idea. Thanks in advance.
Zendesk documentation appears to only indicate native support for Android and iOS. Xamarin can link the SDKs individually for each build -- see Xamarin documentation for this (links included but not summarized due to length), but won't handle bridging the difference between the two. Windows will not be supported by this option. If you only want to target Android and iOS, you can use these options and create wrapper classes with a common interface.
Alternatively, if you badly need Windows support and are comfortable with web technologies, the web sdk offers a full api. Xamarin forms supports a webview in which you can load the web sdk, and either build a GUI in the webview or make api calls via the web sdk.
Links detailing including native libraries:
https://developer.xamarin.com/guides/android/advanced_topics/using_native_libraries/
https://developer.xamarin.com/guides/ios/advanced_topics/native_interop/
Note -- above link is specifically for native libraries, which I believe is correct for Zendesk's SDK. If not, there is also a guide for objective-c libraries on the Xamarin website.

Porting an Android application to Xamarin?

I am seeking insight. I have a android application, and would like to create a ios port. Would it be easier to recreate the application in Xamarin, or would it be like starting over again? how alike are android, and Xamarin? thanks for any insight or advice. I am wondering if it might be easier to do this or to just do it sperately on ios
First you need to disassemble your Android app to see which parts are portable. That also gives you hints on how to move on for each parts.
Android UI
UI can be reused easily, as Xamarin.Android projects use the same XML format. So that you can create Xamarin.Android projects and then replace their UI with your existing Android UI.
Third Party
Third party SDK/components can be imported to Xamarin, https://developer.xamarin.com/guides/android/advanced_topics/xamarin-for-java/
Or some vendors already have their Xamarin libraries/components.
General Java Code
For general Java code you want to port, you can try Sharpen,
https://github.com/mono/sharpen
Good luck.

Should I choose Xamarin native or Xamarin.Forms for existing Android app?

We have an android application and want to recreate it for cross platform.
What are the facts for or against Xamarin native and forms?
The advantage of native would be, we could reuse all the xml-layouts while we have to recreate the iOS view in either XAML or XIB?
Is there anything what is really a blocker?
I'll comment based on Giorgi's answer with some actual insight and refer to the copied bullet points:
This is a resume of the experience i've gathered in the past 6 months:
Xamarin.Forms is best for:
Apps that require little platform-specific functionality
Wrong. With DI you can use any device functionality you could possibly want. Check out XLabs on GitHub if you doubt this.
Apps where code sharing is more important than custom UI
Kind of nonsense really. You can write your own renderers to represent controls of each platform in the way you want. I've also written more difficult renderers for custom controls such as a SideDrawer. In android i was done in 2 days, iOS about 2 weeks (android renderer was just a wrapper for the native control)
Developers comfortable with XAML
well yeah and anyone who enjoys convenient UI development. Mind you that there is a learning curve with xaml (which i already knew at the time i started from WPF development). But from what i have seen it's not that different from android.
Xamarin.iOS & Xamarin.Android are best for:
Apps with interactions that require native behavior
While hacking your solution up natively is certainly faster you can instead be done rather quick if purchase good controls / know a good native implementation and mirror it in C#, since the API in C# is very similar to the native one.
Apps that use many platform-specific APIs
Not sure why Xamarin is doing anti advertisement against forms. I had little trouble with it so far
Apps where custom UI is more important than
code sharing
Probably true, but it's also harder to keep UI functionality inline and you will need more manpower.
Things to consider about forms:
Forms seems to be stabilizing at the moment and i am sure Microsoft will do their best to turn it into a solid, reliable product (build issues have been a nightmare in the past sometimes, but it has gotten better over time)
The XAML for Xamarin is less developed compared to WPF XAML, though very similar. Recent nuget updates however provide mirrored functionality at an impressive rate. The vast majority of features you expect and love about XAML are present.
List performance is bad if you don't do your research (here). Performance increased loads in that area.
If i had to make the choice again i'd still go for forms. While there are sometimes things which seem flawed / bad you can usually figure out a clean fix somehow, while spending most of your time actually developing the app. (sometimes you will still find things which just make you frown why something isn't implemented, like the Margin property being implemented only just after microsoft purchased xamarin)
If you end up having a requirement of nested lists, make sure to have a look at embeded native controls in order to achieve the maximum performance - this was essential for a product i was working at. See this
According to Xamarin.Forms main page:
Xamarin.Forms is best for:
Apps that require little platform-specific functionality
Apps where code sharing is more important than custom UI
Developers comfortable with XAML
Xamarin.iOS & Xamarin.Android are best for:
Apps with interactions that require native behavior
Apps that use many platform-specific APIs
Apps where custom UI is more important than code sharing
Giorgis answer is the right one, but since you added some more constraints here are my thoughts.
I would analyze the current app. How much code is business logic which can be shared? How customized is the UI, should it look more native or more the same and how will it change in the future? If you plan to change a lot in UI and platforms should look similar, it might be easier to switch to forms.
Also consider if are you planning to develop for Windows Phone? If yes, you might save a lot of time just for this third platform.
After all there is one thing which I would also keep in mind. Developing in Xamarin.Forms does not mean, you cannot develop native. It is just an additional framework. In worst case you can still do everything natively.
Personally I use Xamarin.iOS & Xamarin.Android with MvvmCross, that way I can keep full control of the native UI on each platform while maximizing code reuse.
From Xamarin website (who knows better than them?):
Xamarin.Forms is best for:
Data entry apps
Prototypes and proofs-of-concept
Apps that require little platform-specific functionality
Apps where code sharing is more important than custom UI
[https://developer.xamarin.com/guides/xamarin-forms/]
With Xamarin.Forms at runtime, each page and its controls are mapped to platform-specific native user interface elements.
With Native Xamarin.Android and Xamarin.iOS apps leverage platform-specific hardware acceleration, and are compiled for native performance. This can’t be achieved with solutions that interpret code at runtime.
"Xamarin.iOS - The best way to build native iOS apps."
Ship native app bundles on the App Store. Our Ahead-of-Time (AOT) compiler compiles Xamarin.iOS apps directly to native ARM assembly
code, meaning your app is a native platform binary.
Access any iOS API. We bring 100% of Apple’s iOS SDK to C#, enhancing Objective-C APIs with stronger types and .NET naming
conventions so you feel right at home.
Call existing Objective-C code from C#. Use your existing Objective-C code, frameworks, and custom controls in your Xamarin app
using our automatic binding generator.
Build WatchKit apps. Use Xamarin Studio or Visual Studio to build new Watch Apps, edit Watch user interfaces in the iOS Designer, and
debug Watch apps in the iOS Simulator.
Stay up-to-date with Apple. We released same-day support for iOS 5, iOS 6, iOS 7, and iOS 8 so your apps can take advantage of the
latest iOS features as soon as possible.
[https://www.xamarin.com/platform]
"Xamarin.Android - The best way to build native Android apps."
Ship native Android packages. Xamarin.Android uses just-in-time compilation for sophisticated runtime optimization of your app’s
performance, meaning your app is a native Android APK.
Access any Android API, including new form factors. We bring 100% of Google’s Android APIs to C#, enhancing Java APIs with async support
and .NET naming conventions so you feel right at home.
Call existing Java code from C#. Use your existing Java code, frameworks, and custom controls in your Xamarin app using our
automatic binding generator.
Build Android Wear apps. With access to 100% API support for Android Wear, create full-featured applications capable of running on
Android Wear devices. Stay up-to-date with Android. Xamarin stays
up-to-date with the most current APIs from Google, so you can always
use the latest features in your apps.
[https://www.xamarin.com/platform]

Xamarin Forms with Touch ID Fingerprint Authentication

I am developing a multi-platform app with Xamarin Forms. I need to support Touch ID/fingerprint authentication for both the iOS and Android platforms. How can I do this? I am new to Xamarin.
I've developed a Plugin for this. It's available on NuGet, too. Feel free, to drop an issue, if you miss something, or found an error.
https://github.com/smstuebe/xamarin-fingerprint
In general: There are alot of Plugins that abstract platform specific behavior. Before you write something on your own, just google for "<feature> xamarin plugin". It will safe much time.
You will need to use a Dependency Service for platform-specific behavior. Look to the linked guide as a starting point.

Resources