I have a Xamarin.Forms application that I would like to enable as a text and/or URL share target. I've done this in a Windows UWP app by handling OnShareTargetActivated, but I don't see an equivalent in Xamarin.Forms. I am willing to use compiler directives if needed; I would prefer that to doing iOS/Android/Windows specific things in the corresponding projects themselves. Right now all my code is in the Xamarin.Forms project and I'd like to keep it that way.
Unfortunately Android and Ios do not have a similar share event so there is no equivalent event in xamarin forms.
Say I build a super mobile friendly web application that I want in the Play Store for Android users to be able to download.
Could I use Xamarin to:
Wrap the entire mobile app as a single WebView
Register for mobile push notifications
Essentially shortlining an MVP of an android app by using an existing web app? If so, is there any well-known process or documentation that demonstrates this?
Probably the best approach for you would be using Xamarin Forms with one or more pages containing only web views.
I don't love Xamarin Forms because usually for me Xamarin Android+iOS gives a better result in similar time, but your app would be so simple that doesn't make sense to do it with Xamarin Android.
Make sure that your web app will show only what makes sense to be shown in your app, otherwise you risk to see double header/footer, useless buttons... but if the website is yours adding a few parameters to change a bit the UI won't be a problem I guess.
Have a look at this example:
https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithWebview
Another approach is the use of Razor to build your pages in html directly inside your app, but if I understood well it's not what you need:
https://developer.xamarin.com/guides/cross-platform/advanced/razor_html_templates/
Although it is technically possible to do this as the previous answer has suggested. I would recommended firstly reviewing, the relevant stores guidelines on submissions. Apple for example will not allow a submission to their store of any application that simply mirrors the functionality of a website. I suspect Google's would likely be the same.
However that said, to answer your question, Xamarin.Forms would be appropriate for a simple application like the one you are suggesting. Or if you prefer to build to a specific OS, then in iOS with Xamarin you would use the Safari View Controller that was added in it's xcode 8.1 release. Android uses something similar as does windows.
EDIT:
You can use the Web View control in Xamarins Andorid native PCL project to encapsulate your mobile friendly website within an application here is the documentation:
Xamarin Android Developer link to Android Web View
As for push notifications, yes this is perfectly possible using Xamarin.Android. and varies on implementation depending on what you want to use as the back end to handle them, I.E. Azure's notification hub etc.
I'm new to Xamarin development and feel a little bit strange about how to design the UI interface in Xamarin.Forms (portable/shared).
If I just design the Xamarin Android or the Xamarin iOS, I can get the GUI with drag and drop to finish my UI (like in Windows Forms application) and the code for the UI is automatically generated. But in Xamarin.Forms, this one is not supported (we must use code or xaml). I understand that if we use Xamarin.Forms, the same code apply for both Android or iOS.
However it's a long approach to create the UI. Is it possible in Xamarin to create the UI in Xamarin Android / iOS project and then only do the functionality code in Xamarin.Forms (portable or shared)?
I know this is a common question but it can help many new developers either to choose using Xamarin or not...
There is the Xamarin.Forms XAML Preview for when you are coding in XAML:
But in the end, yes, you are coding events, and data converters, etc... and even with tools like the Interface Builder for iOS, you still have to do all the coding to tie the UI together.
On a personal note: Almost ALL the groups that I have worked with do not use the GUI design tools for any apps that are larger then a screen or two. On iOS we avoid .xib & .storyboard like they are the cause of the black plague.
I understood perfectly your situation. A good start is a Xamarin book that you can download for free for this page https://developer.xamarin.com/guides/xamarin-forms/creating-mobile-apps-xamarin-forms/
If you have been developed with WPF, in Xamarin you have the same concept. A good start is trying example in working apps to understand the structure and the app lifecycle. You can find a collection of examples and code at this link. You can create a form or with XAML or in the code. There are two ways. I advice you to start with XAML and C#.
I advice you to use Portable project and in this way you can share that not just across Xamarin project but with other kind of projects (such as a ASP.NET project).
You can think design Xamarin Forms UI like design Website.
Design website
You knowledge HTML
You need web browser to review
Design Xamarin Forms.
You knowledge XAML
You need Xamarin Previewer to review (Gorilla player, xamarin live player, LiveXaml)
Xamarin.Forms is great, for better understanding of XAML I encourage you to take the time and watch this video (https://evolve.xamarin.com/session/56e201d2bad314273ca4d813) where Charles Petzold goes into detail of how XAML works.
Before Xamarin Studio o Visual Studio had a XAML previewer for Xamarin.Forms I used GorillaPlayer (http://gorillaplayer.com/) is free and works well.
Also take a look in the Xamarin University and Examples.
James Montemagno is a name you must research when talking about Xamarin, he did some really cool and helpfull Xamarin Nuget Packages.
Hope I had pointed you in the right direction.
I understand that you are new to Xamarin.Forms. What I did when I was new to the framework was following a few courses on https://www.xamarin.com/university it is free for 30 days if I'm right (that must be enough to understand the basics). About the previewers I don't have good expierence with them. They are often slow or not working. For me it was often faster to just debug on the phone. Hopefully this will help you a bit.
Even if a nice designor was available, I would still argue that coding by hand is much more efficient : no bad code generated (exemple with constraint : no padding /margin set at the wrong place. No hardcoded size when it's not required etc).
You will have a better understanding and the learning curve is fast.
Back in the days, I started XAML with Silverlight with the amazing Microsoft UI designor : Blend. After few months, I ended up with an architecture that broke the designor (because of dependencies injected in constructor or because the designor struggled to discover controls in external assemblies). It was really painful and I lost a lot of productivity. Few months later, I was fluent with XAML and was even more productive than with a designor.
Nowadays, Visual Studio is snippet friendly for XAML control. I've created a few of them (like a grid with several column row auto, a snippet to generate the ContentPage.Resource with a style, etc).
It's a pain that is worth it.
Moreover you will learn a lot a things and will be more confident in your skills.
Give it a try for few months : you won't regret it !
Last but not least, as other suggest, when building a big app, even in iOS, most developpers I know don't use designor but code everything by hand because of snippet, helpers, extension methods etc.
I am slowly becoming more comfortable with programming in a Mac environment after moving across from Windows where I was using C#.
The transition has been smooth so fare but with a very steep learning curve getting used to Objective-C. I am finding Objective-C an amazing spin on a C stye language and so happy I made the move.
I am using XCode 4.6 on OSX 10.8.2 and iOS 6.1.2
The application I’m working on is an OSX Checklist that will need to communicate with a iOS equivalent.
The OSX side of it comes first and it includes a NSOutlineView to use like a SideBar.
I have been having a little trouble positioning controls and having them size to what I want them to do.
I have just found in XCode’s IB a switch that may solve the issue.
In the File Inspector there is a switch for: Use Auto Layout, which is currently ticked. When I Build the project I have a application that runs.
As soon as I remove the tick and re-Build the application it crashes with the following errors, plus more:
2013-02-24 17:00:17.988 ServiceCheck[1633:303] *** Assertion failure in -[NSTableRowData insertRowsAtIndexes:withRowAnimation:], /SourceCache/AppKit/AppKit-1187.34/TableView.subproj/NSTableRowData.m:5408
2013-02-24 17:00:17.989 ServiceCheck[1633:303] An uncaught exception was raised
2013-02-24 17:00:17.989 ServiceCheck[1633:303] insertRowsAtIndexes:withRowAnimation: can not happen while updating visible rows!
I am having trouble on what’s needed to resolve the error and allow me to manually size the controls to my likings.
To help, I can attached my code (once I work out how) for you to better understand what I am seeing.
Is there any tutorial available for creating Universal UI which can run on iPad as well as iPhone on different resolution. I tried looking in the official documentation, but couldn't find anything about UI files.
I notice you've tagged this question with Marmalade, so I'm assuming you are talking about how to write a Universal app in Marmalade? If so then creating a Universal UI is pretty much up to you to implement in the best way you see fit.
By default all Marmalade apps are Universal apps, though you can limit to iPad only with the MKB setting iphone-ipad-only.
Marmalade does come with the iwui module that allows you to lay out user interfaces with buttons and text boxes etc. but ultimately unless you have a very simple UI you'll need to either provide different UI layouts for each screen resolution/orientation you wish to support, or do some fancy laying out in code.
Apple wisely chose to persuade developers into creating separate UIs for iPhone and iPad since the one-layout-fits-all approach generally looks bad at any screen size.