I've found a few examples, as I in a Xamarin.Native use a Windows UWP. But that would mean that I a Xamarin.Nativ in a Windows UWP Convert.
I would like convert a finished Windows UWP application to the target Android or iOS. Is that generally supported or needs my UWP application rebuild again with Xamarin?
Links:
Adding a Universal Windows Platform (UWP) App
Getting Started with Xamarin.Forms 2.0’s Windows 10 Preview
Unfortunately asfar as I know there is no converter that allows to convert UWP app to Android app straight forward.
There are few ways to make the whole process a lot much more easier (so you can create your Android app faster).
If you wrote your UWP application and separated common code that can be used in the other applications you can also use it in Xamarin.Android app - the best way is to have PCL with the common code.
It is also important which type of Xamarin app you would like to create:
1) Xamarin Forms - common UI for each app: Windows, Android and iOS.
There is one shared code that can be used by them. Remember that Xamarin Forms apps are generally speaking the best for displaying the data and they are limited with reference to platform specific functionality.
Please see below to read more:
https://docs.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/
2) Xamarin.Platfrom (so Xamarin.Android and Xamarin.iOS):
Here you can create native UI foreach of the project (Windows, Android and iOS) and access specific platform functionality.
With reference to the code - you can put common code in one PCL and have access to it from each project.
Please see this site - here you can find different Xamarin options to create cross-platfrom apps:
https://developer.xamarin.com/
Firstly, if you want a shared code, using Portable class library, you can use the same code for all the platforms including WPF, Android and iOS. First of all what you can do is convert the codes that is used again and again in the PCL (Portable Class Lirary). Once you get used to PCL, you can easily work on any platform you want.
As the Android, iOS are different from windows, a lot of .net framework functionality is not supported in PCL. Although, once you create the basics in PCL, you can integrate the class library in android as well as iOS.
Related
I have made a .net core 2.2 app and it works great, I can browse to it through my browser and all of the stuff I made works. I am wondering if it is possible to make an app for my phone though instead of getting to my server through the browser. I mainly want to do this so that I have a better phone side layout. Is this possible and if so could you point me to a good starting point to figure out how to make something like this?
You could have a look at Xamarin perhaps?
Xamarin is a free open-source framework to build truely native cross-platform mobile apps using C# .NET for iOS, Android or Windows. It runs on Mono and .NET to build apps with native performance and native UI.
Xamarin allows you to develop native apps using C# language and platform specfic tools/SDKs and share the same code across multiple platforms - iOS, Android or Windows.
https://visualstudio.microsoft.com/xamarin/
What is the difference between these Visual Studio 2017 new project options?
File > New > Project > Visual C# > …
OPTION 1. > Cross-Platform which supports iOS, Android, etc.
OPTION 2. > iOS Extensions
OPTION 3. > iPhone & iPad > iOS App (Xamarin)
OPTION 4. iOS XAML App (Xamarin.Forms)
I want to make an app on iPad that displays live images from a remote USB camera, via a socket. Later to also run on iPhone, Android, and Windows 10.
OPTION 1. > Cross-Platform which supports iOS, Android, etc.
Creates a cross platform Xamarin.Forms (XF) solution with projects to support iOS, Android, and UWP and a project to hold all of your shared code, which may be all code depending on your needs.
With XF all, or most, of your back end and front end code can go in one shared library project, which is also created when you create this template solution.
In the shared library project, you will have access to cross platform abstracted controls and views like Label, Button, Image, ListView, and most other standard user controls/views, as well as all APIs in .NET Standard 2.0. These Xamarin.Forms controls/views will be rendered on each platform by platform specific renderers, i.e. a XF Button will render as a UIButton on iOS and an Android Button on Android, etc.
Depending on your needs, you still may need to add some platform specific code to your iOS, Android, or UWP projects, either to make your own custom renderers to render XF controls/views to native controls/views of your choosing or access control properties that are not available in the shared, abstracted XF control, or to run other platform specific code, like converting text to speech, which is different on each platform. Xamarin.Forms does provide methods to write platform specific code which can then be invoked from the shared code project, and also a way to make your own custom control/view renderers.
OPTION 2. > iOS Extensions
The are additions to an iOS app project. With these projects, you can create iOS extensions that can be used within iOS iMessage app or the iOS Share menu, for example.
OPTION 3. > iPhone & iPad > iOS App (Xamarin)
This is to develop an iOS only app project using Xamarin.iOS. Xamarin.iOS is a C# binding to the native iOS SDK, so anything that can be done with Obj-C or Swift in XCode can be done in C# using Xamarin.iOS.
OPTION 4. iOS XAML App (Xamarin.Forms)
This is the same as OPTION 1 above, but only the core shared project and the iOS project are created by default. You could later add an Android and UWP project, but if you do plan on supporting all three platforms in the future, you might as well use option one as a starting point.
Xamarin Forms is a write once deploy many option. You write your code and do your UI in Forms, and it will run on iOS, Android and Windows(ish)
iOS (Xamarin) is a native iOS app, but written using C# and Xamarin compiles to native iOS. If you wanted Android, you'd have to rewrite in Xamarin (Android).
There are a number of reasons to use one over the other, that is beyond the scope of SO, but there are a few good articles on the Xamarin site, and other places.
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/get-started/introduction-to-xamarin-forms
https://arctouch.com/blog/xamarin-forms-xamarin-native/
I am a .NET developer. I have a complete Android app developed in Android studio. I want to develop that app in Xamarin cross platform.
Which project template should I choose to develop my app both for Android and iOS? Which one of these will be easier to develop a cross platform app?
Blank App (Native Portable)
Blank App (Native Shared)
Blank App (Xamarin Forms Portable)
Blank App (Xamarin Forms Shared)
These links will help you to decide which project type you'll going to use:
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/
https://xamarinhelp.com/portable-class-library-pcl-vs-shared-projects/
http://hotkrossbits.com/2015/05/03/xamarin-forms-pcl-vs-shared-project/
Xamarin Shared Library and PCL
http://xfcomplete.net/general/2016/01/19/pcl-or-shared-project/
Here are some aspects:
Xamarin Forms vs Native
Native you have to specify your Templates for each OS
Xamarin Forms, one Layout for all OS - But you can't use platform specific views/controls
Portable:
No platform specific code (it's possible to write your own lib for it, but for the most important features you will find such libraries on github or over nuget - e.g. https://github.com/XLabs/Xamarin-Forms-Labs for Controls, Camera-/Location-/..-access)
Easier to code Apps for multiple platforms - no need for compiler directives for code switching depending on platform
no need to think about what code is working on which os
easier to maintain and test (in my opinion, with a good design of your architecture it's not a big deal to make a shared project good maintainable and testable like an portable app)
Which platforms do you use? Are these supported in the PCL-libraries you need?
Shared:
Easier acces on platform-specific features
more versatile / flexible
Compiler directives for OS
Even though you have to decide which type will good fit with your values and needs.
I hope, I could help a little bit.
I am creating universal app, but I want to use parts of older app, wroten in Silverlight 8.1. Is there option how to make cooperate these four projects:
MyProject.Windows (Windows 8.1)
MyProject.WindowsPhone 8.1 (Windows Phone 8.1)
MyProject.Shared
MyProject.OldSilverlightCodes(Windows Phone Silverlight 8.1)
I want to avoid migrating Silverlight code to Runtime line-by-line, it is just too complex to my skills. Is possible connect them any way, maybe via some converter class?
No, you cannot include a Silverlight project in a Windows Runtime project, and there aren't any automated converters.
In general, the best way to share .Net code across multiple targets is to use a Portable Class Library. Depending on what code you have in the Silverlight project it may be straightforward to extract the shared code to a PCL and then use the same PCL in both projects.
--Rob
Usually it is recommended to have two projects for both wp7 and wp8 platforms. Wp7 project contains .cs and .xaml files, and WP8 project contains links to that files.
I think that there is no reason to compile non-platform specific business logic code twice, since it can be referenced to WP8 project.
I'm thinking about following solution structure:
Business logic dll compiled for wp7 (not a PCL)
UI comliled for wp8
UI comliled for wp7
Such application can be compiled and I can deploy it to device/emulator.
The question is: will this app pass certification in Windows phone store? Or it is necessary to recompile shared dll?
UPD:
My crazy idea was born after this steps:
Create new WP7 app (WindowsPhoneApplication1)
Create class library targeted to WP7 (WindowsPhoneClassLibrary1) Use it in WindowsPhoneApplication1
Use Upgrade to WP8 menu. WindowsPhoneApplication1 will be updated to WP8, but the referenced project will be still targeted to WP7!
Such app can be deployed to WP8 devices.
Unless you use a Portable Class Library, you'll need to have separate project files, and compile separately for WP7 and WP8.
Thanks to Claus,
I made some research, and it looks like the answer is - you can use such solution.
I didn't find related information in documentation, but here is a proof from one of MSFT tech. evangelists from Netherlands: link to blogpost
The basic idea is to move all our code that can be used from both our existing Windows Phone 7 app as well as the Windows Phone 8 build, which we will add soon, to a Common project in the solution. The bad thing about this approach is that we have to create the Common project as a Windows Phone 7 class library, which will be used in our Windows Phone 8 build. I haven’t really noticed any negative impact of this decision in my existing apps, but note that you will be referencing a Windows Phone 7 library in your Windows Phone 8 build.
So it is a possible, but not the best solution.