egorbo / toasts.forms.plugin Goto Github PK
View Code? Open in Web Editor NEWA plugin for Xamarin and Windows - it unites Crouton (Android), TWMessageBarManager (iOS) and my toast notificator for WP8.
License: MIT License
A plugin for Xamarin and Windows - it unites Crouton (Android), TWMessageBarManager (iOS) and my toast notificator for WP8.
License: MIT License
Throw this error after update to 1.0.9.21
Error 365 System.IO.FileNotFoundException: /Users/local_admin/Library/Caches/Xamarin/mtbs/builds/MyMobileiOS/6a1077279d715fb26949d0c771bd85c4/obj/iPhone/Debug/Icons/icon-error.png does not exist
File name: '/Users/local_admin/Library/Caches/Xamarin/mtbs/builds/MyMobileiOS/6a1077279d715fb26949d0c771bd85c4/obj/iPhone/Debug/Icons/icon-error.png'
at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) <0x19ff7f0 + 0x00333> in :0
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) <0x38e0640 + 0x000c7> in :0
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () <0x38dfe20 + 0x00227> in :0 C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets 377 3 MySIT.Mobile.iOS
The error is:
Install-Package : Could not install package 'Toasts.Forms.Plugin 1.0.6.18'. You are trying to install this package into a project that targets
'.NETPortable,Version=v4.5,Profile=Profile259', but the package does not contain any assembly references or content files that are compatible with that framework. For
more information, contact the package author.
At line:1 char:1
- CategoryInfo : NotSpecified: (:) [Install-Package], Exception
- FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
When I init the plugin in a Xamarin.Forms iOS project I get the following error:
Error MT0034: Cannot include both 'monotouch.dll' and 'Xamarin.iOS.dll' in the same Xamarin.iOS project - 'monotouch.dll' is referenced explicitly, while 'Xamarin.iOS.dll' is referenced by 'Toasts.Forms.Plugin.iOS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. (MT0034) (MyProjectName)
Initilization like:
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
Forms.Init ();
ToastNotificatorImplementation.Init ();
window = new UIWindow (UIScreen.MainScreen.Bounds);
...
return true;
}
How could I solve this?
I am using Xamarin.Forms 1.3.0 (stable)
PS. thanks for sharing this awesome plugin
Hi
If i show the notification for 25 seconds & after 10 seconds I call the HideAll method, it works fine on iOS 8.3 but the notification remains open in Android 4.4.4 for another 15 seconds.
Seems like calling HideAll does not work in Android?
Anyone else who has used it & found this to be working?
Let me know your observations please.
Thanks
ST
When I use Toasts.Forms.Plugin V 1.0.6.18 on my Xamarin Forms Android App and I compile it with Android level 15 (4.0.3) and run it in a emulator running Android 4.0.3, I get this exception...
It is strange, should not
if (Build.VERSION.SdkInt < Build.VERSION_CODES.JellyBean)
{
croutonView.ViewTreeObserver.RemoveGlobalOnLayoutListener(layoutListener);
}
else
{
croutonView.ViewTreeObserver.RemoveOnGlobalLayoutListener(layoutListener);
}
prevent such errors?
Would be nice if you could define (of evaluate) that there is no title and that all text is rendered from the top. Leaving the title empty leaves an empty line in the toast.
Wondering if you could update the name of the package to "Toasts Plugin for Xamarin.Forms". Will help with discoverability and things we will be doing to highlight plugins.
Thanks! and this is awesome.
Can we expect support for UWP?
Using the latest version on Nuget. Trying to set up the Toasts plugin in iOS gives the following error:
Reference to type 'Toasts.IToastNotificator' claims it is defined assembly 'Toasts.Forms.Plugin.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null', but it could not be found.
This is from
DependencyService.Register<Toasts.ToastNotificatorImplementation>();
in AppDelegate.cs
When packaging our android app using xbuild on the console, the _CopyMdbFiles
target tries to copy Toast.Forms.Plugin
related dll files from the bin/
directory that are not existing. It seems that the path is missing a slash before the file name, because all names are prefixed with Release like bin/ReleaseToasts.Forms.Plugin.Abstractions.dll
. Checking the bin/
directory i can confirm that the files do not exist, but they are available in the bin/Release/
subfolder. I am not 100% sure if the path is broken or the missing files do not get generated.
Do you have any idea where this issue comes from and how to fix it? My theory is that it is linker related, which would be weird because we added Toasts.Forms.Plugin.Droid
to our linker description file and it works.
Enclosed is the output of the _CopyMdbFiles target:
Target _CopyMdbFiles:
: warning : Could not find file "//path-to-app/bin/ReleaseToasts.Forms.Plugin.Abstractions.dll". at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0
at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName) [0x00000] in <filename unknown>:0
at Pdb2Mdb.Converter.Convert (System.String filename) [0x00000] in <filename unknown>:0
at Xamarin.Android.Tasks.CopyMdbFiles.Execute () [0x00000] in <filename unknown>:0
: warning : Could not find file "//path-to-app/bin/ReleaseToasts.Forms.Plugin.Droid.dll". at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName) [0x00000] in <filename unknown>:0
at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName) [0x00000] in <filename unknown>:0
at Pdb2Mdb.Converter.Convert (System.String filename) [0x00000] in <filename unknown>:0
at Xamarin.Android.Tasks.CopyMdbFiles.Execute () [0x00000] in <filename unknown>:0
Using the Toasts.Forms.Plugin has an unexpected conflict with Xamarin.iOS asking the operating system for the height of the Status Bar.
In Xamarin Forms I ask the OS for the height of the Status Bar every time there is a SizeChanged event and then adjust my screen layout (the XamForms StackLayout padding)
I use UIKit.UIApplication.SharedApplication.StatusBarFrame.Height to get the height.
This works perfectly in my apps but fails after the first Toast has been generated using Toasts.Forms.Plugin.
Before the Toast, the call to UIKit.UIApplication.SharedApplication.StatusBarFrame.Height gives me 20 pixels for portrait and 0 pixels for landscape (on iPhone). On iPad it is always 20 pixels in both orientations.
After the Toast the call to UIKit.UIApplication.SharedApplication.StatusBarFrame.Height gives me 0 pixels for portrait and 20 pixels for landscape on iPhone,
Something has happened so that when Xamarin Forms and Xamarin.iOS asks for the height, it gets incorrect values if a Toast has been generated.
My code is like this in a Xamarin Forms app
this.SizeChanged += (object sender, EventArgs e) =>
{
// iOS on phones hides the Status Bar in Landscape (iPad does not)
if (Device.OS == TargetPlatform.iOS) {
int sbHeight = (int)UIKit.UIApplication.SharedApplication.StatusBarFrame.Height);
stackLayout.Padding = new Thickness (0, sbHeight, 0, 0);
}
};
Other tests...
I have tested with the pre release of 1.7.x.x and there is no change.
I have tested with the current Alpha of Xamarin.iOS 8.13.x.x and no change.
ACR's Toast library works fine so currently use your library for Android and ACR for iOS
Thanks
Roger
Would it be easy to add the possibility the show the toast at the bottom of the screen?
"using Toasts.Forms.Plugin.iOS" can't be resolved within an iOS project. Is this a known issue?
Project info:
Xamarin.Forms v1.3.2
Unified API
Toasts plugin v1.0.0.9
Hi,
I like this plugin quite a lot, is there any chance this will or could be extended to the Xamarin.Forms windows store preview?
Cheers
I was using the latest Toasts.Forms.Plugin in a shared asset project, trying the sample code you provided.
var notificator = DependencyService.Get<IToastNotificator>();
bool tapped = await notificator.Notify(ToastNotificationType.Error, "Error", "Something went wrong", TimeSpan.FromSeconds(2));
But this gives me the following error,
Error CS4033: The 'await' operator can only be used when its containing method is marked with the 'async' modifier (CS4033) (iRemote.iOS)
However, when I change the code to:
var notificator = DependencyService.Get<IToastNotificator>();
var tapped = notificator.Notify(ToastNotificationType.Error, "Error", "Something went wrong", TimeSpan.FromSeconds(2));
It works fine, although the dismiss on click doesn't work on Android (works fine in iOS).
Could you please direct me as to what I've done wrong?
Hi @EgorBo !
I REALLY REALLY REALLY like your plugin and it works perfectly, but everytime Xamarin.Forms gets updated, the build for the WP8 version of the app breaks... iOS and Android works perfectly well.
Is there anything wrong with my setup ?
Thx !
I am writing an Xamarin.Forms app that implements appcompat (here is how).
However as you can see, this also makes the toast dialog clip trough. A feature to set a offset would be nice if there aren't any other fixes.
Hey Egor,
I have a problem with the Android Toast on Android 5 (LG Nexus 5 5.01).
For Android 4.x devices everything is fine.
Example Code:
DependencyService.Get<IToastNotificator>().Notify(
ToastNotificationType.Success,
text, // "Foo"
description, //"Bar"
TimeSpan.FromSeconds(duration) // 1
);
System.Diagnostics.Debugger.Mono_UnhandledException_internal () in
System.Diagnostics.Debugger.Mono_UnhandledException (ex={Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <IL 0x00011, 0x00068>
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:896
at Android.Runtime.JNIEnv.FinishCreateInstance (intptr,intptr,intptr,Android.Runtime.JValue[]) [0x0000b] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:288
at Java.Lang.String..ctor (string) [0x000fc] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Java.Lang.String.cs:464
at Toasts.Forms.Plugin.Droid.Manager.AnnounceForAccessibilityCompat (Android.Content.Context,string) [0x00044] in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:277
at Toasts.Forms.Plugin.Droid.Manager/<>c__DisplayClass1.<CallOnGlobalLayout>b__0 () [0x0005a] in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:173
at Toasts.Forms.Plugin.Droid.Manager/GlobalLayoutListener.OnGlobalLayout (System.Action) [0x00000] in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:293
at Toasts.Forms.Plugin.Droid.Manager.CallOnGlobalLayout (Toasts.Forms.Plugin.Droid.Crouton,Android.Views.View) [0x00026] in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:159
at Toasts.Forms.Plugin.Droid.Manager.AddCroutonToView (Toasts.Forms.Plugin.Droid.Crouton) [0x00070] in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:151
at Toasts.Forms.Plugin.Droid.Manager.HandleMessage (Android.OS.Message) [0x0003c] in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:104
at Android.OS.Handler.n_HandleMessage_Landroid_os_Message_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.OS.Handler.cs:312
at (wrapper dynamic-method) object.2d792a2f-481d-41bb-bab2-5c909adab5b6 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
--- End of managed exception stack trace ---
java.lang.NullPointerException: Attempt to read from field 'char[] java.lang.String.value' on a null object reference
at java.lang.String.<init>(String.java:421)
at toasts.forms.plugin.droid.Manager.n_handleMessage(Native Method)
at toasts.forms.plugin.droid.Manager.handleMessage(Manager.java:52)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
}) in
object.2d792a2f-481d-41bb-bab2-5c909adab5b6 (arg0=0xffffffffb5051240, arg1=0xffffffffbefb52bc, arg2=0xffffffffbefb52c0) in
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () in
Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (jobject=0x100b9e, jclass=0x30050e, jmethod=0x707657d8, parms={Android.Runtime.JValue[1]}) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:896
Android.Runtime.JNIEnv.FinishCreateInstance (instance=0x100b9e, jclass=0x30050e, constructorId=0x707657d8, constructorParameters={Android.Runtime.JValue[1]}) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:288
Java.Lang.String..ctor (toCopy=(null)) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Java.Lang.String.cs:464
Toasts.Forms.Plugin.Droid.Manager.AnnounceForAccessibilityCompat (context={rebuyapp.android.MainActivity@1875637f}, text=(null)) in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:277
Toasts.Forms.Plugin.Droid.Manager. () in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:173
Toasts.Forms.Plugin.Droid.Manager.GlobalLayoutListener.OnGlobalLayout (action={System.Action}) in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:293
Toasts.Forms.Plugin.Droid.Manager.CallOnGlobalLayout (crouton={toasts.forms.plugin.droid.Crouton@2eff453f}, croutonView={android.widget.LinearLayout{2827474 V.E...C. ......ID 0,0-0,0}}) in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:159
Toasts.Forms.Plugin.Droid.Manager.AddCroutonToView (crouton={toasts.forms.plugin.droid.Crouton@2eff453f}) in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:151
Toasts.Forms.Plugin.Droid.Manager.HandleMessage (message={{ when=-632ms what=12714097 obj=toasts.forms.plugin.droid.Crouton@2eff453f target=toasts.forms.plugin.droid.Manager }}) in d:\tohoto\GitHub\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:104
Android.OS.Handler.n_HandleMessage_Landroid_os_Message_ (jnienv=0xffffffffb5051240, native__this=0xffffffffbefb52bc, native_msg=0xffffffffbefb52c0) in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.OS.Handler.cs:312
object.2d792a2f-481d-41bb-bab2-5c909adab5b6 (arg0=0xffffffffb5051240, arg1=0xffffffffbefb52bc, arg2=0xffffffffbefb52c0) in
When using toast notification type "Error" the icon is different in android from iOS and windows.
The icon shown for android is that of type "warning".
hi @EgorBo !
would you mind updating to xamarin.forms 1.4.0-pre1 ? there are many nice features within this release and xamarin wants to stay with 1.4.0 for future bug fixes, so no one has to update plugins to the latest patch levels...
Thanks !
Hi Egor,
Would you consider flattening your namespaces from:
using Toasts.Forms.Plugin.iOS;
using Toasts.Forms.Plugin.Droid;
using Toasts.Forms.Plugin.WP8;
using Toasts.Forms.Plugin.Abstractions;
To just:
using Toasts;
This will cement your library as the library for toasts when using Xamarin and greatly improve developer accessibility when using MonoDevelop.
I get ObjectDisposedException when I try to navigate from one page to another.
I am using Xamarin Forms. The navigation is made as so: Navigation.PushAsync(newPage, true);
Exception: Exception type: System.ObjectDisposedException
The object was used after being disposed.
at System.Net.Sockets.Socket.EndAccept (System.Byte[]& buffer, System.Int32& bytesTransferred, IAsyncResult asyncResult) [0x00000] in :0
at System.Net.Sockets.Socket.EndAccept (IAsyncResult result) [0x00000] in :0
at Mtb.Server.Proxy.LogProxy.VS_IncomingOutput (IAsyncResult result) [0x00000] in :0
I'm trying to call Init in Xamarin.iOS with ToastNotificatorImplementation.Init(new MessageBarStyleSheet() { ??? } );
However, it looks like none of the parameters of the "custom" style sheet can actually be altered. Am I missing something?
I first want to personally thank you for creating a Plugin for Xamarin for our holiday contest. To get your exclusive Xamarin Swag Bag out to you I just need a bit more information from you. If you can email: [email protected] with the following information we will get the bag out to you.
Name
Street Address
City, State, Zip Code
Country
Phone Number
The URL to this repo
Thank you again and I hope to see even more plugins from you in the future. Always feel free to reach out if you need anything.
I'm using your latest version of this plugin and under iOS I don't get it to work. It always throws an unhandled exception, which I can't catch, without any information.
I'm running Xamarin.Forms 1.3.1 in the TestApplication I made to show the problem.
In this code it doesn't even execute the button clicked event. Am I doing something wrong?
I noticed, that when I install the plugin via nuget package manager, in the iOS project the wrong Toast.Forms.Plugin.Abstractions.dll
gets referenced (its referencing the pcl version) and the Toast.Forms.Plugin.iOS.dll
is not referenced at all. So I added them by myself. May this be the problem?
AppDelegate.cs
using Foundation;
using Toasts.Forms.Plugin.iOS;
using UIKit;
namespace XFTest.iOS
{
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
ToastNotificatorImplementation.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
}
App.cs
using Xamarin.Forms;
namespace XFTest
{
public class App : Application
{
public App()
{
// The root page of your application
MainPage = new TestPage();
}
}
}
TestPage.cs
using Toasts.Forms.Plugin.Abstractions;
using Xamarin.Forms;
namespace XFTest
{
public class TestPage : ContentPage
{
public TestPage()
{
var layout = new StackLayout();
var button = new Button
{
Text = "Notifier"
};
button.Clicked += ButtonOnClicked;
layout.Children.Add(button);
Content = layout;
}
private async void ButtonOnClicked(object sender, EventArgs eventArgs)
{
var notifier = DependencyService.Get<IToastNotificator>();
bool tapped = await notifier.Notify(ToastNotificationType.Info, "Test", "test", TimeSpan.FromSeconds(5));
}
}
}
///Edit: I installed it with the console and now I get this exception:
System.NotImplementedException: The requested feature is not implemented
The Toasts.Forms.Plugin.Abstractions.dll
is referenced wrong again. It's the PCL profile one. Not the Monotouch10.
///Edit2: When I add the correct references the DependecyService.Get
is working. But when I try to display an toast notification I get an Unhandled.Exception
of type System.NullReferenceExcpetion: Object reference not set to an instance of an object
Hi, fantastic plugin, thank you. I recently updated the Nuget reference to ver 2.0.1 however now the project refuses to build due to to the following error:
Error CS7069: Reference to type Toasts.IToastNotificator' claims it is defined assembly
Toasts.Forms.Plugin.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null', but it could not be found (CS7069)
This only started happening with this latest version. The issue occurs on the following line in the AppDelegate "DependencyService.Register();"
Any input on this?
On iOS, crash with the error message below. Bits from 1.0.7.19-pre1 (nuget)
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
2015-04-01 09:08:51.906 TheAppIos[11654:431130] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
at Toasts.Forms.Plugin.iOS.MessageView.Draw (CGRect rect) [0x00000] in :0
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
at TheApp.iOS.Application.Main (System.String[] args) [0x00001] in c:\Users\johankarlsson\Source\Repos\TheApp\TheApp\TheApp.iOS\Main.cs:17
Can you remove Xamarin.Forms dependency and make it compatibel with Xamarin native projects and PCL?
I tried to do it myself by somehow get top activity context is not working.
I see that you migrated the package from Monotouch 10 to Xamarin.IOS, Are there any possibility to put this plugin in Monotouch, I tried to use it but I not got it.
Hey Egor,
i got this error when I want to use the toast.
Android 4.4/5.0
Xamarin Forms 1.4.0.6341
Toasts.Forms.Plugin 1.0.6.18
public static void Error(string text, string description = null, int duration = 3)
{
DependencyService.Get<IToastNotificator>().Notify(
ToastNotificationType.Error,
text,
description,
TimeSpan.FromSeconds(duration)
);
}
{System.MissingMethodException: Default constructor not found for type Toasts.Forms.Plugin.Droid.ToastNotificatorImplementation
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at Xamarin.Forms.DependencyService.Get[IToastNotificator] (DependencyFetchTarget fetchTarget) [0x00000] in <filename unknown>:0
at Foo.Common.Views.Toast.Error (System.String text, System.String description, Int32 duration) [0x00002] in /Users/armintelker/git/universal-app/Foo/Common/Views/Toast.cs:21
at Foo.Green.Search.Pages.ScannerSearchPage+<searchBarcode>c__async0.MoveNext () [0x000d9] in /Users/armintelker/git/universal-app/Foo/Green/Search/Pages/ScannerSearchPage.xaml.cs:111 }
System.MissingMethodException
Do you have maybe a idea?
Thanks :)
Xamarin Forms 1.4/1.5 supports iOS 6.1 (ref: https://developer.xamarin.com/guides/cross-platform/xamarin-forms/getting-started/installation/)
TWMessageBarManager is supposed to support iOS 6.0 or later. (ref: https://github.com/terryworona/TWMessageBarManager)
That being said, this is crashing for me on iOS6.1.
I have some use cases for it ;-)
The error:
Adding 'Toasts.Forms.Plugin 1.0.6.18' to Useall.E2.Comercial.AV.Mobile.Windows.
Install-Package : Could not install package 'Toasts.Forms.Plugin 1.0.6.18'. You are trying to install this package into a project that targets 'WindowsPhoneApp,Version=v8.1', but the package does not contain
any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
- CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
- FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Someone know about?
Thanks
I want to use it in android dependecy (ZXing barcode scanner), but it doesn't work. in iOS works perfectly. Can you tell me how to operate it ?
Thanks very much for your plugin
Good Morning,
I have a question here:
When my messages are large, and it's not possible to reduce it,
it's possible to increase the height of the Toast Box ?
I implemented the DefaultToastLayoutRenderer with type ToastNotificationType.Custom passing an url (small profile image from web) and a color.
The problem is it takes a little time to load the image the first time (I cache it for reuse) and while retrieving the image, the default image ("Resource.Drawable.error") is shown.
Could this be changed so that there is no default image when using the Action<object, ImageView> imageSetterForCustomType = null.
Thanks in advance and keep up the good work.
Tried to use this Plugin for a Xamarin Forms Shared Project. I have set the Toast Init after the Xamarin.Forms.Init() as stated in the docs. An exception of type "Android.Views.InflateException: can be used only with a valid ViewGroup root and attachToRoot=true" throws.
Is there something wrong with what Im doing?
Im using FormsAppCompatActivity by the way.
Is it possible to add the possibility that when the user "ticks" the toast that it is dismissed (even when the duration is not yet expired)?
After upgrade of Xamarin.Forms to 1.3.2 the WP8 solution does not build anymore because of missing dependency to XF 1.3.1. Android and iOS build fine.
any workaround ?
Hi,
first of all, thank you for this plugin. It's really cool.
So my question: Would it be possible to create a notification with an ActivityIndicator?
I would contribute to this but currently I can't support all 3 platforms (VS2012/Win7)
I upgraded my project's nuget packages - Xamarin.Forms and Toasts Plugin. My Win Phone project then failed to build.
Uninstalling Toasts resolved the issue.
The error I got was:
Cannot resolve dependency to assembly Xamarin.Forms.Core, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null because it has not been preloaded
Hey there! With 1.3.1 now on stable with Unified support it would be great if you could update the plugin with this support. I created a short How To video on how to do this: https://www.youtube.com/watch?v=nF8DbL-PVKw
Can't figure out how to get text to wrap to a 2nd line. Any ideas?
Hoping to use this on an internal project here at Xamarin.
Can we have one more property for IsSticky when set the Toast shows until tapped or until we hide it from code?
This would be a great feature to have.
Thanks
ST
Hi ,
I am using this toasts.forms.plugin, i need this toast message to show up at the bottom of the screen. just need to know where exactly i should change the position of the toast.
please help!!
Thanks in advance.
Add support for Classic API until we port it to Unified API
We can't test the iOS app as I get the error :
with version 1.0.0.9 :
cannot include both 'monotouch.dll' and 'xamarin.ios.dll' in the same xamarin.ios project - 'xamarin.ios.dll' is referenced explicitly, while 'monotouch.dll' is referenced by 'toasts.forms.plugin'
with latest stable version,
there is no Toasts.Forms.Plugin.iOS assembly
varsion: 1.0.6.18
I always call notificator.HideAll()
before showing any notification to dismiss previous one;
On iOS it works OK.
But on Android it does not hide previous and shows a new one on top instead. After last notification is hidden an exception is thrown:
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/1978/f98871a9/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
[MonoDroid] at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue*) [0x00063] in /Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:571
[MonoDroid] at Android.Views.View.StartAnimation (Android.Views.Animations.Animation) [0x0005a] in /Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Views.View.cs:18992
[MonoDroid] at Toasts.Forms.Plugin.Droid.Manager.RemoveCrouton (Toasts.Forms.Plugin.Droid.Crouton) [0x00016] in c:\Projects\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:227
[MonoDroid] at Toasts.Forms.Plugin.Droid.Manager.HandleMessage (Android.OS.Message) [0x00044] in c:\Projects\Toasts.Forms.Plugin\Toasts.Forms.Plugin.Droid\Manager.cs:108
[MonoDroid] at Android.OS.Handler.n_HandleMessage_Landroid_os_Message_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/1978/f98871a9/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.OS.Handler.cs:356
[MonoDroid] at (wrapper dynamic-method) object.faa8fdcb-fad5-40a2-ad29-238ec4e97112 (intptr,intptr,intptr) <IL 0x00017, 0x00027>
[MonoDroid] --- End of managed exception stack trace ---
[MonoDroid] java.lang.NullPointerException
[MonoDroid] at android.view.View.startAnimation(View.java:16790)
[MonoDroid] at md5ec11fdb01388465a68addaebc5a82d67.Manager.n_handleMessage(Native Method)
[MonoDroid] at md5ec11fdb01388465a68addaebc5a82d67.Manager.handleMessage(Manager.java:52)
[MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:102)
[MonoDroid] at android.os.Looper.loop(Looper.java:136)
[MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:5001)
[MonoDroid] at java.lang.reflect.Method.invokeNative(Native Method)
[MonoDroid] at java.lang.reflect.Method.invoke(Method.java:515)
[MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
[MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
[MonoDroid] at dalvik.system.NativeStart.main(Native Method)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.