Skip to content

Commit 80f9d86

Browse files
committed
Initial commit with code
1 parent 6a9fc90 commit 80f9d86

File tree

135 files changed

+40558
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+40558
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.suo
66
*.user
77
*.sln.docstates
8+
*.userprefs
89

910
# Build results
1011
[Dd]ebug/

README.md

+63-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,79 @@
1-
# Local Notifications Plugin for Xamarin and Windows
1+
# Local Notifications Plugin (Notifier)
22

3-
[![NuGet](https://img.shields.io/nuget/v/Xam.Plugins.Notifier.svg?label=NuGet)](https://www.nuget.org/packages/Xam.Plugins.Notifier/)
3+
[Update] Due to changes in the core operating systems this NuGet and Plugin is no longer supported.
44

5-
A consistent and easy way to show local notifications in Xamarin and Windows apps.
6-
7-
### Setup
8-
* Available on NuGet: [https://www.nuget.org/packages/Xam.Plugins.Notifier/](https://www.nuget.org/packages/Xam.Plugins.Notifier/)
9-
* Install in your PCL project and platform client projects.
5+
Notifier provides a consistent and easy way to show local notifications from within a native mobile app with a single line of code. Notifications are handled and displayed natively for each respective platform OS so they will appear in the notification center on iOS, Android and Windows Phone and will display a toast on Windows and Windows Phone.
106

117
**Platform Support**
128

139
|Platform|Supported|Version|
1410
| ------------------- | :-----------: | :------------------: |
1511
|Xamarin.iOS|Yes|iOS 7+|
12+
|Xamarin.iOS Unified|Yes|iOS 7+|
1613
|Xamarin.Android|Yes|API 10+|
1714
|Windows Phone Silverlight|Yes|8.1+|
1815
|Windows Phone RT|Yes|8.1+|
1916
|Windows Store RT|Yes|8.1+|
2017
|Windows 10 UWP|Yes|10+|
2118
|Xamarin.Mac|No||
2219

23-
### API Usage
20+
## Methods
21+
22+
```csharp
23+
/// <summary>
24+
/// Show a local notification
25+
/// </summary>
26+
/// <param name="title">Title of the notification</param>
27+
/// <param name="body">Body or description of the notification</param>
28+
/// <param name="id">Id of the notification</param>
29+
void Show(string title, string body, int id = 0);
30+
```
31+
32+
Timed Notification
33+
34+
```csharp
35+
/// <summary>
36+
/// Show a local notification at a specified time
37+
/// </summary>
38+
/// <param name="title">Title of the notification</param>
39+
/// <param name="body">Body or description of the notification</param>
40+
/// <param name="id">Id of the notification</param>
41+
/// <param name="notifyTime">Time to show notification</param>
42+
void Show(string title, string body, int id, DateTime notifyTime);
43+
```
44+
45+
Cancel Notification
46+
```csharp
47+
/// <summary>
48+
/// Cancel a local notification
49+
/// </summary>
50+
/// <param name="id">Id of the scheduled notification you'd like to cancel</param>
51+
void Cancel(int id);
52+
```
53+
54+
Usage:
55+
56+
Notifier.Current.Show("You've got mail", "You have 793 unread messages!");
57+
58+
59+
## Platform Specific Notes
60+
61+
Some platforms require some options to be set before it will display notifications.
62+
63+
### Windows and Windows Phone
64+
You must enable notifications in the app manifest by setting the "Toast capable" property to "Yes".
65+
66+
### iOS (as of iOS 8)
67+
You must get permission from the user to allow the app to show local notifications. Details on how to do this are here thanks to [Larry O'Brien](https://twitter.com/lobrien): [http://www.knowing.net/index.php/2014/07/03/local-notifications-in-ios-8-with-xamarin/](http://www.knowing.net/index.php/2014/07/03/local-notifications-in-ios-8-with-xamarin/)
68+
69+
### Android
70+
Currently, if the phone is re-booted then the pending notifications are not sent, you should save them out to settings and re-send on re-boot.
71+
72+
#### Notification Icon on Android
73+
You can set the notification Icon by setting the following property from inside your Android project:
74+
75+
```
76+
LocalNotificationsImplementation.NotificationIconId = Resrouce.Drawable.YOU_ICON_HERE
77+
```
78+
2479

25-
### Important

art/Xam.Plugins.Notifier.icon.png

9.54 KB
Loading
9.54 KB
Loading
150 KB
Loading

component.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
%YAML 1.2
2+
---
3+
id: localnotificationsplugin
4+
name: Local Notifications Plugin
5+
publisher: Ed Snider
6+
version: 1.0.1
7+
8+
summary: Notifier provides a consistent and easy way to show local notifications from within a native mobile app with a single line of code.
9+
docs-url: https://github.com/edsnider/Xamarin.Plugins
10+
publisher-url: https://github.com/edsnider/Xamarin.Plugins
11+
12+
details: README.md
13+
getting-started: README.md
14+
license: ../LICENSE
15+
16+
icons:
17+
- NuGet/localnotificationsplugin_128x128.png
18+
- NuGet/localnotificationsplugin_512x512.png
19+
20+
no_build: "true"
21+
is_shell: "true"
22+
packages:
23+
ios-unified: Xam.Plugins.Notifier,Version=1.0.1
24+
winphone-8.1: Xam.Plugins.Notifier,Version=1.0.1
25+
ios: Xam.Plugins.Notifier,Version=1.0.1
26+
android: Xam.Plugins.Notifier,Version=1.0.1
27+
28+
samples:
29+
- path: ../Samples/NotifierSample/NotifierSample.sln
30+
name: Xamarin.Forms Sample
31+
configuration: Release
32+
...

nuget/Xam.Plugins.Notifier.nuspec

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
3+
<metadata minClientVersion="2.8.1">
4+
<id>Xam.Plugins.Notifier</id>
5+
<version>2.0.2</version>
6+
<title>Local Notifications Plugin for Xamarin and Windows</title>
7+
<authors>Ed Snider, Krystin Stutesman, James Montemagno</authors>
8+
<owners>Ed Snider, Krystin Stutesman, James Montemagno</owners>
9+
<licenseUrl>https://github.com/edsnider/Xamarin.Plugins/blob/master/LICENSE</licenseUrl>
10+
<iconUrl>https://raw.githubusercontent.com/edsnider/Xamarin.Plugins/3c15d0084211d8b608f16f611fe064e9d5052f2e/Notifier/NuGet/Xam.Plugins.Notifier.icon.png</iconUrl>
11+
<projectUrl>https://github.com/edsnider/Xamarin.Plugins</projectUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<description>The local notification plugin provides a simple, cross-platform way to show local notifications from within native mobile applications. Works with Xamarin.Android, Xamarin.iOS (Classic and Unified), Windows 8.1, Windows Phone 8.1, and Windows Phone Silverlight 8.1.</description>
14+
<summary>Cross platform plugin to show local notifications.</summary>
15+
<tags>toast, alert, notifications, xamarin, winrt, pcl, winphone, wp8, android, ios, xam.plugins, xam.pcl</tags>
16+
<dependencies>
17+
<group targetFramework="MonoAndroid10">
18+
<dependency id="Xamarin.Android.Support.v4" version="23.0.1.3"/>
19+
</group>
20+
</dependencies>
21+
<releaseNotes>
22+
[2.0.2]
23+
-Fix issue with serializing schedule notification on Android
24+
-Auto clear future when tapped
25+
</releaseNotes>
26+
</metadata>
27+
<files>
28+
29+
<!--Core-->
30+
<file src="Plugin.LocalNotifications\bin\Release\Plugin.LocalNotifications.dll" target="lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.LocalNotifications.dll" />
31+
<file src="Plugin.LocalNotifications\bin\Release\Plugin.LocalNotifications.xml" target="lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.LocalNotifications.xml" />
32+
<file src="Plugin.LocalNotifications\bin\Release\Plugin.LocalNotifications.pdb" target="lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.LocalNotifications.pdb" />
33+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.LocalNotifications.Abstractions.dll" />
34+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.LocalNotifications.Abstractions.xml" />
35+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.pdb" target="lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.LocalNotifications.Abstractions.pdb" />
36+
37+
<!--Win Phone Silverlight-->
38+
<file src="Plugin.LocalNotifications.WinPhone\bin\Release\Plugin.LocalNotifications.dll" target="lib\wp8\Plugin.LocalNotifications.dll" />
39+
<file src="Plugin.LocalNotifications.WinPhone\bin\Release\Plugin.LocalNotifications.xml" target="lib\wp8\Plugin.LocalNotifications.xml" />
40+
<file src="Plugin.LocalNotifications.WinPhone\bin\Release\Plugin.LocalNotifications.pdb" target="lib\wp8\Plugin.LocalNotifications.pdb" />
41+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\wp8\Plugin.LocalNotifications.Abstractions.dll" />
42+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\wp8\Plugin.LocalNotifications.Abstractions.xml" />
43+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.pdb" target="lib\wp8\Plugin.LocalNotifications.Abstractions.pdb" />
44+
45+
<!--Win Phone 81-->
46+
<file src="Plugin.LocalNotifications.WinRT\bin\Release\Plugin.LocalNotifications.dll" target="lib\wpa81\Plugin.LocalNotifications.dll" />
47+
<file src="Plugin.LocalNotifications.WinRT\bin\Release\Plugin.LocalNotifications.xml" target="lib\wpa81\Plugin.LocalNotifications.xml" />
48+
<file src="Plugin.LocalNotifications.WinRT\bin\Release\Plugin.LocalNotifications.pdb" target="lib\wpa81\Plugin.LocalNotifications.pdb" />
49+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\wpa81\Plugin.LocalNotifications.Abstractions.dll" />
50+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\wpa81\Plugin.LocalNotifications.Abstractions.xml" />
51+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.pdb" target="lib\wpa81\Plugin.LocalNotifications.Abstractions.pdb" />
52+
53+
54+
<!--WinStore-->
55+
<file src="Plugin.LocalNotifications.WinRT\bin\Release\Plugin.LocalNotifications.dll" target="lib\win8\Plugin.LocalNotifications.dll" />
56+
<file src="Plugin.LocalNotifications.WinRT\bin\Release\Plugin.LocalNotifications.xml" target="lib\win8\Plugin.LocalNotifications.xml" />
57+
<file src="Plugin.LocalNotifications.WinRT\bin\Release\Plugin.LocalNotifications.pdb" target="lib\win8\Plugin.LocalNotifications.pdb" />
58+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\win8\Plugin.LocalNotifications.Abstractions.dll" />
59+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\win8\Plugin.LocalNotifications.Abstractions.xml" />
60+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.pdb" target="lib\win8\Plugin.LocalNotifications.Abstractions.pdb" />
61+
62+
63+
64+
<!--UWP-->
65+
<file src="Plugin.LocalNotifications.UWP\bin\Release\Plugin.LocalNotifications.dll" target="lib\UAP10\Plugin.LocalNotifications.dll" />
66+
<file src="Plugin.LocalNotifications.UWP\bin\Release\Plugin.LocalNotifications.xml" target="lib\UAP10\Plugin.LocalNotifications.xml" />
67+
<file src="Plugin.LocalNotifications.UWP\bin\Release\Plugin.LocalNotifications.pdb" target="lib\UAP10\Plugin.LocalNotifications.pdb" />
68+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\UAP10\Plugin.LocalNotifications.Abstractions.dll" />
69+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\UAP10\Plugin.LocalNotifications.Abstractions.xml" />
70+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.pdb" target="lib\UAP10\Plugin.LocalNotifications.Abstractions.pdb" />
71+
72+
73+
<!--Xamarin.Android-->
74+
<file src="Plugin.LocalNotifications.Android\bin\Release\Plugin.LocalNotifications.dll" target="lib\MonoAndroid10\Plugin.LocalNotifications.dll" />
75+
<file src="Plugin.LocalNotifications.Android\bin\Release\Plugin.LocalNotifications.xml" target="lib\MonoAndroid10\Plugin.LocalNotifications.xml" />
76+
<file src="Plugin.LocalNotifications.Android\bin\Release\Plugin.LocalNotifications.pdb" target="lib\MonoAndroid10\Plugin.LocalNotifications.pdb" />
77+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\MonoAndroid10\Plugin.LocalNotifications.Abstractions.dll" />
78+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\MonoAndroid10\Plugin.LocalNotifications.Abstractions.xml" />
79+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.pdb" target="lib\MonoAndroid10\Plugin.LocalNotifications.Abstractions.pdb" />
80+
81+
<!--Xamarin.iOS Unified-->
82+
<file src="Plugin.LocalNotifications.iOS\bin\iPhoneSimulator\Release\Plugin.LocalNotifications.dll" target="lib\Xamarin.iOS10\Plugin.LocalNotifications.dll" />
83+
<file src="Plugin.LocalNotifications.iOS\bin\iPhoneSimulator\Release\Plugin.LocalNotifications.xml" target="lib\Xamarin.iOS10\Plugin.LocalNotifications.xml" />
84+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.dll" target="lib\Xamarin.iOS10\Plugin.LocalNotifications.Abstractions.dll" />
85+
<file src="Plugin.LocalNotifications.Abstractions\bin\Release\Plugin.LocalNotifications.Abstractions.xml" target="lib\Xamarin.iOS10\Plugin.LocalNotifications.Abstractions.xml" />
86+
87+
</files>
88+
</package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with you package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

0 commit comments

Comments
 (0)