Local Notifications with Xamarin Forms? - c#

I am learning how to use Xamarin forms and I want to implement (push) notifications on Xamarin Forms. I have googled but to no avail. Does anyone know how to implement Local/Push notifications with Xamarin Forms? I am going to use an actual server at a later date but for now just showing a notification when I, for example, press a button, is totally OK for me.
Thanks for your help!
edit:
I am now using the DependencyService to access the Device OS's notification system instead of trying to use Xamarin Forms itself. Answers on this question are not necessary anymore!

Xamarin's documentation includes a guide to notifications:
https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/
It covers both local and remote notifications, including recommendations for libraries (e.g., PushSharp, UrbanAirship) to handle sending push notifications.

You can use https://www.nuget.org/packages/Xam.Plugins.Notifier plugin for local notifications. This is one of the best plugin I've used with Xamarin Forms.

You can also try local notification plug-in for Xamarin Forms https://www.nuget.org/packages/Plugin.LocalNotification/. It has more features and look at the source code if you are implementing your own version.

Related

Mute Windows 10 Notification using C# or WPF

I'm currently researching on how to mute the windows 10 notification but it i havent found any concrete solution yet.
What i want to do is to disable all notifications when i press a button or check a checkbox.
It is similar on what you do on the notification settings, but i want it to do it progmatically on my application.
I'm currently reading the document of microsoft about Notification Listener.
https://learn.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/notification-listener
NotificationListener allows you to access the notifications, but not to the configuration of the system. And you must think it's a UWP Api...
You want to do something that can not be done in UWP Api(impossible) nor WPF(possible, i wish you good luck).
You can't change system settings inside the UWP app box -safety and things-. The way to do it is "Open the Configuration App where you want the user make the change".
If you wan't to this in WPF/.net you'd have to play with PInvoke and WinApi seriously. And that means thinking about privileges, run as admin, find the functions in WinApi .h files, etc...
Keeping simple, in UWP, nope; in WPF, you have to read a lot of source code/documentation of Windows .h files, make the c# version of the structs, etc...
The real question here is... It's necessary? Windows provides Focus Assist with two clicks (corner, Focus Assist)
I really appreciate your feedbacks! I did some tinkering and found out the service responsible for the notification. I'm not really confident that this is the best approach, but it is working for me.
What I did was I stopped the service using C#. Here is my sample code:
ServiceController[] services = ServiceController.GetServices();
foreach (ServiceController service in services)
{
if (service.ServiceName.Contains(serviceName))
{
service.Start();
}
}
Here is the service responsible for the notifications:
Notification Service
I dont know if this is a good practice or not so I'm still open for feedbacks and suggestions.
Thank you!

Implementation of video call in Xamarin forms, what options do I have?

I am looking to create a videocall app but I am a bit unsure where I should start. Preferably I would like to implement a service like skype or something similiar to avoid creating the entire code myself but maybe that is what i have to do. I have a camera stream already implemented (avfoundation) but i can imagine there is a lot of work left in order to create a fully working videocall code.
What options do you guys think I have? Is it possible to implement skype for xamarin forms? I also saw a component called Twilio that you can use in xamarin forms but it seems like it is not supporting a video call, atleast not the component in xamarin forms.
Any help, tips, links is greatly appreciated!
You could use Azure Media Services for this.
https://azure.microsoft.com/en-us/services/media-services/

Stream video to rtmp server in Xamarin.Forms.iOS?

I am currently working on a solution where i want to livestream from my app. I succesfully get my camerastream working with avfoundation. The next step in order to complete my task is to send my video frames to a rtmp server but I am not sure on how i can accomplish this in xamarin forms ios.
For swift there is a library called https://github.com/jgh-/VideoCore that solves this but do we have something similiar in xamarin (any library) or documentation on examples that tackles this issue?
Thanks a lot!
Maybe it's a bit late for you, but this can probably help someone who wants to do the same thing (like I did), you can use the Xamarin port of LFLiveKit:
https://github.com/rhedgpeth/Xamarin-LFLiveKit
You'll have to implement a custom renderer to use it with forms, but it's not too hard if you follow the sample project in the repository.

How to turn the screen off in windows phone?

I've searched for it ,but I can't find the answer.
what I found is that how to keep the screen alive.
I wanna try to write the uwp that
when I click a button ,the screen will be turned off.
is there any function?
thank for any reply!
The answer is NO. You cannot turn off the screen from your app.
Microsoft will not allow application to do so. The API won't support this. Even if you did it with some hacks such app will be removed from store.
There's an answer about your question in StackOverFlow:
Microsoft certification will not allow application to do so, even
though if your able to do with some hacks. You cant turn off the
screen from your application. This type of app cannot be made for
Windows Phone, the API's do not exist, and if someone found a
workaround it would be removed from the store. Unfortunately non of
the developers have developed such app for windows

Xamarin - Is there a Load Function

I have a question about Xamarin Studio. I am building a application that connects with a server to get data from the server. I've made a function for the connection.
Also i've made a second view that opens when the user presses a button. When the view loads i would like to call my connect function to get all the data.
So i would like to know if there is a Load event in Xamarin studio.
This is the function i am looking for:
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.load(v=vs.110).aspx
Thanks in advance
There are several. One of them is ViewDidLoad, which runs after a View has loaded. Xamarin is not a direct port of Windows Forms, which means MSDN will be of little help - you need to learn how iOS works.
However, there is Xamarin Forms, which is a cross-platform UI toolkit that may be the right choice for you. It abstracts away the need for knowing iOS or Android UI details. You may think of it as "Windows Forms for iOS/Android/Phone". Even if you're only ever targetting iOS, Xamarin Forms can help you build an UI.
In this specific case, the "Hello, iOS" Xamarin quickstart tutorial has a good example of responding to events such as a view loading.

Categories