Does anyone have any experience with the Share.Plugin. I need to share a link and can't determine what is needed for that. Any help is much appreciated. I currently have SharePlugin by James M. and Jquertl, version 4.0.3 installed
thanks
We wrote a post on this for the Xamarin blog that explains how to use the Share Plugin for Xamarin.
@KenNickerson - This is what I use in my platform-specific code:
IShare shareInfo = CrossShare.Current; return shareInfo.ShareLink(url, message, title);
I figured it out. Simply replaced
CrossShare.Current.ShareLink(url, message, title);
With:
CrossShare.Current.Share(new Plugin.Share.Abstractions.ShareMessage
{
Text = "Download mobile app",
Title = "Share Mobile app",
Url = "https://www.mysite.com/mobile"
});
I am sorry about the false alarm Pierce.
thanks
Answers
We wrote a post on this for the Xamarin blog that explains how to use the Share Plugin for Xamarin.
@KenNickerson - This is what I use in my platform-specific code:
thank you both
The plugin is operating, however, I dont understand it. I see an icon for reminders, "Add to Reading List' COpy, and 2 More(s). I just want to be able to share a link. I am sure there are some configurations, however, I don't know how to manage the settings. Thanks in advance.
I am testing on iphone simulator if that has any bearing...thanks again
@PierceBoggan Being forced to update the share plugin, as a result of other packages requiring updates to Android support packages. Is there an updated tutorial on the updated plugin?
thanks
this is the error I am getting when trying to builkd the Android project:
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: The "LinkAssemblies" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Void Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)' (defined in assembly 'Plugin.Share, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Android.Support.CustomTabs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Void Android.Support.CustomTabs.CustomTabsIntent::LaunchUrl(Android.App.Activity,Android.Net.Uri)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.ProcessQueue()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Mono.Linker.Pipeline.Process(LinkContext context)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at MonoDroid.Tuner.Linker.Run(Pipeline pipeline, LinkContext context)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: --- End of inner exception stack trace ---
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Xamarin.Android.Tasks.LinkAssemblies.Execute()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1569,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
1>Done executing task "LinkAssemblies" -- FAILED.
1>Done building target "_LinkAssembliesShrink" in project "SouthcoastHealth.Droid.csproj" -- FAILED.
I figured it out. Simply replaced
With:
CrossShare.Current.Share(new Plugin.Share.Abstractions.ShareMessage
{
Text = "Download mobile app",
Title = "Share Mobile app",
Url = "https://www.mysite.com/mobile"
});
I am sorry about the false alarm Pierce.
thanks
On facebook the message text is not shared anymore.
Have anyone found a workaround to share text on facebook?
Thanks
@KenNickerson I am not getting Sharelink method i followed your code. Please help me how to achieve it Thanks.