├── .gitignore
├── AzurePushNotifications.Shared
├── AzurePushNotifications.Shared.projitems
├── AzurePushNotifications.Shared.shproj
├── AzurePushNotificationsImplementation.cs
├── Properties
│ └── SharedAssemblyInfo.cs
└── PushNotificationCredentials.cs
├── AzurePushNotifications.nuspec
├── AzurePushNotificationsForXamarinForms.sln
├── CreateNuGetPackage.cmd
├── LICENSE
├── NuGet
└── nuget.exe
├── Plugin.AzurePushNotifications
├── Plugin.AzurePushNotifications.Abstractions
│ ├── IAzurePushNotifications.cs
│ ├── Plugin.AzurePushNotifications.Abstractions.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── ReceivedMessageEventArgs.cs
├── Plugin.AzurePushNotifications.Android
│ ├── AzurePushNotificationsImplementation.cs
│ ├── CrossAzurePushNotificationsPlatform.cs
│ ├── GCM
│ │ ├── Constants.cs
│ │ ├── GcmBroadcastReceiverBase.cs
│ │ ├── GcmClient.cs
│ │ └── GcmServiceBase.cs
│ ├── Plugin.AzurePushNotifications.Android.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── PushNotificationsBroadcastReceiver.cs
│ ├── PushNotificationsGcmService.cs
│ ├── Resources
│ │ └── Resource.Designer.cs
│ └── packages.config
├── Plugin.AzurePushNotifications.UWP
│ ├── AzurePushNotificationsImplementation.cs
│ ├── Plugin.AzurePushNotifications.UWP.csproj
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Plugin.Plugin.GoogleAnalytics.UWP.rd.xml
│ └── project.json
├── Plugin.AzurePushNotifications.WindowsPhone8
│ ├── AzurePushNotificationsImplementation.cs
│ ├── Plugin.AzurePushNotifications.WindowsPhone8.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── Plugin.AzurePushNotifications.WindowsPhone81
│ ├── AzurePushNotificationsImplementation.cs
│ ├── Plugin.AzurePushNotifications.WindowsPhone81.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── Plugin.AzurePushNotifications.WindowsStore
│ ├── AzurePushNotificationsImplementation.cs
│ ├── Plugin.AzurePushNotifications.WindowsStore.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
├── Plugin.AzurePushNotifications.iOS
│ ├── AzurePushNotificationsImplementation.cs
│ ├── CrossAzurePushNotificationsPlatform.cs
│ ├── Plugin.AzurePushNotifications.iOS.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── packages.config
└── Plugin.AzurePushNotifications
│ ├── AzurePushNotifications.cs
│ ├── AzurePushNotificationsImplementation.cs
│ ├── Plugin.AzurePushNotifications.csproj
│ ├── Properties
│ └── AssemblyInfo.cs
│ └── packages.config
├── README.md
├── TestFormsApp
├── TestFormsApp.Droid
│ ├── Assets
│ │ ├── AboutAssets.txt
│ │ └── Languages.csv
│ ├── MainActivity.cs
│ ├── Properties
│ │ ├── AndroidManifest.xml
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── AboutResources.txt
│ │ ├── Resource.Designer.cs
│ │ ├── drawable-hdpi
│ │ │ └── icon.png
│ │ ├── drawable-xhdpi
│ │ │ └── icon.png
│ │ ├── drawable-xxhdpi
│ │ │ └── icon.png
│ │ └── drawable
│ │ │ └── icon.png
│ ├── TestFormsApp.Droid.csproj
│ ├── TestFormsApp.Droid.csproj.bak
│ └── packages.config
├── TestFormsApp.UWP
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ └── Wide310x150Logo.scale-200.png
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ ├── TestFormsApp.UWP.csproj
│ └── project.json
├── TestFormsApp.WinPhone
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ │ ├── Logo.scale-240.png
│ │ ├── SmallLogo.scale-240.png
│ │ ├── SplashScreen.scale-240.png
│ │ ├── Square71x71Logo.scale-240.png
│ │ ├── StoreLogo.scale-240.png
│ │ └── WideLogo.scale-240.png
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── TestFormsApp.WinPhone.csproj
│ └── packages.config
├── TestFormsApp.Windows
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ │ ├── Logo.scale-100.png
│ │ ├── SmallLogo.scale-100.png
│ │ ├── SplashScreen.scale-100.png
│ │ └── StoreLogo.scale-100.png
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── TestFormsApp.Windows.csproj
│ └── packages.config
├── TestFormsApp.iOS
│ ├── AppDelegate.cs
│ ├── Entitlements.plist
│ ├── Info.plist
│ ├── Main.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── Default-568h@2x.png
│ │ ├── Default-Portrait.png
│ │ ├── Default-Portrait@2x.png
│ │ ├── Default.png
│ │ ├── Default@2x.png
│ │ ├── Icon-60@2x.png
│ │ ├── Icon-60@3x.png
│ │ ├── Icon-76.png
│ │ ├── Icon-76@2x.png
│ │ ├── Icon-Small-40.png
│ │ ├── Icon-Small-40@2x.png
│ │ ├── Icon-Small-40@3x.png
│ │ ├── Icon-Small.png
│ │ ├── Icon-Small@2x.png
│ │ ├── Icon-Small@3x.png
│ │ └── LaunchScreen.storyboard
│ ├── TestFormsApp.iOS.csproj
│ ├── iTunesArtwork
│ ├── iTunesArtwork@2x
│ └── packages.config
└── TestFormsApp
│ ├── App.cs
│ ├── GettingStarted.Xamarin
│ ├── TestFormsApp.projitems
│ └── TestFormsApp.shproj
└── icon.png
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.gitignore.io/api/windows,osx,visualstudio,visualstudiocode,xamarinstudio
3 |
4 | ### Windows ###
5 | # Windows image file caches
6 | Thumbs.db
7 | ehthumbs.db
8 |
9 | # Folder config file
10 | Desktop.ini
11 |
12 | # Recycle Bin used on file shares
13 | $RECYCLE.BIN/
14 |
15 | # Windows Installer files
16 | *.cab
17 | *.msi
18 | *.msm
19 | *.msp
20 |
21 | # Windows shortcuts
22 | *.lnk
23 |
24 |
25 | ### OSX ###
26 | .DS_Store
27 | .AppleDouble
28 | .LSOverride
29 |
30 | # Icon must end with two \r
31 | Icon
32 |
33 |
34 | # Thumbnails
35 | ._*
36 |
37 | # Files that might appear in the root of a volume
38 | .DocumentRevisions-V100
39 | .fseventsd
40 | .Spotlight-V100
41 | .TemporaryItems
42 | .Trashes
43 | .VolumeIcon.icns
44 | .com.apple.timemachine.donotpresent
45 |
46 | # Directories potentially created on remote AFP share
47 | .AppleDB
48 | .AppleDesktop
49 | Network Trash Folder
50 | Temporary Items
51 | .apdisk
52 |
53 |
54 | ### VisualStudio ###
55 | ## Ignore Visual Studio temporary files, build results, and
56 | ## files generated by popular Visual Studio add-ons.
57 |
58 | # User-specific files
59 | *.suo
60 | *.user
61 | *.userosscache
62 | *.sln.docstates
63 |
64 | # User-specific files (MonoDevelop/Xamarin Studio)
65 | *.userprefs
66 |
67 | # Build results
68 | [Dd]ebug/
69 | [Dd]ebugPublic/
70 | [Rr]elease/
71 | [Rr]eleases/
72 | x64/
73 | x86/
74 | bld/
75 | [Bb]in/
76 | [Oo]bj/
77 | [Ll]og/
78 |
79 | # Visual Studio 2015 cache/options directory
80 | .vs/
81 | # Uncomment if you have tasks that create the project's static files in wwwroot
82 | #wwwroot/
83 |
84 | # MSTest test Results
85 | [Tt]est[Rr]esult*/
86 | [Bb]uild[Ll]og.*
87 |
88 | # NUNIT
89 | *.VisualState.xml
90 | TestResult.xml
91 |
92 | # Build Results of an ATL Project
93 | [Dd]ebugPS/
94 | [Rr]eleasePS/
95 | dlldata.c
96 |
97 | # DNX
98 | project.lock.json
99 | artifacts/
100 |
101 | *_i.c
102 | *_p.c
103 | *_i.h
104 | *.ilk
105 | *.meta
106 | *.obj
107 | *.pch
108 | *.pdb
109 | *.pgc
110 | *.pgd
111 | *.rsp
112 | *.sbr
113 | *.tlb
114 | *.tli
115 | *.tlh
116 | *.tmp
117 | *.tmp_proj
118 | *.log
119 | *.vspscc
120 | *.vssscc
121 | .builds
122 | *.pidb
123 | *.svclog
124 | *.scc
125 |
126 | # Chutzpah Test files
127 | _Chutzpah*
128 |
129 | # Visual C++ cache files
130 | ipch/
131 | *.aps
132 | *.ncb
133 | *.opendb
134 | *.opensdf
135 | *.sdf
136 | *.cachefile
137 | *.VC.db
138 | *.VC.VC.opendb
139 |
140 | # Visual Studio profiler
141 | *.psess
142 | *.vsp
143 | *.vspx
144 | *.sap
145 |
146 | # TFS 2012 Local Workspace
147 | $tf/
148 |
149 | # Guidance Automation Toolkit
150 | *.gpState
151 |
152 | # ReSharper is a .NET coding add-in
153 | _ReSharper*/
154 | *.[Rr]e[Ss]harper
155 | *.DotSettings.user
156 |
157 | # JustCode is a .NET coding add-in
158 | .JustCode
159 |
160 | # TeamCity is a build add-in
161 | _TeamCity*
162 |
163 | # DotCover is a Code Coverage Tool
164 | *.dotCover
165 |
166 | # NCrunch
167 | _NCrunch_*
168 | .*crunch*.local.xml
169 | nCrunchTemp_*
170 |
171 | # MightyMoose
172 | *.mm.*
173 | AutoTest.Net/
174 |
175 | # Web workbench (sass)
176 | .sass-cache/
177 |
178 | # Installshield output folder
179 | [Ee]xpress/
180 |
181 | # DocProject is a documentation generator add-in
182 | DocProject/buildhelp/
183 | DocProject/Help/*.HxT
184 | DocProject/Help/*.HxC
185 | DocProject/Help/*.hhc
186 | DocProject/Help/*.hhk
187 | DocProject/Help/*.hhp
188 | DocProject/Help/Html2
189 | DocProject/Help/html
190 |
191 | # Click-Once directory
192 | publish/
193 |
194 | # Publish Web Output
195 | *.[Pp]ublish.xml
196 | *.azurePubxml
197 | # TODO: Comment the next line if you want to checkin your web deploy settings
198 | # but database connection strings (with potential passwords) will be unencrypted
199 | *.pubxml
200 | *.publishproj
201 |
202 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
203 | # checkin your Azure Web App publish settings, but sensitive information contained
204 | # in these scripts will be unencrypted
205 | PublishScripts/
206 |
207 | # NuGet Packages
208 | *.nupkg
209 | # The packages folder can be ignored because of Package Restore
210 | **/packages/*
211 | # except build/, which is used as an MSBuild target.
212 | !**/packages/build/
213 | # Uncomment if necessary however generally it will be regenerated when needed
214 | #!**/packages/repositories.config
215 | # NuGet v3's project.json files produces more ignoreable files
216 | *.nuget.props
217 | *.nuget.targets
218 |
219 | # Microsoft Azure Build Output
220 | csx/
221 | *.build.csdef
222 |
223 | # Microsoft Azure Emulator
224 | ecf/
225 | rcf/
226 |
227 | # Windows Store app package directories and files
228 | AppPackages/
229 | BundleArtifacts/
230 | Package.StoreAssociation.xml
231 | _pkginfo.txt
232 |
233 | # Visual Studio cache files
234 | # files ending in .cache can be ignored
235 | *.[Cc]ache
236 | # but keep track of directories ending in .cache
237 | !*.[Cc]ache/
238 |
239 | # Others
240 | ClientBin/
241 | ~$*
242 | *~
243 | *.dbmdl
244 | *.dbproj.schemaview
245 | *.pfx
246 | *.publishsettings
247 | node_modules/
248 | orleans.codegen.cs
249 |
250 | # Since there are multiple workflows, uncomment next line to ignore bower_components
251 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
252 | #bower_components/
253 |
254 | # RIA/Silverlight projects
255 | Generated_Code/
256 |
257 | # Backup & report files from converting an old project file
258 | # to a newer Visual Studio version. Backup files are not needed,
259 | # because we have git ;-)
260 | _UpgradeReport_Files/
261 | Backup*/
262 | UpgradeLog*.XML
263 | UpgradeLog*.htm
264 |
265 | # SQL Server files
266 | *.mdf
267 | *.ldf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 |
274 | # Microsoft Fakes
275 | FakesAssemblies/
276 |
277 | # GhostDoc plugin setting file
278 | *.GhostDoc.xml
279 |
280 | # Node.js Tools for Visual Studio
281 | .ntvs_analysis.dat
282 |
283 | # Visual Studio 6 build log
284 | *.plg
285 |
286 | # Visual Studio 6 workspace options file
287 | *.opt
288 |
289 | # Visual Studio LightSwitch build output
290 | **/*.HTMLClient/GeneratedArtifacts
291 | **/*.DesktopClient/GeneratedArtifacts
292 | **/*.DesktopClient/ModelManifest.xml
293 | **/*.Server/GeneratedArtifacts
294 | **/*.Server/ModelManifest.xml
295 | _Pvt_Extensions
296 |
297 | # Paket dependency manager
298 | .paket/paket.exe
299 | paket-files/
300 |
301 | # FAKE - F# Make
302 | .fake/
303 |
304 | # JetBrains Rider
305 | .idea/
306 | *.sln.iml
307 |
308 |
309 | ### VisualStudioCode ###
310 | .vscode
311 |
312 |
313 |
314 | ### XamarinStudio ###
315 | bin/
316 | obj/
317 | *.userprefs
318 |
319 | /Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/Plugin.AzurePushNotifications.Android.csproj.bak
320 | *.bak
321 | /.gitattributes
322 |
--------------------------------------------------------------------------------
/AzurePushNotifications.Shared/AzurePushNotifications.Shared.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | 2be19bda-c26e-4c6e-8b27-148ea06d2266
7 |
8 |
9 | AzurePushNotifications.Shared
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AzurePushNotifications.Shared/AzurePushNotifications.Shared.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2be19bda-c26e-4c6e-8b27-148ea06d2266
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/AzurePushNotifications.Shared/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Linq;
5 | using System.Net;
6 | using System.Runtime.CompilerServices;
7 | using System.Threading;
8 | using Plugin.AzurePushNotifications.Abstractions;
9 |
10 | namespace Plugin.AzurePushNotifications
11 | {
12 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
13 | {
14 | public event EventHandler OnMessageReceived;
15 | }
16 | }
--------------------------------------------------------------------------------
/AzurePushNotifications.Shared/Properties/SharedAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
3 |
4 | //General Information about an assembly is controlled through the following
5 | // set of attributes.Change these attribute values to modify the information
6 | // associated with an assembly.
7 |
8 | [assembly: AssemblyTitle("Plugin.AzurePushNotifications")]
9 | [assembly: AssemblyDescription("This project is a cross platform library for Xamarin Forms, which enables a handy use of Azure Push Notifications in your applications.")]
10 | [assembly: AssemblyCompany("ksemenenko")]
11 | [assembly: AssemblyProduct("Plugin.AzurePushNotifications")]
12 | [assembly: AssemblyCopyright("Copyright © K.Semenenko 2016")]
13 | [assembly: AssemblyTrademark("ksemenenko")]
14 | [assembly: AssemblyCulture("")]
15 | [assembly: NeutralResourcesLanguage("en")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 |
28 | [assembly: AssemblyVersion("1.0.0.0")]
29 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/AzurePushNotifications.Shared/PushNotificationCredentials.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Plugin.AzurePushNotifications
6 | {
7 | ///
8 | /// Contains credentials for accessing Microsoft Azure Push Notifications
9 | /// and Google Cloud Messaging.
10 | ///
11 | public class PushNotificationCredentials
12 | {
13 | ///
14 | /// Google API Project Number.
15 | ///
16 | public static string GoogleApiSenderId = string.Empty;
17 |
18 | ///
19 | /// The name of the Azure Notification Hub created inside Azure portal.
20 | ///
21 | public static string AzureNotificationHubName = string.Empty;
22 |
23 | ///
24 | /// The listen connection string found under "Connection Information"
25 | /// of the Notification Hub.
26 | ///
27 | public static string AzureListenConnectionString = string.Empty;
28 |
29 | ///
30 | /// The tags to register for with Azure Push Notifications.
31 | ///
32 | public static string[] Tags = new string[0];
33 | }
34 | }
--------------------------------------------------------------------------------
/CreateNuGetPackage.cmd:
--------------------------------------------------------------------------------
1 | .\NuGet\nuget.exe pack AzurePushNotifications.nuspec
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 ksemenenko
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NuGet/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/NuGet/nuget.exe
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Abstractions/IAzurePushNotifications.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Plugin.AzurePushNotifications.Abstractions
4 | {
5 | ///
6 | /// Interface for Plugin.AzurePushNotifications
7 | ///
8 | public interface IAzurePushNotifications
9 | {
10 | ///
11 | /// Registers for Azure Push Notification using
12 | /// the credentials provided in PushNotificationCredentials class.
13 | ///
14 | void RegisterForAzurePushNotification();
15 |
16 | ///
17 | /// Unregisters from Azure Push Notification using
18 | /// the credentials provided in PushNotificationCredentials class.
19 | ///
20 | void UnregisterFromAzurePushNotification();
21 |
22 | ///
23 | /// It's a new message
24 | ///
25 | event EventHandler OnMessageReceived;
26 | }
27 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Abstractions/Plugin.AzurePushNotifications.Abstractions.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 10.0
6 | Debug
7 | AnyCPU
8 | {6EDB0588-FFC5-4EF5-8A99-9E241D0F878D}
9 | Library
10 | Properties
11 | Plugin.AzurePushNotifications.Abstractions
12 | Plugin.AzurePushNotifications.Abstractions
13 | en-US
14 | 512
15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | Profile259
17 | v4.5
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | bin\Release\Plugin.AzurePushNotifications.Abstractions.xml
36 |
37 |
38 |
39 |
40 |
41 |
42 | Properties\SharedAssemblyInfo.cs
43 |
44 |
45 |
46 |
47 |
48 |
49 |
56 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Abstractions/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Abstractions/ReceivedMessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Plugin.AzurePushNotifications.Abstractions
8 | {
9 | public class ReceivedMessageEventArgs
10 | {
11 | ///
12 | ///
13 | ///
14 | ///
15 | public ReceivedMessageEventArgs(string content)
16 | {
17 | Content = content;
18 | RawContent = content;
19 | }
20 |
21 | ///
22 | ///
23 | ///
24 | ///
25 | ///
26 | public ReceivedMessageEventArgs(string content, object rawContent)
27 | {
28 | Content = content;
29 | RawContent = rawContent;
30 | }
31 |
32 | public string Content { get; }
33 |
34 | public object RawContent { get; }
35 | }
36 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Android.App;
4 | using Gcm.Client;
5 | using Plugin.AzurePushNotifications.Abstractions;
6 |
7 | namespace Plugin.AzurePushNotifications
8 | {
9 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
10 | {
11 | //https://azure.microsoft.com/en-us/documentation/articles/xamarin-notification-hubs-push-notifications-android-gcm/
12 |
13 | public void RegisterForAzurePushNotification()
14 | {
15 | if(GcmClient.MainActivity != null)
16 | {
17 | GcmClient.Register(GcmClient.MainActivity, PushNotificationCredentials.GoogleApiSenderId);
18 | }
19 | }
20 |
21 | public void UnregisterFromAzurePushNotification()
22 | {
23 | if(GcmClient.MainActivity != null)
24 | {
25 | GcmClient.UnRegister(GcmClient.MainActivity);
26 | }
27 | }
28 |
29 | public void Init(Activity activity)
30 | {
31 | try
32 | {
33 | GcmClient.CheckDevice(activity);
34 | GcmClient.CheckManifest(activity);
35 | GcmClient.MainActivity = activity;
36 | }
37 | catch(Exception ex)
38 | {
39 | //Logger.Debug(ex.Message);
40 | }
41 | }
42 |
43 | public void PushNotificationReceived(string content, object rawContent)
44 | {
45 | var conent = new ReceivedMessageEventArgs(content, rawContent);
46 | var message = OnMessageReceived;
47 | message?.Invoke(null, conent);
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/CrossAzurePushNotificationsPlatform.cs:
--------------------------------------------------------------------------------
1 | namespace Plugin.AzurePushNotifications
2 | {
3 | public partial class CrossAzurePushNotifications
4 | {
5 | ///
6 | /// Current settings to use
7 | ///
8 | public static AzurePushNotificationsImplementation Platform
9 | {
10 | get
11 | {
12 | var ret = Implementation.Value;
13 | if(ret == null)
14 | {
15 | throw NotImplementedInReferenceAssembly();
16 | }
17 | return (AzurePushNotificationsImplementation)ret;
18 | }
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/GCM/Constants.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 |
3 | [assembly: Permission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")] //, ProtectionLevel = Android.Content.PM.Protection.Signature)]
4 |
5 | [assembly: UsesPermission(Name = "@PACKAGE_NAME@.permission.C2D_MESSAGE")]
6 | [assembly: UsesPermission(Name = "com.google.android.c2dm.permission.RECEIVE")]
7 |
8 | //GET_ACCOUNTS is only needed for android versions 4.0.3 and below
9 |
10 | [assembly: UsesPermission(Name = "android.permission.GET_ACCOUNTS")]
11 | [assembly: UsesPermission(Name = "android.permission.INTERNET")]
12 | [assembly: UsesPermission(Name = "android.permission.WAKE_LOCK")]
13 |
14 | namespace Gcm.Client
15 | {
16 | public class Constants
17 | {
18 | public const string IntentToGcmRegistration = "com.google.android.c2dm.intent.REGISTER";
19 |
20 | ///
21 | /// Intent sent to GCM to unregister the application.
22 | ///
23 | public const string IntentToGcmUnregistration = "com.google.android.c2dm.intent.UNREGISTER";
24 |
25 | ///
26 | /// Intent sent by GCM indicating with the result of a registration request.
27 | ///
28 | public const string IntentFromGcmRegistrationCallback = "com.google.android.c2dm.intent.REGISTRATION";
29 |
30 | ///
31 | /// Intent used by the GCM library to indicate that the registration call
32 | /// should be retried.
33 | ///
34 | public const string IntentFromGcmLibraryRetry = "com.google.android.gcm.intent.RETRY";
35 |
36 | ///
37 | /// Intent sent by GCM containing a message.
38 | ///
39 | public const string IntentFromGcmMessage = "com.google.android.c2dm.intent.RECEIVE";
40 |
41 | ///
42 | /// Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to indicate the sender
43 | /// account (a Google email) that owns the application.
44 | ///
45 | public const string ExtraSender = "sender";
46 |
47 | ///
48 | /// Extra used on {@link #INTENT_TO_GCM_REGISTRATION} to get the application id.
49 | ///
50 | public const string ExtraApplicationPendingIntent = "app";
51 |
52 | ///
53 | /// Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
54 | /// that the application has been unregistered.
55 | ///
56 | public const string ExtraUnregistered = "unregistered";
57 |
58 | ///
59 | /// Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
60 | /// an error when the registration fails. See constants starting with ERROR_
61 | /// for possible values.
62 | ///
63 | public const string ExtraError = "error";
64 |
65 | ///
66 | /// Extra used on {@link #INTENT_FROM_GCM_REGISTRATION_CALLBACK} to indicate
67 | /// the registration id when the registration succeeds.
68 | ///
69 | public const string ExtraRegistrationId = "registration_id";
70 |
71 | ///
72 | /// Type of message present in the {@link #INTENT_FROM_GCM_MESSAGE} intent.
73 | /// This extra is only set for special messages sent from GCM, not for
74 | /// messages originated from the application.
75 | ///
76 | public const string ExtraSpecialMessage = "message_type";
77 |
78 | ///
79 | /// Special message indicating the server deleted the pending messages.
80 | ///
81 | public const string ValueDeletedMessages = "deleted_messages";
82 |
83 | ///
84 | /// Number of messages deleted by the server because the device was idle.
85 | /// Present only on messages of special type
86 | /// {@link #VALUE_DELETED_MESSAGES}
87 | ///
88 | public const string ExtraTotalDeleted = "total_deleted";
89 |
90 | ///
91 | /// Permission necessary to receive GCM intents.
92 | ///
93 | public const string PermissionGcmIntents = "com.google.android.c2dm.permission.SEND";
94 |
95 | ///
96 | /// @see GCMBroadcastReceiver
97 | ///
98 | public const string DefaultIntentServiceClassName = ".GCMIntentService";
99 |
100 | ///
101 | /// The device can't read the response, or there was a 500/503 from the
102 | /// server that can be retried later. The application should use exponential
103 | /// back off and retry.
104 | ///
105 | public const string ErrorServiceNotAvailable = "SERVICE_NOT_AVAILABLE";
106 |
107 | ///
108 | /// There is no Google account on the phone. The application should ask the
109 | /// user to open the account manager and add a Google account.
110 | ///
111 | public const string ErrorAccountMissing = "ACCOUNT_MISSING";
112 |
113 | ///
114 | /// Bad password. The application should ask the user to enter his/her
115 | /// password, and let user retry manually later. Fix on the device side.
116 | ///
117 | public const string ErrorAuthenticationFailed = "AUTHENTICATION_FAILED";
118 |
119 | ///
120 | /// The request sent by the phone does not contain the expected parameters.
121 | /// This phone doesn't currently support GCM.
122 | ///
123 | public const string ErrorInvalidParameters = "INVALID_PARAMETERS";
124 |
125 | ///
126 | /// The sender account is not recognized. Fix on the device side.
127 | ///
128 | public const string ErrorInvalidSender = "INVALID_SENDER";
129 |
130 | ///
131 | /// Incorrect phone registration with Google. This phone doesn't currently support GCM.
132 | ///
133 | public const string ErrorPhoneRegistrationError = "PHONE_REGISTRATION_ERROR";
134 | }
135 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/GCM/GcmBroadcastReceiverBase.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content;
3 |
4 | namespace Gcm.Client
5 | {
6 | public abstract class GcmBroadcastReceiverBase : BroadcastReceiver where TIntentService : GcmServiceBase
7 | {
8 | public override void OnReceive(Context context, Intent intent)
9 | {
10 | //Logger.Debug("OnReceive: " + intent.Action);
11 | var className = context.PackageName + Constants.DefaultIntentServiceClassName;
12 |
13 | //Logger.Debug("GCM IntentService Class: " + className);
14 |
15 | GcmServiceBase.RunIntentInService(context, intent, typeof(TIntentService));
16 | SetResult(Result.Ok, null, null);
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/GCM/GcmServiceBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using WindowsAzure.Messaging;
3 | using Android.App;
4 | using Android.Content;
5 | using Android.OS;
6 | using Android.Runtime;
7 | using Plugin.AzurePushNotifications;
8 |
9 | namespace Gcm.Client
10 | {
11 | [Preserve(AllMembers = true)]
12 | public abstract class GcmServiceBase : IntentService
13 | {
14 | private const string WakelockKey = "GCM_LIB";
15 |
16 | private const int MaxBackoffMs = 3600000; //1 hour
17 | private const string ExtraToken = "token";
18 | private static PowerManager.WakeLock sWakeLock;
19 |
20 | private static readonly object Lock = new object();
21 | private static int serviceId = 1;
22 |
23 | protected static NotificationHub Hub;
24 |
25 | private readonly Random sRandom = new Random();
26 |
27 | private readonly string token = "";
28 |
29 | ///
30 | /// The GCM Sender Ids to use. Set by the constructor taking parameters but not by the one that doesn't. Be very
31 | /// careful changing this value, preferably only set it in your constructor and only once.
32 | ///
33 | protected string[] SenderIds;
34 |
35 | protected GcmServiceBase()
36 | {
37 | SenderIds = new[] {PushNotificationCredentials.GoogleApiSenderId};
38 | }
39 |
40 | public GcmServiceBase(params string[] senderIds)
41 | : base("GCMIntentService-" + serviceId++)
42 | {
43 | SenderIds = senderIds;
44 | }
45 |
46 | protected virtual void OnMessage(Context context, Intent intent)
47 | {
48 | }
49 |
50 | protected virtual void OnDeletedMessages(Context context, int total)
51 | {
52 | }
53 |
54 | protected virtual bool OnRecoverableError(Context context, string errorId)
55 | {
56 | return true;
57 | }
58 |
59 | protected virtual void OnError(Context context, string errorId)
60 | {
61 | }
62 |
63 | protected virtual void OnRegistered(Context context, string registrationId)
64 | {
65 | Hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName, PushNotificationCredentials.AzureListenConnectionString, context);
66 | try
67 | {
68 | Hub.UnregisterAll(registrationId);
69 | }
70 | catch(Exception ex)
71 | {
72 | //Log.Error(PushNotificationsBroadcastReceiver.Tag, ex.Message);
73 | }
74 |
75 | try
76 | {
77 | var hubRegistration = Hub.Register(registrationId, PushNotificationCredentials.Tags);
78 | }
79 | catch(Exception ex)
80 | {
81 | //Log.Error(PushNotificationsBroadcastReceiver.Tag, ex.Message);
82 | }
83 | }
84 |
85 | protected virtual void OnUnRegistered(Context context, string registrationId)
86 | {
87 | Hub?.Unregister();
88 | }
89 |
90 | protected override void OnHandleIntent(Intent intent)
91 | {
92 | try
93 | {
94 | var context = ApplicationContext;
95 | var action = intent.Action;
96 |
97 | if(action.Equals(Constants.IntentFromGcmRegistrationCallback))
98 | {
99 | HandleRegistration(context, intent);
100 | }
101 | else if(action.Equals(Constants.IntentFromGcmMessage))
102 | {
103 | // checks for special messages
104 | var messageType = intent.GetStringExtra(Constants.ExtraSpecialMessage);
105 | if(messageType != null)
106 | {
107 | if(messageType.Equals(Constants.ValueDeletedMessages))
108 | {
109 | var sTotal = intent.GetStringExtra(Constants.ExtraTotalDeleted);
110 | if(!string.IsNullOrEmpty(sTotal))
111 | {
112 | var nTotal = 0;
113 | if(int.TryParse(sTotal, out nTotal))
114 | {
115 | //Logger.Debug("Received deleted messages notification: " + nTotal);
116 | OnDeletedMessages(context, nTotal);
117 | }
118 | }
119 | }
120 | }
121 | else
122 | {
123 | OnMessage(context, intent);
124 | }
125 | }
126 | else if(action.Equals(Constants.IntentFromGcmLibraryRetry))
127 | {
128 | var token = intent.GetStringExtra(ExtraToken);
129 |
130 | if(!string.IsNullOrEmpty(token) && !this.token.Equals(token))
131 | {
132 | // make sure intent was generated by this class, not by a
133 | // malicious app.
134 | //Logger.Debug("Received invalid token: " + token);
135 | return;
136 | }
137 |
138 | // retry last call
139 | if(GcmClient.IsRegistered(context))
140 | {
141 | GcmClient.InternalUnRegister(context);
142 | }
143 | else
144 | {
145 | GcmClient.InternalRegister(context, SenderIds);
146 | }
147 | }
148 | }
149 | finally
150 | {
151 | // Release the power lock, so phone can get back to sleep.
152 | // The lock is reference-counted by default, so multiple
153 | // messages are ok.
154 |
155 | // If OnMessage() needs to spawn a thread or do something else,
156 | // it should use its own lock.
157 | lock(Lock)
158 | {
159 | //Sanity check for null as this is a public method
160 | if(sWakeLock != null)
161 | {
162 | //Logger.Debug("Releasing Wakelock");
163 | sWakeLock.Release();
164 | }
165 | }
166 | }
167 | }
168 |
169 | internal static void RunIntentInService(Context context, Intent intent, Type classType)
170 | {
171 | lock(Lock)
172 | {
173 | if(sWakeLock == null)
174 | {
175 | // This is called from BroadcastReceiver, there is no init.
176 | var pm = PowerManager.FromContext(context);
177 | sWakeLock = pm.NewWakeLock(WakeLockFlags.Partial, WakelockKey);
178 | }
179 | }
180 |
181 | //Logger.Debug("Acquiring wakelock");
182 | sWakeLock.Acquire();
183 | //intent.SetClassName(context, className);
184 | intent.SetClass(context, classType);
185 |
186 | context.StartService(intent);
187 | }
188 |
189 | private void HandleRegistration(Context context, Intent intent)
190 | {
191 | var registrationId = intent.GetStringExtra(Constants.ExtraRegistrationId);
192 | var error = intent.GetStringExtra(Constants.ExtraError);
193 | var unregistered = intent.GetStringExtra(Constants.ExtraUnregistered);
194 |
195 | //Logger.Debug("handleRegistration: registrationId = " + registrationId + ", error = " + error + ", unregistered = " + unregistered);
196 |
197 | // registration succeeded
198 | if(registrationId != null)
199 | {
200 | GcmClient.ResetBackoff(context);
201 | GcmClient.SetRegistrationId(context, registrationId);
202 | OnRegistered(context, registrationId);
203 | return;
204 | }
205 |
206 | // unregistration succeeded
207 | if(unregistered != null)
208 | {
209 | // Remember we are unregistered
210 | GcmClient.ResetBackoff(context);
211 | var oldRegistrationId = GcmClient.ClearRegistrationId(context);
212 | OnUnRegistered(context, oldRegistrationId);
213 | return;
214 | }
215 |
216 | // last operation (registration or unregistration) returned an error;
217 | //Logger.Debug("Registration error: " + error);
218 | // Registration failed
219 | if(Constants.ErrorServiceNotAvailable.Equals(error))
220 | {
221 | var retry = OnRecoverableError(context, error);
222 |
223 | if(retry)
224 | {
225 | var backoffTimeMs = GcmClient.GetBackoff(context);
226 | var nextAttempt = backoffTimeMs/2 + sRandom.Next(backoffTimeMs);
227 |
228 | //Logger.Debug("Scheduling registration retry, backoff = " + nextAttempt + " (" + backoffTimeMs + ")");
229 |
230 | var retryIntent = new Intent(Constants.IntentFromGcmLibraryRetry);
231 | retryIntent.PutExtra(ExtraToken, token);
232 |
233 | var retryPendingIntent = PendingIntent.GetBroadcast(context, 0, retryIntent, PendingIntentFlags.OneShot);
234 |
235 | var am = AlarmManager.FromContext(context);
236 | am.Set(AlarmType.ElapsedRealtime, SystemClock.ElapsedRealtime() + nextAttempt, retryPendingIntent);
237 |
238 | // Next retry should wait longer.
239 | if(backoffTimeMs < MaxBackoffMs)
240 | {
241 | GcmClient.SetBackoff(context, backoffTimeMs*2);
242 | }
243 | }
244 | }
245 | else
246 | {
247 | // Unrecoverable error, notify app
248 | OnError(context, error);
249 | }
250 | }
251 | }
252 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/Plugin.AzurePushNotifications.Android.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {56A56F17-7DE1-4CA1-9617-BF32E971AC84}
9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Properties
12 | Plugin.AzurePushNotifications
13 | Plugin.AzurePushNotifications
14 | 512
15 | Resources\Resource.Designer.cs
16 | Off
17 | true
18 | True
19 | v7.1
20 |
21 |
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 | bin\Release\Plugin.AzurePushNotifications.xml
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | ..\..\packages\Xamarin.Azure.NotificationHubs.Android.0.4.0\lib\MonoAndroid403\Xamarin.Azure.NotificationHubs.Android.dll
51 | True
52 |
53 |
54 |
55 |
56 | AzurePushNotifications.cs
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | Properties\SharedAssemblyInfo.cs
67 |
68 |
69 |
70 |
71 |
72 |
73 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
74 | Plugin.AzurePushNotifications.Abstractions
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
89 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/PushNotificationsBroadcastReceiver.cs:
--------------------------------------------------------------------------------
1 | using Android;
2 | using Android.App;
3 | using Android.Content;
4 | using Gcm.Client;
5 |
6 | [assembly: UsesPermission(Manifest.Permission.ReceiveBootCompleted)]
7 |
8 | namespace Plugin.AzurePushNotifications
9 | {
10 | [BroadcastReceiver(Permission = Constants.PermissionGcmIntents)]
11 | [IntentFilter(new[] {Intent.ActionBootCompleted})] // Allow GCM on boot and when app is closed
12 | [IntentFilter(new[] {Constants.IntentFromGcmMessage}, Categories = new[] {"@PACKAGE_NAME@"})]
13 | [IntentFilter(new[] {Constants.IntentFromGcmRegistrationCallback}, Categories = new[] {"@PACKAGE_NAME@"})]
14 | [IntentFilter(new[] {Constants.IntentFromGcmLibraryRetry}, Categories = new[] {"@PACKAGE_NAME@"})]
15 | public class PushNotificationsBroadcastReceiver : GcmBroadcastReceiverBase
16 | {
17 | }
18 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/PushNotificationsGcmService.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using Android.App;
3 | using Android.Content;
4 | using Gcm.Client;
5 |
6 | namespace Plugin.AzurePushNotifications
7 | {
8 | [Service]
9 | public class PushNotificationsGcmService : GcmServiceBase
10 | {
11 | protected override void OnMessage(Context context, Intent intent)
12 | {
13 | var msg = new StringBuilder();
14 |
15 | if(intent != null && intent.Extras != null)
16 | {
17 | foreach(var key in intent.Extras.KeySet())
18 | {
19 | msg.AppendLine(key + "=" + intent.Extras.Get(key));
20 | }
21 | }
22 |
23 | var messageText = intent.Extras.GetString("message");
24 | if(!string.IsNullOrEmpty(messageText))
25 | {
26 | //createNotification("New hub message!", messageText);
27 | CrossAzurePushNotifications.Platform.PushNotificationReceived(messageText, messageText);
28 | }
29 | else
30 | {
31 | //createNotification("Unknown message details", msg.ToString());
32 | CrossAzurePushNotifications.Platform.PushNotificationReceived(msg.ToString(), intent.Extras);
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/Resources/Resource.Designer.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/Resources/Resource.Designer.cs
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.Android/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.UWP/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Windows.Networking.PushNotifications;
4 | using Microsoft.WindowsAzure.Messaging;
5 | using Plugin.AzurePushNotifications.Abstractions;
6 |
7 | namespace Plugin.AzurePushNotifications
8 | {
9 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
10 | {
11 | private PushNotificationChannel channel;
12 |
13 | public async void RegisterForAzurePushNotification()
14 | {
15 | if(channel != null)
16 | {
17 | channel.PushNotificationReceived -= Channel_PushNotificationReceived;
18 | }
19 |
20 | channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
21 |
22 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName,
23 | PushNotificationCredentials.AzureListenConnectionString);
24 |
25 | await hub.RegisterNativeAsync(channel.Uri, PushNotificationCredentials.Tags);
26 | channel.PushNotificationReceived += Channel_PushNotificationReceived;
27 | }
28 |
29 | public async void UnregisterFromAzurePushNotification()
30 | {
31 | if(channel != null)
32 | {
33 | channel.PushNotificationReceived -= Channel_PushNotificationReceived;
34 | }
35 |
36 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName,
37 | PushNotificationCredentials.AzureListenConnectionString);
38 |
39 | await hub.UnregisterNativeAsync();
40 | channel = null;
41 | }
42 |
43 | private void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
44 | {
45 | ReceivedMessageEventArgs content;
46 |
47 | switch (args.NotificationType)
48 | {
49 | case PushNotificationType.Badge:
50 | content = new ReceivedMessageEventArgs(args.BadgeNotification?.Content.GetXml() ?? string.Empty, args.BadgeNotification);
51 | break;
52 | case PushNotificationType.Tile:
53 | content = new ReceivedMessageEventArgs(args.TileNotification?.Content.GetXml() ?? string.Empty, args.TileNotification);
54 | break;
55 | case PushNotificationType.Toast:
56 | content = new ReceivedMessageEventArgs(args.ToastNotification?.Content.GetXml() ?? string.Empty, args.ToastNotification);
57 | break;
58 |
59 | case PushNotificationType.Raw:
60 | content = new ReceivedMessageEventArgs(args.RawNotification?.Content ?? string.Empty, args.RawNotification);
61 | args.Cancel = true;
62 | break;
63 |
64 | default:
65 | content = new ReceivedMessageEventArgs(string.Empty);
66 | break;
67 | }
68 |
69 | var message = OnMessageReceived;
70 | message?.Invoke(null, content);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.UWP/Plugin.AzurePushNotifications.UWP.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E34B516D-C0D8-450F-9DB0-BB6A5B04AEF1}
8 | Library
9 | Properties
10 | Plugin.AzurePushNotifications
11 | Plugin.AzurePushNotifications
12 | en-US
13 | UAP
14 | 10.0.10586.0
15 | 10.0.10240.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | prompt
37 | 4
38 | bin\Release\Plugin.AzurePushNotifications.xml
39 |
40 |
41 | x86
42 | true
43 | bin\x86\Debug\
44 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
45 | ;2008
46 | full
47 | x86
48 | false
49 | prompt
50 |
51 |
52 | x86
53 | bin\Release\
54 | TRACE;NETFX_CORE;WINDOWS_UWP
55 | true
56 | ;2008
57 | pdbonly
58 | x86
59 | false
60 | prompt
61 | bin\Release\Plugin.AzurePushNotifications.xml
62 |
63 |
64 | ARM
65 | true
66 | bin\ARM\Debug\
67 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
68 | ;2008
69 | full
70 | ARM
71 | false
72 | prompt
73 |
74 |
75 | ARM
76 | bin\ARM\Release\
77 | TRACE;NETFX_CORE;WINDOWS_UWP
78 | true
79 | ;2008
80 | pdbonly
81 | ARM
82 | false
83 | prompt
84 |
85 |
86 | x64
87 | true
88 | bin\x64\Debug\
89 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
90 | ;2008
91 | full
92 | x64
93 | false
94 | prompt
95 |
96 |
97 | x64
98 | bin\x64\Release\
99 | TRACE;NETFX_CORE;WINDOWS_UWP
100 | true
101 | ;2008
102 | pdbonly
103 | x64
104 | false
105 | prompt
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 | AzurePushNotifications.cs
114 |
115 |
116 |
117 |
118 | Properties\SharedAssemblyInfo.cs
119 |
120 |
121 |
122 |
123 | Windows Desktop Extensions for the UWP
124 |
125 |
126 | Windows IoT Extensions for the UWP
127 |
128 |
129 | Windows Mobile Extensions for the UWP
130 |
131 |
132 | Windows Team Extensions for the UWP
133 |
134 |
135 |
136 |
137 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
138 | Plugin.AzurePushNotifications.Abstractions
139 |
140 |
141 |
142 |
143 | 14.0
144 |
145 |
146 |
153 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.UWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.UWP/Properties/Plugin.Plugin.GoogleAnalytics.UWP.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.UWP/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.4.0",
4 | "WindowsAzure.Messaging.Managed": "0.1.7.9"
5 | },
6 | "frameworks": {
7 | "uap10.0.10240": {}
8 | },
9 | "runtimes": {
10 | "win10-arm": {},
11 | "win10-arm-aot": {},
12 | "win10-x86": {},
13 | "win10-x86-aot": {},
14 | "win10-x64": {},
15 | "win10-x64-aot": {}
16 | }
17 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone8/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Linq;
3 | using Microsoft.Phone.Notification;
4 | using Microsoft.WindowsAzure.Messaging;
5 | using Plugin.AzurePushNotifications.Abstractions;
6 |
7 | namespace Plugin.AzurePushNotifications
8 | {
9 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
10 | {
11 | public void RegisterForAzurePushNotification()
12 | {
13 | var channel = HttpNotificationChannel.Find("MyPushChannel");
14 | if(channel == null)
15 | {
16 | channel = new HttpNotificationChannel("MyPushChannel");
17 | channel.Open();
18 | channel.BindToShellToast();
19 |
20 | channel.ChannelUriUpdated += async (o, args) =>
21 | {
22 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName, PushNotificationCredentials.AzureListenConnectionString);
23 |
24 | await hub.RegisterNativeAsync(args.ChannelUri.ToString(), PushNotificationCredentials.Tags);
25 | };
26 | }
27 | channel.ShellToastNotificationReceived += Channel_ShellToastNotificationReceived;
28 | }
29 |
30 | public void UnregisterFromAzurePushNotification()
31 | {
32 | var channel = HttpNotificationChannel.Find("MyPushChannel");
33 | if(channel == null)
34 | {
35 | channel = new HttpNotificationChannel("MyPushChannel");
36 | channel.Open();
37 | channel.BindToShellToast();
38 | }
39 |
40 | channel.ChannelUriUpdated += async (o, args) =>
41 | {
42 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName, PushNotificationCredentials.AzureListenConnectionString);
43 |
44 | await hub.UnregisterNativeAsync();
45 | await hub.UnregisterAllAsync(args.ChannelUri.ToString());
46 | };
47 |
48 | channel.ShellToastNotificationReceived -= Channel_ShellToastNotificationReceived;
49 | }
50 |
51 | private void Channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
52 | {
53 | var conent = new ReceivedMessageEventArgs(string.Join(";", e?.Collection?.Select(x => x.Key + "=" + x.Value).ToArray() ?? new [] {string.Empty}),e?.Collection);
54 | var message = OnMessageReceived;
55 | message?.Invoke(null, conent);
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone8/Plugin.AzurePushNotifications.WindowsPhone8.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 10.0.20506
7 | 2.0
8 | {5876144B-47DD-4C4E-B421-BC03F191B996}
9 | {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
10 | Library
11 | Properties
12 | Plugin.AzurePushNotifications
13 | Plugin.AzurePushNotifications
14 | WindowsPhone
15 | v8.0
16 | $(TargetFrameworkVersion)
17 | false
18 | true
19 | 11.0
20 | true
21 |
22 |
23 |
24 |
25 | true
26 | full
27 | false
28 | Bin\Debug
29 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
30 | true
31 | true
32 | prompt
33 | 4
34 |
35 |
36 | pdbonly
37 | true
38 | Bin\Release
39 | TRACE;SILVERLIGHT;WINDOWS_PHONE
40 | true
41 | true
42 | prompt
43 | 4
44 | Bin\Release\Plugin.AzurePushNotifications.XML
45 |
46 |
47 | true
48 | full
49 | false
50 | Bin\x86\Debug
51 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
52 | true
53 | true
54 | prompt
55 | 4
56 |
57 |
58 | pdbonly
59 | true
60 | Bin\Release
61 | TRACE;SILVERLIGHT;WINDOWS_PHONE
62 | true
63 | true
64 | prompt
65 | 4
66 | bin\Release\Plugin.AzurePushNotifications.XML
67 |
68 |
69 | true
70 | full
71 | false
72 | Bin\ARM\Debug
73 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
74 | true
75 | true
76 | prompt
77 | 4
78 |
79 |
80 | pdbonly
81 | true
82 | Bin\ARM\Release
83 | TRACE;SILVERLIGHT;WINDOWS_PHONE
84 | true
85 | true
86 | prompt
87 | 4
88 |
89 |
90 |
91 | AzurePushNotifications.cs
92 |
93 |
94 |
95 |
96 | Properties\SharedAssemblyInfo.cs
97 |
98 |
99 |
100 |
101 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
102 | Plugin.AzurePushNotifications.Abstractions
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | ..\..\packages\WindowsAzure.Messaging.Managed.0.1.7.9\lib\windowsphone8\Microsoft.WindowsAzure.Messaging.dll
111 | True
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
122 |
123 |
124 |
125 |
132 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone8/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using System.Resources;
5 |
6 | // Setting ComVisible to false makes the types in this assembly not visible
7 | // to COM components. If you need to access a type in this assembly from
8 | // COM, set the ComVisible attribute to true on that type.
9 |
10 | [assembly: ComVisible(false)]
11 |
12 | // The following GUID is for the ID of the typelib if this project is exposed to COM
13 |
14 | [assembly: Guid("5876144b-47dd-4c4e-b421-bc03f191b996")]
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone8/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone81/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Windows.Networking.PushNotifications;
4 | using Microsoft.WindowsAzure.Messaging;
5 | using Plugin.AzurePushNotifications.Abstractions;
6 |
7 | namespace Plugin.AzurePushNotifications
8 | {
9 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
10 | {
11 | private PushNotificationChannel channel;
12 |
13 | public async void RegisterForAzurePushNotification()
14 | {
15 | if(channel != null)
16 | {
17 | channel.PushNotificationReceived -= Channel_PushNotificationReceived;
18 | }
19 |
20 | channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
21 |
22 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName,
23 | PushNotificationCredentials.AzureListenConnectionString);
24 |
25 | try
26 | {
27 | await hub.RegisterNativeAsync(channel.Uri, PushNotificationCredentials.Tags);
28 | channel.PushNotificationReceived += Channel_PushNotificationReceived;
29 | }
30 | catch(Exception ex)
31 | {
32 | Debug.WriteLine(ex);
33 | }
34 | }
35 |
36 | public async void UnregisterFromAzurePushNotification()
37 | {
38 | if(channel != null)
39 | {
40 | channel.PushNotificationReceived -= Channel_PushNotificationReceived;
41 | }
42 |
43 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName,
44 | PushNotificationCredentials.AzureListenConnectionString);
45 |
46 | await hub.UnregisterNativeAsync();
47 |
48 | channel = null;
49 | }
50 |
51 | private void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
52 | {
53 | ReceivedMessageEventArgs content;
54 |
55 | switch (args.NotificationType)
56 | {
57 | case PushNotificationType.Badge:
58 | content = new ReceivedMessageEventArgs(args.BadgeNotification?.Content.GetXml() ?? string.Empty, args.BadgeNotification);
59 | break;
60 | case PushNotificationType.Tile:
61 | content = new ReceivedMessageEventArgs(args.TileNotification?.Content.GetXml() ?? string.Empty, args.TileNotification);
62 | break;
63 | case PushNotificationType.Toast:
64 | content = new ReceivedMessageEventArgs(args.ToastNotification?.Content.GetXml() ?? string.Empty, args.ToastNotification);
65 | break;
66 |
67 | case PushNotificationType.Raw:
68 | content = new ReceivedMessageEventArgs(args.RawNotification?.Content ?? string.Empty, args.RawNotification);
69 | args.Cancel = true;
70 | break;
71 |
72 | default:
73 | content = new ReceivedMessageEventArgs(string.Empty);
74 | break;
75 | }
76 |
77 | var message = OnMessageReceived;
78 | message?.Invoke(null, content);
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone81/Plugin.AzurePushNotifications.WindowsPhone81.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 8.0.30703
8 | 2.0
9 | {7169373F-0B82-4E5D-9129-7CC3065B90FA}
10 | Library
11 | Properties
12 | Plugin.AzurePushNotifications
13 | Plugin.AzurePushNotifications
14 | en-US
15 | 8.1
16 | 12
17 | 512
18 | {76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 |
22 |
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
28 | prompt
29 | 4
30 |
31 |
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
36 | prompt
37 | 4
38 | bin\Release\Plugin.AzurePushNotifications.XML
39 |
40 |
41 | true
42 | bin\ARM\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
44 | ;2008
45 | full
46 | ARM
47 | false
48 | prompt
49 | true
50 |
51 |
52 | bin\ARM\Release\
53 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
54 | true
55 | ;2008
56 | pdbonly
57 | ARM
58 | false
59 | prompt
60 | true
61 |
62 |
63 | true
64 | bin\x86\Debug\
65 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
66 | ;2008
67 | full
68 | x86
69 | false
70 | prompt
71 | true
72 |
73 |
74 | bin\Release\
75 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
76 | true
77 | ;2008
78 | pdbonly
79 | x86
80 | false
81 | prompt
82 | bin\Release\Plugin.AzurePushNotifications.XML
83 |
84 |
85 |
86 |
87 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
88 | Plugin.AzurePushNotifications.Abstractions
89 |
90 |
91 |
92 |
93 | AzurePushNotifications.cs
94 |
95 |
96 |
97 |
98 | Properties\SharedAssemblyInfo.cs
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | ..\..\packages\WindowsAzure.Messaging.Managed.0.1.7.9\lib\wpa81\Microsoft.WindowsAzure.Messaging.Managed.dll
107 | True
108 |
109 |
110 |
111 |
112 | 12.0
113 |
114 |
115 | WindowsPhoneApp
116 |
117 |
118 |
119 |
120 |
121 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
122 |
123 |
124 |
125 |
132 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone81/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsPhone81/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsStore/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Windows.Networking.PushNotifications;
4 | using Microsoft.WindowsAzure.Messaging;
5 | using Plugin.AzurePushNotifications.Abstractions;
6 |
7 | namespace Plugin.AzurePushNotifications
8 | {
9 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
10 | {
11 | private PushNotificationChannel channel;
12 |
13 | public async void RegisterForAzurePushNotification()
14 | {
15 | if(channel != null)
16 | {
17 | channel.PushNotificationReceived -= Channel_PushNotificationReceived;
18 | }
19 |
20 | channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
21 |
22 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName,
23 | PushNotificationCredentials.AzureListenConnectionString);
24 |
25 | await hub.RegisterNativeAsync(channel.Uri, PushNotificationCredentials.Tags);
26 |
27 | channel.PushNotificationReceived += Channel_PushNotificationReceived;
28 | }
29 |
30 | public async void UnregisterFromAzurePushNotification()
31 | {
32 | if(channel != null)
33 | {
34 | channel.PushNotificationReceived -= Channel_PushNotificationReceived;
35 | }
36 |
37 | var hub = new NotificationHub(PushNotificationCredentials.AzureNotificationHubName,
38 | PushNotificationCredentials.AzureListenConnectionString);
39 |
40 | await hub.UnregisterNativeAsync();
41 |
42 | channel = null;
43 | }
44 |
45 | private void Channel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
46 | {
47 | ReceivedMessageEventArgs content;
48 |
49 | switch(args.NotificationType)
50 | {
51 | case PushNotificationType.Badge:
52 | content = new ReceivedMessageEventArgs(args.BadgeNotification?.Content.GetXml() ?? string.Empty, args.BadgeNotification);
53 | break;
54 | case PushNotificationType.Tile:
55 | content = new ReceivedMessageEventArgs(args.TileNotification?.Content.GetXml() ?? string.Empty, args.TileNotification);
56 | break;
57 | case PushNotificationType.Toast:
58 | content = new ReceivedMessageEventArgs(args.ToastNotification?.Content.GetXml() ?? string.Empty, args.ToastNotification);
59 | break;
60 |
61 | case PushNotificationType.Raw:
62 | content = new ReceivedMessageEventArgs(args.RawNotification?.Content ?? string.Empty, args.RawNotification);
63 | args.Cancel = true;
64 | break;
65 |
66 | default:
67 | content = new ReceivedMessageEventArgs(string.Empty);
68 | break;
69 | }
70 |
71 | var message = OnMessageReceived;
72 | message?.Invoke(null, content);
73 | }
74 | }
75 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsStore/Plugin.AzurePushNotifications.WindowsStore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | 8.0.30703
8 | 2.0
9 | {ED9A4CA1-C04C-457D-9A2E-7995CCF12356}
10 | Library
11 | Properties
12 | Plugin.AzurePushNotifications
13 | Plugin.AzurePushNotifications
14 | en-US
15 | 8.1
16 | 12
17 | 512
18 | {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 |
22 |
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
28 | prompt
29 | 4
30 |
31 |
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_APP
36 | prompt
37 | 4
38 | bin\Release\Plugin.AzurePushNotifications.XML
39 |
40 |
41 | true
42 | bin\ARM\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
44 | ;2008
45 | full
46 | ARM
47 | false
48 | prompt
49 | true
50 |
51 |
52 | bin\ARM\Release\
53 | TRACE;NETFX_CORE;WINDOWS_APP
54 | true
55 | ;2008
56 | pdbonly
57 | ARM
58 | false
59 | prompt
60 | true
61 |
62 |
63 | true
64 | bin\x64\Debug\
65 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
66 | ;2008
67 | full
68 | x64
69 | false
70 | prompt
71 | true
72 |
73 |
74 | bin\x64\Release\
75 | TRACE;NETFX_CORE;WINDOWS_APP
76 | true
77 | ;2008
78 | pdbonly
79 | x64
80 | false
81 | prompt
82 | true
83 |
84 |
85 | true
86 | bin\x86\Debug\
87 | DEBUG;TRACE;NETFX_CORE;WINDOWS_APP
88 | ;2008
89 | full
90 | x86
91 | false
92 | prompt
93 | true
94 |
95 |
96 | bin\Release\
97 | TRACE;NETFX_CORE;WINDOWS_APP
98 | true
99 | ;2008
100 | pdbonly
101 | x86
102 | false
103 | prompt
104 | bin\Release\Plugin.AzurePushNotifications.XML
105 |
106 |
107 |
108 |
109 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
110 | Plugin.AzurePushNotifications.Abstractions
111 |
112 |
113 |
114 |
115 | AzurePushNotifications.cs
116 |
117 |
118 | Properties\SharedAssemblyInfo.cs
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 | ..\..\packages\WindowsAzure.Messaging.Managed.0.1.7.9\lib\netcore45\Microsoft.WindowsAzure.Messaging.Managed.dll
129 | True
130 |
131 |
132 |
133 |
134 | 12.0
135 |
136 |
137 |
138 |
139 |
140 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
141 |
142 |
143 |
144 |
151 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsStore/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.WindowsStore/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.iOS/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using WindowsAzure.Messaging;
4 | using Foundation;
5 | using Plugin.AzurePushNotifications.Abstractions;
6 | using UIKit;
7 |
8 | namespace Plugin.AzurePushNotifications
9 | {
10 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
11 | {
12 | //https://azure.microsoft.com/en-us/documentation/articles/xamarin-notification-hubs-ios-push-notification-apns-get-started/
13 | private SBNotificationHub Hub { get; set; }
14 |
15 | public void RegisterForAzurePushNotification()
16 | {
17 | if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
18 | {
19 | var authOptions = UserNotifications.UNAuthorizationOptions.Alert | UserNotifications.UNAuthorizationOptions.Badge | UserNotifications.UNAuthorizationOptions.Sound;
20 | UserNotifications.UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) =>
21 | {
22 | Console.WriteLine(granted);
23 | });
24 | UIApplication.SharedApplication.RegisterForRemoteNotifications();
25 | }
26 | else if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
27 | {
28 | var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, new NSSet());
29 | UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
30 | UIApplication.SharedApplication.RegisterForRemoteNotifications();
31 | }
32 | else
33 | {
34 | var notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
35 | UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
36 | }
37 | }
38 |
39 | public void UnregisterFromAzurePushNotification()
40 | {
41 | UIApplication.SharedApplication.UnregisterForRemoteNotifications();
42 | }
43 |
44 | public void RegisteredForRemoteNotifications(NSData deviceToken)
45 | {
46 | Console.WriteLine("deviceToken: " + deviceToken);
47 |
48 | Hub = new SBNotificationHub(PushNotificationCredentials.AzureListenConnectionString, PushNotificationCredentials.AzureNotificationHubName);
49 |
50 | Hub.UnregisterAllAsync(deviceToken, error =>
51 | {
52 | if (error != null)
53 | {
54 | Console.WriteLine("Error calling Unregister: {0}", error.ToString());
55 | return;
56 | }
57 |
58 | NSSet tags = new NSSet(PushNotificationCredentials.Tags);
59 |
60 | Hub.RegisterNativeAsync(deviceToken, tags, errorCallback =>
61 | {
62 | if (errorCallback != null)
63 | {
64 | Console.WriteLine("RegisterNativeAsync error: " + errorCallback.ToString());
65 | }
66 | });
67 | });
68 | }
69 |
70 | public void ProcessNotification(NSDictionary options)
71 | {
72 | // Check to see if the dictionary has the aps key. This is the notification payload you would have sent
73 | if (null != options && options.ContainsKey(new NSString("aps")))
74 | {
75 | //Get the aps dictionary
76 | var aps = options.ObjectForKey(new NSString("aps")) as NSDictionary;
77 |
78 | var alert = string.Empty;
79 |
80 | //Extract the alert text
81 | // NOTE: If you're using the simple alert by just specifying
82 | // " aps:{alert:"alert msg here"} ", this will work fine.
83 | // But if you're using a complex alert with Localization keys, etc.,
84 | // your "alert" object from the aps dictionary will be another NSDictionary.
85 | // Basically the JSON gets dumped right into a NSDictionary,
86 | // so keep that in mind.
87 | if (aps.ContainsKey(new NSString("alert")))
88 | {
89 | alert = (aps[new NSString("alert")] as NSString) ?? string.Empty;
90 | }
91 |
92 | //If this came from the ReceivedRemoteNotification while the app was running,
93 | // we of course need to manually process things like the sound, badge, and alert.
94 |
95 | //Manually show an alert
96 | //if (!string.IsNullOrEmpty(alert))
97 | //{
98 | // var avAlert = new UIAlertView("Notification", alert, null, "OK", null);
99 | // avAlert.Show();
100 | //}
101 |
102 | var content = new ReceivedMessageEventArgs(alert, options);
103 | var message = OnMessageReceived;
104 | message?.Invoke(null, content);
105 | }
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.iOS/CrossAzurePushNotificationsPlatform.cs:
--------------------------------------------------------------------------------
1 | namespace Plugin.AzurePushNotifications
2 | {
3 | public partial class CrossAzurePushNotifications
4 | {
5 | ///
6 | /// Current settings to use
7 | ///
8 | public static AzurePushNotificationsImplementation Platform
9 | {
10 | get
11 | {
12 | var ret = Implementation.Value;
13 | if(ret == null)
14 | {
15 | throw NotImplementedInReferenceAssembly();
16 | }
17 | return (AzurePushNotificationsImplementation)ret;
18 | }
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.iOS/Plugin.AzurePushNotifications.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {2882AEEB-D4CD-4EB9-8A6C-6653B33681F0}
9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Plugin.AzurePushNotifications
12 | Resources
13 | Plugin.AzurePushNotifications
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG
21 | prompt
22 | 4
23 | false
24 | true
25 | iPhone Developer
26 |
27 |
28 | none
29 | true
30 | bin\Release\
31 | prompt
32 | 4
33 | false
34 | iPhone Developer
35 | bin\Release\Plugin.AzurePushNotifications.xml
36 |
37 |
38 |
39 | AzurePushNotifications.cs
40 |
41 |
42 |
43 |
44 |
45 | Properties\SharedAssemblyInfo.cs
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | ..\..\packages\Xamarin.Azure.NotificationHubs.iOS.1.2.5.2\lib\Xamarin.iOS10\Xamarin.Azure.NotificationHubs.iOS.dll
55 | True
56 |
57 |
58 |
59 |
60 |
61 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
62 | Plugin.AzurePushNotifications.Abstractions
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.iOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Setting ComVisible to false makes the types in this assembly not visible
6 | // to COM components. If you need to access a type in this assembly from
7 | // COM, set the ComVisible attribute to true on that type.
8 |
9 | [assembly: ComVisible(false)]
10 |
11 | // The following GUID is for the ID of the typelib if this project is exposed to COM
12 |
13 | [assembly: Guid("38453772-383c-4ada-845b-100c5b84f50a")]
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.iOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications/AzurePushNotifications.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Plugin.AzurePushNotifications.Abstractions;
4 |
5 | namespace Plugin.AzurePushNotifications
6 | {
7 | ///
8 | /// Cross platform Plugin.AzurePushNotifications implemenations
9 | ///
10 | public partial class CrossAzurePushNotifications
11 | {
12 | private static readonly Lazy Implementation =
13 | new Lazy(CreatePluginAzurePushNotifications, LazyThreadSafetyMode.PublicationOnly);
14 |
15 | ///
16 | /// Current settings to use
17 | ///
18 | public static IAzurePushNotifications Current
19 | {
20 | get
21 | {
22 | var ret = Implementation.Value;
23 | if(ret == null)
24 | {
25 | throw NotImplementedInReferenceAssembly();
26 | }
27 | return ret;
28 | }
29 | }
30 |
31 | private static IAzurePushNotifications CreatePluginAzurePushNotifications()
32 | {
33 | return new AzurePushNotificationsImplementation();
34 | }
35 |
36 | private static Exception NotImplementedInReferenceAssembly()
37 | {
38 | return
39 | new NotImplementedException(
40 | "This functionality is not implemented in the portable version of this assembly. " +
41 | "You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications/AzurePushNotificationsImplementation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Globalization;
4 | using System.Runtime.CompilerServices;
5 | using System.Threading;
6 | using Plugin.AzurePushNotifications.Abstractions;
7 |
8 | namespace Plugin.AzurePushNotifications
9 | {
10 | public partial class AzurePushNotificationsImplementation : IAzurePushNotifications
11 | {
12 | public void RegisterForAzurePushNotification()
13 | {
14 | throw new NotImplementedException();
15 | }
16 |
17 | public void UnregisterFromAzurePushNotification()
18 | {
19 | throw new NotImplementedException();
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 10.0
6 | Debug
7 | AnyCPU
8 | {A6FCEF44-D2BA-42C7-B3CB-13667BCD7B54}
9 | Library
10 | Properties
11 | Plugin.AzurePushNotifications
12 | Plugin.AzurePushNotifications
13 | en-US
14 | 512
15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | Profile259
17 | v4.5
18 |
19 |
20 |
21 |
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | TRACE;DEBUG;PORTABLE
27 | prompt
28 | 4
29 |
30 |
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE;PORTABLE
35 | prompt
36 | 4
37 | bin\Release\Plugin.AzurePushNotifications.xml
38 |
39 |
40 |
41 |
42 |
43 | Properties\SharedAssemblyInfo.cs
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
53 | Plugin.AzurePushNotifications.Abstractions
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
63 |
64 |
65 |
66 |
73 |
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
--------------------------------------------------------------------------------
/Plugin.AzurePushNotifications/Plugin.AzurePushNotifications/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AzurePushNotificationsForXamarinForms
2 | Azure Push Notifications for Xamarin Forms
3 |
4 | ## Available at NuGet.
5 | https://www.nuget.org/packages/ksemenenko.AzurePushNotifications/
6 |
7 | |Platform|Supported|Version|
8 | | ------------------- | :-----------: | :------------------: |
9 | |Xamarin.iOS Unified|Yes|iOS 6+|
10 | |Xamarin.Android|Yes|API 10+|
11 | |Windows Phone 8|Yes|8.0+|
12 | |Windows Phone 8.1|Yes|8.1+|
13 | |Windows Store|Yes|8.1+|
14 | |Windows 10 UWP|Yes|10+|
15 |
16 |
17 |
18 | How to use?
19 |
20 |
21 | ## iOS
22 | add in to AppDelegate
23 | ```cs
24 |
25 | public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
26 | {
27 | CrossAzurePushNotifications.Platform.ProcessNotification(userInfo);
28 | }
29 |
30 | public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
31 | {
32 | CrossAzurePushNotifications.Platform.RegisteredForRemoteNotifications(deviceToken);
33 | }
34 |
35 | ```
36 |
37 | ## Android
38 | Add in to MainActivity
39 | ```cs
40 | protected override void OnCreate(Bundle bundle)
41 | {
42 | base.OnCreate(bundle);
43 |
44 | global::Xamarin.Forms.Forms.Init(this, bundle);
45 |
46 | CrossAzurePushNotifications.Platform.Init(this); // for init
47 |
48 | LoadApplication(new TestFormsApp.App());
49 | }
50 |
51 | ```
52 |
53 | ### For yours custom BroadcastReceiver
54 |
55 |
56 | #### Create Class like this:
57 | ```cs
58 | [BroadcastReceiver(Permission = Constants.PermissionGcmIntents)]
59 | [IntentFilter(new[] {Intent.ActionBootCompleted})] // Allow GCM on boot and when app is closed
60 | [IntentFilter(new[] {Constants.IntentFromGcmMessage}, Categories = new[] {"@PACKAGE_NAME@"})]
61 | [IntentFilter(new[] {Constants.IntentFromGcmRegistrationCallback}, Categories = new[] {"@PACKAGE_NAME@"})]
62 | [IntentFilter(new[] {Constants.IntentFromGcmLibraryRetry}, Categories = new[] {"@PACKAGE_NAME@"})]
63 | public class PushNotificationsBroadcastReceiver : GcmBroadcastReceiverBase
64 | {
65 | }
66 | ```
67 |
68 | #### Create service class like this:
69 | ```cs
70 | [Service] //Must use the service tag
71 | public class YOUR_SERVICE_CLASS : GcmServiceBase
72 | {
73 | protected override void OnMessage(Context context, Intent intent)
74 | {
75 | Console.WriteLine("Received Notification");
76 | }
77 | }
78 | ```
79 |
80 |
81 | ## In to App.cs
82 | ```cs
83 | PushNotificationCredentials.Tags = new string[] { };
84 | PushNotificationCredentials.GoogleApiSenderId = "google sender id";
85 | PushNotificationCredentials.AzureNotificationHubName = "hub name";
86 | PushNotificationCredentials.AzureListenConnectionString = "Endpoint";
87 |
88 | CrossAzurePushNotifications.Current.RegisterForAzurePushNotification();
89 |
90 | CrossAzurePushNotifications.Current.OnMessageReceived += (sender, ev) =>
91 | {
92 | Debug.WriteLine(ev.Content);
93 | };
94 | ```
95 |
96 |
97 | ## Thanks
98 | https://github.com/Redth/GCM.Client
99 | https://azure.microsoft.com/en-us/documentation/articles/xamarin-notification-hubs-ios-push-notification-apns-get-started/
100 | https://azure.microsoft.com/en-us/documentation/articles/xamarin-notification-hubs-push-notifications-android-gcm/
101 | https://components.xamarin.com/gettingstarted/azure-messaging
102 | https://github.com/HoussemDellai/Azure-Push-Notification-For-Xamarin
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
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");
20 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Assets/Languages.csv:
--------------------------------------------------------------------------------
1 | ;ru-ru;en-us
2 | message1;Привет!;Hello!
3 | message2;Русский;English
4 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 | using Android.App;
5 | using Android.Content;
6 | using Android.Content.PM;
7 | using Android.Runtime;
8 | using Android.Views;
9 | using Android.Widget;
10 | using Android.OS;
11 | using Gcm.Client;
12 | using Plugin.AzurePushNotifications;
13 | using Environment = System.Environment;
14 | using WindowsAzure.Messaging;
15 |
16 | namespace TestFormsApp.Droid
17 | {
18 | [Activity(Label = "TestFormsApp", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
19 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
20 | {
21 | protected override void OnCreate(Bundle bundle)
22 | {
23 | base.OnCreate(bundle);
24 |
25 | global::Xamarin.Forms.Forms.Init(this, bundle);
26 |
27 | CrossAzurePushNotifications.Platform.Init(this);
28 |
29 | LoadApplication(new TestFormsApp.App());
30 | }
31 | }
32 |
33 | [BroadcastReceiver(Permission = Constants.PermissionGcmIntents)]
34 | [IntentFilter(new[] {Intent.ActionBootCompleted})] // Allow GCM on boot and when app is closed
35 | [IntentFilter(new[] {Constants.IntentFromGcmMessage}, Categories = new[] {"@PACKAGE_NAME@"})]
36 | [IntentFilter(new[] {Constants.IntentFromGcmRegistrationCallback}, Categories = new[] {"@PACKAGE_NAME@"})]
37 | [IntentFilter(new[] {Constants.IntentFromGcmLibraryRetry}, Categories = new[] {"@PACKAGE_NAME@"})]
38 | public class PushNotificationsBroadcastReceiver : GcmBroadcastReceiverBase
39 | {
40 | }
41 |
42 | [Service] //Must use the service tag
43 | public class MyMessageService : GcmServiceBase
44 | {
45 | protected override void OnMessage(Context context, Intent intent)
46 | {
47 | Console.WriteLine("Received Notification");
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 |
10 | [assembly: AssemblyTitle("TestFormsApp.Droid")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("TestFormsApp.Droid")]
15 | [assembly: AssemblyCopyright("Copyright © 2014")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 | [assembly: ComVisible(false)]
19 |
20 | // Version information for an assembly consists of the following four values:
21 | //
22 | // Major Version
23 | // Minor Version
24 | // Build Number
25 | // Revision
26 | //
27 | // You can specify all the values or you can default the Build and Revision Numbers
28 | // by using the '*' as shown below:
29 | // [assembly: AssemblyVersion("1.0.*")]
30 |
31 | [assembly: AssemblyVersion("1.0.0.0")]
32 | [assembly: AssemblyFileVersion("1.0.0.0")]
33 |
34 | // Add some common permissions, these can be removed if not needed
35 |
36 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
37 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
51 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Resources/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Droid/Resources/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Resources/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Droid/Resources/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Resources/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Droid/Resources/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/Resources/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Droid/Resources/drawable/icon.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/TestFormsApp.Droid.csproj.bak:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {D8B57BCA-47FC-473B-9C1D-53904932C580}
9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Library
11 | Properties
12 | TestFormsApp.Droid
13 | TestFormsApp.Droid
14 | 512
15 | true
16 | Resources\Resource.Designer.cs
17 | Off
18 | Properties\AndroidManifest.xml
19 | true
20 | v6.0
21 | armeabi,armeabi-v7a,x86
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | true
31 | full
32 | false
33 | bin\Debug\
34 | DEBUG;TRACE
35 | prompt
36 | 4
37 | True
38 | None
39 |
40 |
41 | pdbonly
42 | true
43 | bin\Release\
44 | TRACE
45 | prompt
46 | 4
47 | False
48 | SdkOnly
49 |
50 |
51 |
52 | ..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\FormsViewGroup.dll
53 | True
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | ..\..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Animated.Vector.Drawable.dll
63 | True
64 |
65 |
66 | ..\..\packages\Xamarin.Android.Support.Design.23.3.0\lib\MonoAndroid43\Xamarin.Android.Support.Design.dll
67 | True
68 |
69 |
70 | ..\..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll
71 | True
72 |
73 |
74 | ..\..\packages\Xamarin.Android.Support.v7.AppCompat.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll
75 | True
76 |
77 |
78 | ..\..\packages\Xamarin.Android.Support.v7.CardView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll
79 | True
80 |
81 |
82 | ..\..\packages\Xamarin.Android.Support.v7.MediaRouter.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll
83 | True
84 |
85 |
86 | ..\..\packages\Xamarin.Android.Support.v7.RecyclerView.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll
87 | True
88 |
89 |
90 | ..\..\packages\Xamarin.Android.Support.Vector.Drawable.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.Vector.Drawable.dll
91 | True
92 |
93 |
94 | ..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Core.dll
95 | True
96 |
97 |
98 | ..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Platform.dll
99 | True
100 |
101 |
102 | ..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll
103 | True
104 |
105 |
106 | ..\..\packages\Xamarin.Forms.2.3.1.114\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll
107 | True
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | Always
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
131 | Plugin.Localization.Abstractions
132 |
133 |
134 | {56a56f17-7de1-4ca1-9617-bf32e971ac84}
135 | Plugin.Localization.Android
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
145 |
146 |
147 |
148 |
155 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Droid/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | namespace TestFormsApp.UWP
19 | {
20 | ///
21 | /// Provides application-specific behavior to supplement the default Application class.
22 | ///
23 | sealed partial class App : Application
24 | {
25 | ///
26 | /// Initializes the singleton application object. This is the first line of authored code
27 | /// executed, and as such is the logical equivalent of main() or WinMain().
28 | ///
29 | public App()
30 | {
31 | this.InitializeComponent();
32 | this.Suspending += OnSuspending;
33 | }
34 |
35 | ///
36 | /// Invoked when the application is launched normally by the end user. Other entry points
37 | /// will be used such as when the application is launched to open a specific file.
38 | ///
39 | /// Details about the launch request and process.
40 | protected override void OnLaunched(LaunchActivatedEventArgs e)
41 | {
42 | #if DEBUG
43 | if (System.Diagnostics.Debugger.IsAttached)
44 | {
45 | this.DebugSettings.EnableFrameRateCounter = true;
46 | }
47 | #endif
48 |
49 | Frame rootFrame = Window.Current.Content as Frame;
50 |
51 | // Do not repeat app initialization when the Window already has content,
52 | // just ensure that the window is active
53 | if(rootFrame == null)
54 | {
55 | // Create a Frame to act as the navigation context and navigate to the first page
56 | rootFrame = new Frame();
57 |
58 | rootFrame.NavigationFailed += OnNavigationFailed;
59 |
60 | Xamarin.Forms.Forms.Init(e);
61 |
62 | if(e.PreviousExecutionState == ApplicationExecutionState.Terminated)
63 | {
64 | //TODO: Load state from previously suspended application
65 | }
66 |
67 | // Place the frame in the current Window
68 | Window.Current.Content = rootFrame;
69 | }
70 |
71 | if(rootFrame.Content == null)
72 | {
73 | // When the navigation stack isn't restored navigate to the first page,
74 | // configuring the new page by passing required information as a navigation
75 | // parameter
76 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
77 | }
78 | // Ensure the current window is active
79 | Window.Current.Activate();
80 | }
81 |
82 | ///
83 | /// Invoked when Navigation to a certain page fails
84 | ///
85 | /// The Frame which failed navigation
86 | /// Details about the navigation failure
87 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
88 | {
89 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
90 | }
91 |
92 | ///
93 | /// Invoked when application execution is being suspended. Application state is saved
94 | /// without knowing whether the application will be terminated or resumed with the contents
95 | /// of memory still intact.
96 | ///
97 | /// The source of the suspend request.
98 | /// Details about the suspend request.
99 | private void OnSuspending(object sender, SuspendingEventArgs e)
100 | {
101 | var deferral = e.SuspendingOperation.GetDeferral();
102 | //TODO: Save application state and stop any background activity
103 | deferral.Complete();
104 | }
105 | }
106 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.UWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | namespace TestFormsApp.UWP
17 | {
18 | public sealed partial class MainPage
19 | {
20 | public MainPage()
21 | {
22 | this.InitializeComponent();
23 |
24 | LoadApplication(new TestFormsApp.App());
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | TestAzurePush
7 | joaqu
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("TestFormsApp.UWP")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("TestFormsApp.UWP")]
14 | [assembly: AssemblyCopyright("Copyright © 2015")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Version information for an assembly consists of the following four values:
19 | //
20 | // Major Version
21 | // Minor Version
22 | // Build Number
23 | // Revision
24 | //
25 | // You can specify all the values or you can default the Build and Revision Numbers
26 | // by using the '*' as shown below:
27 | // [assembly: AssemblyVersion("1.0.*")]
28 |
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/TestFormsApp.UWP.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {B3410225-5A68-4D54-9F8B-73D59D5C6114}
8 | AppContainerExe
9 | Properties
10 | TestFormsApp.UWP
11 | TestFormsApp.UWP
12 | en-US
13 | UAP
14 | 10.0.10240.0
15 | 10.0.10240.0
16 | 14
17 | true
18 | 512
19 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
20 | Windows_TemporaryKey.pfx
21 |
22 |
23 | true
24 | bin\ARM\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | ARM
29 | false
30 | prompt
31 | true
32 |
33 |
34 | bin\ARM\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | true
37 | ;2008
38 | pdbonly
39 | ARM
40 | false
41 | prompt
42 | true
43 | true
44 |
45 |
46 | true
47 | bin\x64\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | x64
52 | false
53 | prompt
54 | true
55 |
56 |
57 | bin\x64\Release\
58 | TRACE;NETFX_CORE;WINDOWS_UWP
59 | true
60 | ;2008
61 | pdbonly
62 | x64
63 | false
64 | prompt
65 | true
66 | true
67 |
68 |
69 | true
70 | bin\x86\Debug\
71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
72 | ;2008
73 | full
74 | x86
75 | false
76 | prompt
77 | true
78 |
79 |
80 | bin\x86\Release\
81 | TRACE;NETFX_CORE;WINDOWS_UWP
82 | true
83 | ;2008
84 | pdbonly
85 | x86
86 | false
87 | prompt
88 | true
89 | true
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | App.xaml
98 |
99 |
100 | MainPage.xaml
101 |
102 |
103 |
104 |
105 |
106 | Designer
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | MSBuild:Compile
123 | Designer
124 |
125 |
126 | MSBuild:Compile
127 | Designer
128 |
129 |
130 |
131 |
132 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
133 | Plugin.Localization.Abstractions
134 |
135 |
136 | {e34b516d-c0d8-450f-9db0-bb6a5b04aef1}
137 | Plugin.Localization.UWP
138 |
139 |
140 |
141 | 14.0
142 |
143 |
144 |
145 |
152 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.UWP/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
4 | "Xamarin.Forms": "2.3.2.127"
5 | },
6 | "frameworks": {
7 | "uap10.0": {}
8 | },
9 | "runtimes": {
10 | "win10-arm": {},
11 | "win10-arm-aot": {},
12 | "win10-x86": {},
13 | "win10-x86-aot": {},
14 | "win10-x64": {},
15 | "win10-x64-aot": {}
16 | }
17 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
20 |
21 | namespace TestFormsApp.WinPhone
22 | {
23 | ///
24 | /// Provides application-specific behavior to supplement the default Application class.
25 | ///
26 | public sealed partial class App : Application
27 | {
28 | private TransitionCollection transitions;
29 |
30 | ///
31 | /// Initializes the singleton application object. This is the first line of authored code
32 | /// executed, and as such is the logical equivalent of main() or WinMain().
33 | ///
34 | public App()
35 | {
36 | this.InitializeComponent();
37 | this.Suspending += this.OnSuspending;
38 | }
39 |
40 | ///
41 | /// Invoked when the application is launched normally by the end user. Other entry points
42 | /// will be used when the application is launched to open a specific file, to display
43 | /// search results, and so forth.
44 | ///
45 | /// Details about the launch request and process.
46 | protected override void OnLaunched(LaunchActivatedEventArgs e)
47 | {
48 | #if DEBUG
49 | if (System.Diagnostics.Debugger.IsAttached)
50 | {
51 | this.DebugSettings.EnableFrameRateCounter = true;
52 | }
53 | #endif
54 |
55 | Frame rootFrame = Window.Current.Content as Frame;
56 |
57 | // Do not repeat app initialization when the Window already has content,
58 | // just ensure that the window is active
59 | if(rootFrame == null)
60 | {
61 | // Create a Frame to act as the navigation context and navigate to the first page
62 | rootFrame = new Frame();
63 |
64 | // TODO: change this value to a cache size that is appropriate for your application
65 | rootFrame.CacheSize = 1;
66 |
67 | Xamarin.Forms.Forms.Init(e);
68 |
69 | if(e.PreviousExecutionState == ApplicationExecutionState.Terminated)
70 | {
71 | // TODO: Load state from previously suspended application
72 | }
73 |
74 | // Place the frame in the current Window
75 | Window.Current.Content = rootFrame;
76 | }
77 |
78 | if(rootFrame.Content == null)
79 | {
80 | // Removes the turnstile navigation for startup.
81 | if(rootFrame.ContentTransitions != null)
82 | {
83 | this.transitions = new TransitionCollection();
84 | foreach(var c in rootFrame.ContentTransitions)
85 | {
86 | this.transitions.Add(c);
87 | }
88 | }
89 |
90 | rootFrame.ContentTransitions = null;
91 | rootFrame.Navigated += this.RootFrame_FirstNavigated;
92 |
93 | // When the navigation stack isn't restored navigate to the first page,
94 | // configuring the new page by passing required information as a navigation
95 | // parameter
96 | if(!rootFrame.Navigate(typeof(MainPage), e.Arguments))
97 | {
98 | throw new Exception("Failed to create initial page");
99 | }
100 | }
101 |
102 | // Ensure the current window is active
103 | Window.Current.Activate();
104 | }
105 |
106 | ///
107 | /// Restores the content transitions after the app has launched.
108 | ///
109 | /// The object where the handler is attached.
110 | /// Details about the navigation event.
111 | private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
112 | {
113 | var rootFrame = sender as Frame;
114 | rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection() {new NavigationThemeTransition()};
115 | rootFrame.Navigated -= this.RootFrame_FirstNavigated;
116 | }
117 |
118 | ///
119 | /// Invoked when application execution is being suspended. Application state is saved
120 | /// without knowing whether the application will be terminated or resumed with the contents
121 | /// of memory still intact.
122 | ///
123 | /// The source of the suspend request.
124 | /// Details about the suspend request.
125 | private void OnSuspending(object sender, SuspendingEventArgs e)
126 | {
127 | var deferral = e.SuspendingOperation.GetDeferral();
128 |
129 | // TODO: Save application state and stop any background activity
130 | deferral.Complete();
131 | }
132 | }
133 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Assets/Logo.scale-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.WinPhone/Assets/Logo.scale-240.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Assets/SmallLogo.scale-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.WinPhone/Assets/SmallLogo.scale-240.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Assets/SplashScreen.scale-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.WinPhone/Assets/SplashScreen.scale-240.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Assets/Square71x71Logo.scale-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.WinPhone/Assets/Square71x71Logo.scale-240.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Assets/StoreLogo.scale-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.WinPhone/Assets/StoreLogo.scale-240.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Assets/WideLogo.scale-240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.WinPhone/Assets/WideLogo.scale-240.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 | using Plugin.AzurePushNotifications;
16 |
17 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
18 |
19 | namespace TestFormsApp.WinPhone
20 | {
21 | ///
22 | /// An empty page that can be used on its own or navigated to within a Frame.
23 | ///
24 | public sealed partial class MainPage
25 | {
26 | public MainPage()
27 | {
28 | this.InitializeComponent();
29 |
30 | this.NavigationCacheMode = NavigationCacheMode.Required;
31 |
32 | LoadApplication(new TestFormsApp.App());
33 | }
34 |
35 | ///
36 | /// Invoked when this page is about to be displayed in a Frame.
37 | ///
38 | /// Event data that describes how this page was reached.
39 | /// This parameter is typically used to configure the page.
40 | protected override void OnNavigatedTo(NavigationEventArgs e)
41 | {
42 | // TODO: Prepare page for display here.
43 |
44 | // TODO: If your application contains multiple pages, ensure that you are
45 | // handling the hardware Back button by registering for the
46 | // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
47 | // If you are using the NavigationHelper provided by some templates,
48 | // this event is handled for you.
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 | FPCL.Windows8.WindowsPhone
12 | joaqu
13 | Assets\StoreLogo.png
14 |
15 |
16 |
17 | 6.3.1
18 | 6.3.1
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("TestFormsApp.WinPhone.WindowsPhone")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("TestFormsApp.WinPhone.WindowsPhone")]
14 | [assembly: AssemblyCopyright("Copyright © 2015")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Version information for an assembly consists of the following four values:
19 | //
20 | // Major Version
21 | // Minor Version
22 | // Build Number
23 | // Revision
24 | //
25 | // You can specify all the values or you can default the Build and Revision Numbers
26 | // by using the '*' as shown below:
27 | // [assembly: AssemblyVersion("1.0.*")]
28 |
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/TestFormsApp.WinPhone.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FC352096-FDD3-4954-859C-D0E532D3D646}
8 | AppContainerExe
9 | Properties
10 | TestFormsApp.WinPhone
11 | TestFormsApp.WinPhone
12 | en-US
13 | 8.1
14 | 12
15 | 512
16 | {76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
17 | true
18 |
19 |
20 |
21 |
22 | AnyCPU
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
28 | prompt
29 | 4
30 |
31 |
32 | AnyCPU
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
37 | prompt
38 | 4
39 |
40 |
41 | true
42 | bin\ARM\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
44 | ;2008
45 | full
46 | ARM
47 | false
48 | prompt
49 | true
50 |
51 |
52 | bin\ARM\Release\
53 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
54 | true
55 | ;2008
56 | pdbonly
57 | ARM
58 | false
59 | prompt
60 | true
61 |
62 |
63 | true
64 | bin\x86\Debug\
65 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
66 | ;2008
67 | full
68 | x86
69 | false
70 | prompt
71 | true
72 |
73 |
74 | bin\x86\Release\
75 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
76 | true
77 | ;2008
78 | pdbonly
79 | x86
80 | false
81 | prompt
82 | true
83 |
84 |
85 |
86 | App.xaml
87 |
88 |
89 | MainPage.xaml
90 |
91 |
92 |
93 |
94 |
95 | Designer
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | Designer
109 |
110 |
111 | MSBuild:Compile
112 | Designer
113 |
114 |
115 |
116 |
117 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
118 | Plugin.Localization.Abstractions
119 |
120 |
121 | {7169373f-0b82-4e5d-9129-7cc3065b90fa}
122 | Plugin.Localization.WindowsPhone81
123 |
124 |
125 |
126 |
127 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\wpa81\Xamarin.Forms.Core.dll
128 | True
129 |
130 |
131 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\wpa81\Xamarin.Forms.Platform.dll
132 | True
133 |
134 |
135 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\wpa81\Xamarin.Forms.Platform.WinRT.dll
136 | True
137 |
138 |
139 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\wpa81\Xamarin.Forms.Platform.WinRT.Phone.dll
140 | True
141 |
142 |
143 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\wpa81\Xamarin.Forms.Xaml.dll
144 | True
145 |
146 |
147 |
148 |
149 |
150 |
151 | 12.0
152 |
153 |
154 | WindowsPhoneApp
155 |
156 |
157 |
158 |
159 |
160 |
161 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
162 |
163 |
164 |
165 |
172 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.WinPhone/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Media.Animation;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
20 |
21 | namespace TestFormsApp.Windows
22 | {
23 | ///
24 | /// Provides application-specific behavior to supplement the default Application class.
25 | ///
26 | public sealed partial class App : Application
27 | {
28 | ///
29 | /// Initializes the singleton application object. This is the first line of authored code
30 | /// executed, and as such is the logical equivalent of main() or WinMain().
31 | ///
32 | public App()
33 | {
34 | this.InitializeComponent();
35 | this.Suspending += this.OnSuspending;
36 | }
37 |
38 | ///
39 | /// Invoked when the application is launched normally by the end user. Other entry points
40 | /// will be used when the application is launched to open a specific file, to display
41 | /// search results, and so forth.
42 | ///
43 | /// Details about the launch request and process.
44 | protected override void OnLaunched(LaunchActivatedEventArgs e)
45 | {
46 | #if DEBUG
47 | if (System.Diagnostics.Debugger.IsAttached)
48 | {
49 | this.DebugSettings.EnableFrameRateCounter = true;
50 | }
51 | #endif
52 |
53 | Frame rootFrame = Window.Current.Content as Frame;
54 |
55 | // Do not repeat app initialization when the Window already has content,
56 | // just ensure that the window is active
57 | if(rootFrame == null)
58 | {
59 | // Create a Frame to act as the navigation context and navigate to the first page
60 | rootFrame = new Frame();
61 |
62 | // TODO: change this value to a cache size that is appropriate for your application
63 | rootFrame.CacheSize = 1;
64 |
65 | Xamarin.Forms.Forms.Init(e);
66 |
67 | if(e.PreviousExecutionState == ApplicationExecutionState.Terminated)
68 | {
69 | // TODO: Load state from previously suspended application
70 | }
71 |
72 | // Place the frame in the current Window
73 | Window.Current.Content = rootFrame;
74 | }
75 |
76 | if(rootFrame.Content == null)
77 | {
78 | // When the navigation stack isn't restored navigate to the first page,
79 | // configuring the new page by passing required information as a navigation
80 | // parameter
81 | if(!rootFrame.Navigate(typeof(MainPage), e.Arguments))
82 | {
83 | throw new Exception("Failed to create initial page");
84 | }
85 | }
86 |
87 | // Ensure the current window is active
88 | Window.Current.Activate();
89 | }
90 |
91 | ///
92 | /// Invoked when application execution is being suspended. Application state is saved
93 | /// without knowing whether the application will be terminated or resumed with the contents
94 | /// of memory still intact.
95 | ///
96 | /// The source of the suspend request.
97 | /// Details about the suspend request.
98 | private void OnSuspending(object sender, SuspendingEventArgs e)
99 | {
100 | var deferral = e.SuspendingOperation.GetDeferral();
101 |
102 | // TODO: Save application state and stop any background activity
103 | deferral.Complete();
104 | }
105 | }
106 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/Assets/Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Windows/Assets/Logo.scale-100.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/Assets/SmallLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Windows/Assets/SmallLogo.scale-100.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Windows/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/Assets/StoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.Windows/Assets/StoreLogo.scale-100.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Runtime.InteropServices.WindowsRuntime;
6 | using Windows.Foundation;
7 | using Windows.Foundation.Collections;
8 | using Windows.UI.Xaml;
9 | using Windows.UI.Xaml.Controls;
10 | using Windows.UI.Xaml.Controls.Primitives;
11 | using Windows.UI.Xaml.Data;
12 | using Windows.UI.Xaml.Input;
13 | using Windows.UI.Xaml.Media;
14 | using Windows.UI.Xaml.Navigation;
15 |
16 | namespace TestFormsApp.Windows
17 | {
18 | public sealed partial class MainPage
19 | {
20 | public MainPage()
21 | {
22 | this.InitializeComponent();
23 |
24 | LoadApplication(new TestFormsApp.App());
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 | FPCL.Windows8.Windows
10 | joaqu
11 | Assets\StoreLogo.png
12 |
13 |
14 |
15 | 6.3.0
16 | 6.3.0
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("TestFormsApp.Windows.Windows")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("TestFormsApp.Windows.Windows")]
14 | [assembly: AssemblyCopyright("Copyright © 2015")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Version information for an assembly consists of the following four values:
19 | //
20 | // Major Version
21 | // Minor Version
22 | // Build Number
23 | // Revision
24 | //
25 | // You can specify all the values or you can default the Build and Revision Numbers
26 | // by using the '*' as shown below:
27 | // [assembly: AssemblyVersion("1.0.*")]
28 |
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.Windows/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Foundation;
5 | using Plugin.AzurePushNotifications;
6 | using UIKit;
7 |
8 | namespace TestFormsApp.iOS
9 | {
10 | // The UIApplicationDelegate for the application. This class is responsible for launching the
11 | // User Interface of the application, as well as listening (and optionally responding) to
12 | // application events from iOS.
13 | [Register("AppDelegate")]
14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
15 | {
16 | //
17 | // This method is invoked when the application has loaded and is ready to run. In this
18 | // method you should instantiate the window, load the UI into it and then make the window
19 | // visible.
20 | //
21 | // You have 17 seconds to return from this method, or iOS will terminate your application.
22 | //
23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
24 | {
25 | global::Xamarin.Forms.Forms.Init();
26 |
27 | LoadApplication(new TestFormsApp.App());
28 |
29 | return base.FinishedLaunching(app, options);
30 | }
31 |
32 | public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
33 | {
34 | CrossAzurePushNotifications.Platform.ProcessNotification(userInfo);
35 | }
36 |
37 | public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
38 | {
39 | CrossAzurePushNotifications.Platform.RegisteredForRemoteNotifications(deviceToken);
40 | }
41 |
42 | public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
43 | {
44 | Console.WriteLine("FailedToRegisterForRemoteNotifications: " + error);
45 | }
46 |
47 | //[Export("userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:")]
48 | //public void DidReceiveNotificationResponse(UserNotifications.UNUserNotificationCenter center, UserNotifications.UNNotificationResponse response, Action completionHandler)
49 | //{
50 | //
51 | //}
52 | }
53 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UISupportedInterfaceOrientations
11 |
12 | UIInterfaceOrientationPortrait
13 | UIInterfaceOrientationLandscapeLeft
14 | UIInterfaceOrientationLandscapeRight
15 |
16 | UISupportedInterfaceOrientations~ipad
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationPortraitUpsideDown
20 | UIInterfaceOrientationLandscapeLeft
21 | UIInterfaceOrientationLandscapeRight
22 |
23 | MinimumOSVersion
24 | 6.0
25 | CFBundleDisplayName
26 | TestFormsApp
27 | CFBundleIdentifier
28 | com.yourcompany.TestFormsApp
29 | CFBundleVersion
30 | 1.0
31 | CFBundleIconFiles
32 |
33 | Icon-60@2x.png
34 | Icon-60@3x.png
35 | Icon-76.png
36 | Icon-76@2x.png
37 | Default.png
38 | Default@2x.png
39 | Default-568h@2x.png
40 | Default-Portrait.png
41 | Default-Portrait@2x.png
42 | Icon-Small-40.png
43 | Icon-Small-40@2x.png
44 | Icon-Small-40@3x.png
45 | Icon-Small.png
46 | Icon-Small@2x.png
47 | Icon-Small@3x.png
48 |
49 | UILaunchStoryboardName
50 | LaunchScreen.storyboard
51 |
52 |
53 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Foundation;
5 | using UIKit;
6 |
7 | namespace TestFormsApp.iOS
8 | {
9 | public class Application
10 | {
11 | // This is the main entry point of the application.
12 | static void Main(string[] args)
13 | {
14 | // if you want to use a different Application Delegate class from "AppDelegate"
15 | // you can specify it here.
16 | UIApplication.Main(args, null, "AppDelegate");
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("TestFormsApp.iOS")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("TestFormsApp.iOS")]
14 | [assembly: AssemblyCopyright("Copyright © 2014")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 |
22 | [assembly: ComVisible(false)]
23 |
24 | // The following GUID is for the ID of the typelib if this project is exposed to COM
25 |
26 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
27 |
28 | // Version information for an assembly consists of the following four values:
29 | //
30 | // Major Version
31 | // Minor Version
32 | // Build Number
33 | // Revision
34 | //
35 | // You can specify all the values or you can default the Build and Revision Numbers
36 | // by using the '*' as shown below:
37 | // [assembly: AssemblyVersion("1.0.*")]
38 |
39 | [assembly: AssemblyVersion("1.0.0.0")]
40 | [assembly: AssemblyFileVersion("1.0.0.0")]
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Default-Portrait.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Default.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Default@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-60@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-60@3x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-76.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-76@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small-40.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small-40@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small-40@3x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small@2x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/Resources/Icon-Small@3x.png
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/Resources/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/TestFormsApp.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | iPhoneSimulator
6 | 8.0.30703
7 | 2.0
8 | {5F2506EA-00BD-4542-960E-5AA21B14F490}
9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | Exe
11 | TestFormsApp.iOS
12 | Resources
13 | TestFormsAppiOS
14 |
15 |
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\iPhoneSimulator\Debug
22 | DEBUG
23 | prompt
24 | 4
25 | false
26 | i386, x86_64
27 | None
28 | true
29 |
30 |
31 | none
32 | true
33 | bin\iPhoneSimulator\Release
34 | prompt
35 | 4
36 | None
37 | i386, x86_64
38 | false
39 |
40 |
41 | true
42 | full
43 | false
44 | bin\iPhone\Debug
45 | DEBUG
46 | prompt
47 | 4
48 | false
49 | ARMv7, ARM64
50 | iPhone Developer
51 | true
52 | Entitlements.plist
53 |
54 |
55 | none
56 | true
57 | bin\iPhone\Release
58 | prompt
59 | 4
60 | ARMv7, ARM64
61 | false
62 | iPhone Developer
63 | Entitlements.plist
64 |
65 |
66 | none
67 | True
68 | bin\iPhone\Ad-Hoc
69 | prompt
70 | 4
71 | False
72 | ARMv7, ARM64
73 | True
74 | Automatic:AdHoc
75 | iPhone Distribution
76 | Entitlements.plist
77 |
78 |
79 | none
80 | True
81 | bin\iPhone\AppStore
82 | prompt
83 | 4
84 | False
85 | ARMv7, ARM64
86 | Automatic:AppStore
87 | iPhone Distribution
88 | Entitlements.plist
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll
124 | True
125 |
126 |
127 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll
128 | True
129 |
130 |
131 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll
132 | True
133 |
134 |
135 | ..\..\packages\Xamarin.Forms.2.3.2.127\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll
136 | True
137 |
138 |
139 |
140 |
141 |
142 | {6edb0588-ffc5-4ef5-8a99-9e241d0f878d}
143 | Plugin.Localization.Abstractions
144 |
145 |
146 | {2882aeeb-d4cd-4eb9-8a6c-6653b33681f0}
147 | Plugin.Localization.iOS
148 | false
149 | false
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
158 |
159 |
160 |
161 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/iTunesArtwork:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/iTunesArtwork
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/iTunesArtwork@2x:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/TestFormsApp/TestFormsApp.iOS/iTunesArtwork@2x
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp.iOS/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp/App.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using Plugin.AzurePushNotifications;
7 | using Xamarin.Forms;
8 |
9 |
10 | namespace TestFormsApp
11 | {
12 | public class App : Application
13 | {
14 | public App()
15 | {
16 |
17 | PushNotificationCredentials.Tags = new string[] { };
18 | PushNotificationCredentials.GoogleApiSenderId = "google sender id";
19 | PushNotificationCredentials.AzureNotificationHubName = "hub name";
20 | PushNotificationCredentials.AzureListenConnectionString = "Endpoint";
21 |
22 |
23 |
24 | CrossAzurePushNotifications.Current.RegisterForAzurePushNotification();
25 |
26 | CrossAzurePushNotifications.Current.OnMessageReceived += (sender, ev) =>
27 | {
28 | Debug.WriteLine(ev.Content);
29 | };
30 |
31 |
32 | B_Clicked(null, null);
33 | var button = new Button();
34 | button.Text = "message";
35 | button.Clicked += B_Clicked;
36 |
37 |
38 |
39 | // The root page of your application
40 | MainPage = new ContentPage
41 | {
42 | Content = new StackLayout
43 | {
44 | VerticalOptions = LayoutOptions.Center,
45 | Children =
46 | {
47 | new Label
48 | {
49 | HorizontalTextAlignment = TextAlignment.Center,
50 | Text = "message"
51 | },
52 | button,
53 | }
54 | }
55 | };
56 | }
57 |
58 | private void B_Clicked(object sender, EventArgs e)
59 | {
60 |
61 |
62 |
63 |
64 |
65 | }
66 |
67 | protected override void OnStart()
68 | {
69 | // Handle when your app starts
70 | }
71 |
72 | protected override void OnSleep()
73 | {
74 | // Handle when your app sleeps
75 | }
76 |
77 | protected override void OnResume()
78 | {
79 | // Handle when your app resumes
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp/GettingStarted.Xamarin:
--------------------------------------------------------------------------------
1 |
2 | GS\XF\CS\App\GettingStarted.html
3 | false
4 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp/TestFormsApp.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | e9d795f1-81a3-4761-9532-cf4ec3501f60
7 |
8 |
9 | TestFormsApp
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TestFormsApp/TestFormsApp/TestFormsApp.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | e9d795f1-81a3-4761-9532-cf4ec3501f60
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KSemenenko/AzurePushNotificationsForXamarinForms/5edfd24bcf6d4ad01399764ddbbd1ba0c9049cf5/icon.png
--------------------------------------------------------------------------------