Giter Site home page Giter Site logo

abrantie1z / notifications Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aritchie/notifications

0.0 2.0 0.0 13.83 MB

Local notifications for iOS, Android, & Windows. Includes badges, scheduled notifications, sounds, & context actions

License: MIT License

C# 99.60% Batchfile 0.40%

notifications's Introduction

ACR Notifications Plugin for Xamarin and Windows

Plugin for Easy Cross Platform notifications

NuGet Change Log - July 28, 2017

Features

  • Local Notifications
  • Scheduled Notifications
  • Sounds
  • Read all Scheduled Notifications
  • Badges
  • Set metadata on each notification for identification
  • Cancel individual or all notifications

Supported OS

  • iOS 6+
  • macOS
  • Android 4+
  • Universal Windows Platform (Win10/UWP)
  • NET Standard 1.0

Installation

Install the nuget package in your platform project as well as your netstandard library.

Send a notification

await CrossNotifications.Current.Send("My Title", "My message for the notification");

Send a scheduled notification:

await CrossNotifications.Current.Send("Happy Birthday", "I sent this a long time ago", when = TimeSpan.FromDays(50));

Get a list of scheduled notifications

var list = await CrossNotifications.Current.GetScheduledNotifications();

Cancel a specific notification

var id = await CrossNotifications.Current.Send("Hi", "This is my scheduled notification", when = TimeSpan.FromDays(1));
await CrossNotifications.Current.Cancel(id);

Cancel all scheduled notifications and clear badge:

CrossNotifications.Current.CancelAll();

To set a badge:

Setting badges works on all platforms, though only select flavours of Android. A 3rd party library is used to accomplish this.

await CrossNotifications.Current.SetBadge(4);
await CrossNotifications.Current.GetBadge();
// 0 clears badge

Sounds

In the notification.Sound property - set only the filename without the extension

Android

  • Put the sound in your /Resources/raw/ folder - make sure the file properties is set to AndroidResource
  • You can pass the actual full sound path OR just the name... the plugin will figure it out!

iOS

  • Put the file in your iOS app bundle
  • The file format must be a .caf file (google this to see how to make one) - ie. afconvert -f caff -d aacl@22050 -c 1 sound.aiff soundFileName.caf

UWP

FAQ

  • Why are most methods async now?

  • iOS requires all UI based commands run on the UI thread. Notifications are part of UIKit and thus have this requirement. With all of my plugins, I try to manage the thread marshalling for you

  • Why can't I set a string as an identifier

  • Android needs an integer for how it sets identifiers

notifications's People

Contributors

aritchie avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.