Xamarin is designed to create native iOS, Android, and Windows apps by coding it in C#. But can it also produce a web app?
If not, is there some solution that would enable us to do that?
You can write your backend code (services, data, domain, business logic, etc) in PCL libraries that can be shared between your Mobile apps and your website. But the web frontend would need to be written separately than the mobile front-ends.
Related
For building a native windows app which can launch multiple web applications in a webview , i have tried a poc using WinUI3 .Main usecase for this is usb peripheral integrations from the webapps loaded in webview and Single Sign On . Reading more on microsoft documentation , i see some features not supported and some slowness compared to UWP. Do i need to go with UWP for a new app or is the recommendation to go with WInUI3 for a new app development .
Supported Feature List Doc - https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/what-is-supported
Can see WebAuthenticationBroker also in not supported list .
Any guidance on what sdk to use . UWP or WinUI3
WinUI3 is the new technology for Windows Desktop. Although it is not perfect now, but it will be improved. Currently, not all the WinRT APIs are able to be used in WinUI3 apps, but you could use win32 APIs to achieve what you want. So I'd suggest you use WinUI if you are familiar with win32 API can you use win32 API to bypass the limitations.
Compared to WinUI3, UWP is more stable. UWP could use all the WinRT APIs. But some features on UWP are not up to date. For example, some features from WebView2 controls are missing on UWP but available on WinUI like print. Another thing is that UWP apps have limitations like system isolation for accessing local files and local network resources.
I have existing UWP apps that I would now like to migrate to Xamarin, so that I can run them on Android devices. What are the most viable and/or practical approaches for doing this?
In some cases I will also want to continue to run these apps on Microsoft devices. I'd prefer not to have two code-bases to maintain, but that might be an option for some apps. A couple of the apps are available on the MS Apps Store.
The UWP apps are relatively cleanly architected, with separate layers and physical projects separating the UI from data access, logic, etc.
Worse-case I can make a new (Xamarin) project and UI from scratch, but what about the other projects / layers? What are my options for those? E.g. copy and paste - retain the old code/solutions (for future UWP-based support if necessary), create copies of the old (non-UI) code/projects in the new Xamarin solution (with a new Xamarin UI).
This post How do I add Xamarin Forms to an existing UWP XAML app? talks about "multiple types of Xamarin code sharing strategies and UI strategies" but doesn't provide any details or references.
This post Adding UWP option to Xamarin cross-platform application seems to be talking about doing it the other way around: taking a Xamarin app and delivering it as UWP.
What are the most viable and/or practical approaches for doing this?
Currently, there is no tool that could directly convert a UWP app into a Xarmain App. Based on your description, you will need to create a new Xamarin app to make your app available in both Android and Windows, or even more on IOS.
You could build a Xamarin.Forms app for your scenario. Xamarin.Forms allows developers to build Xamarin.iOS, Xamarin.Android, and Windows applications from a single shared codebase. As #Jason mentioned, if your app is well architected with data, domain, and service layers, those can probably be reused in Xamarin.Forms app. And the Xamarin.Forms app will convert the code into performant native controls on each platform. So you don't need to write extra code for each platform for the same function.
So, I have been developing an android app for some time, and I was requested to try porting this app to windows phone too. In order to reduce the hassle in trying to maintain two separate versions of the same app, I decided to try to port this app into xamarin, because I have heard that its performance is better than hybrid apps. These are my questions with regard to xamarin:-
I want to maintain the same look and feel which I had in my original app into my cross platform app, and at the same time, make it distinct in the windows version. What are the things I can do to achieve this effect?
Is it rather better for me to port this app to windows phone native, because of added problems in trying to create a common app?
Are there any restrictions with regard to Windows store when publishing xamarin apps?
Xamarin doesn't really cover Windows UWP apps, only in the notion that they have the UI Framework Xamarin.Forms running on that platform. Meaning, that what you are making is a native Windows UWP app.
What Xamarin is great at is when you start targeting more than one platform and you have structured your code in a way that it can be reused on the supported platforms. This could for instance be done by putting most of your logic and behavior into a Portable Class Library/NETStandard library and consume it in your apps.
A Typical pattern for making platform agnostic logic and behavior for your apps, is the pattern known as Model-View-ViewModel, where the View is platform specific, while the Model and ViewModel usually are platform agnostic. The ViewModel is where the behavior resides and it is what ties the Model together with the View.
Usually the ViewModel wouldn't directly know the View, but there would be a layer in between (glue), such as XAML or a binding engine from MvvmCross, MvvmLight or ReactiveUI to name some MVVM libraries.
What Xamarin provides is the ability to write C# code for Android and iOS, which greatly enables you to share code between those two platforms, but also all the Windows platforms. Hence, UI, is very much dependent on each of the platforms on their own.
You can, of course, use Xamarin.Forms as a UI abstraction layer, which produces a native UI using the native UI controls to get a similar app on all the targeted platforms.
First of all you need to know there are different styles of Xamarin development, who will share more or less content.
If you use Xamarin Forms you have a Main project non-related to any platform (where you create the views and clases), and specific platform projects who adapt the controls to each native style.
If you develop using Xamarin Classic, you have a Shared project where you only develop data-related classes, and specific platform project with their own views and classes with native-friendly controls and native similar functions, but I think, there is no direct Xamarin Clasic Windows Project.
So if you only want to have two apps who look native both, but with same structure and functionalities Xamarin Forms will be the best option for you, cause you only develop "one single app" who becomes native-style like this:
If what you want is to have different apps, with different functionalities and diferent content, then you need to go for Xamarin Classic. What I recomend you to do then is develop the windows phone in native, but put all of the code you can in a shared library. Then you can create a Xamarin classic Android app and use the shared library. You will still need to mantain two different apps, but you will only need to change the "core" code only one time.
If you use Xamarin Forms to do a UWP windows app I don't think you have any problem to publish it, think Xamarin is from Microsoft.
I am an iOS developer & I have to start work on Xamarin platform project for iOS. So I have some basic queries as a beginner in Xamarin. I have already initiated study from Link1 Link2
App is developed in Android On Xamarin & now I have to develop the same app for iOS(iPhone+iPad).
So my question are
Can I reuse the C# code written for Android app in iOS?
I have to redesign the UI for iOS devices? (As per my knowledge "YES" plz
confirm if I am wrong)
.Any idea or any suggestion would be great for me.
Thanks
Well, that depends.
If you had been using Xamarin.Forms you would only need to build one project which would then compile into a .apk (Android) and .ipa (iOS) distribution binary. Thus, by choosing Forms, you would only need to design and build the UI once as logic and UI is shared between all platforms.
On the other hand, you can chose to build your application using Xamarin.Android and Xamarin.iOS. In doing so, you can share the logic (e.g. ViewModels, Services, Converters) only. The rest will have to be built platform specific. So in the ladder case, you wouldn't be able to reuse the C# code which you've built for Android on iOS, as the platforms differ.
As Demitrian said earlier, using Xamarin.Forms allows you to build a single project.
If you want to use Xamarin.Android and Xamarin.iOS, which I do, you can build a solution containing an Android project and an iOS project, then add a Shared Project to your solution containing the common code, like classes, models, HTTP actions, etc. That way, you can save some programming time, while still taking advantage of each platform's specificities.
By the time I'm writing this, I'm working on a Xamarin cross-platform app (iOS,Android and Windows Phone), using Azure Mobile Services. There is interest of also developing Mac OS X version of this app.
Is there a way to use the Azure for the OS X app, because I can't find anything on the web? Please, be descriptive as possible :)
There is not currently Xamarin.Mac support in Mobile Services. If you look here (https://github.com/Azure/azure-mobile-apps-net-client/tree/master/sdk) you will see there is a Xam.iOS, Android, and Forms project.
You can add a feature request for Xam.Mac, or make an open PR that adds in a Xam.Mac project. I'd assume the main PCL component will work and its just a matter of adding the Mac specific wrappers where needed. I'm not sure how much dev work that would actually entail though to say if its feasible or not.