├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question-query-template.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── icons │ ├── aznh-icon-128x128.png │ └── aznh-icon-512x512.png ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── NuGet.config ├── README.md ├── SECURITY.md ├── azure-pipelines.yml ├── samples ├── NotificationHubSample.Android │ ├── Assets │ │ └── AboutAssets.txt │ ├── MainActivity.cs │ ├── NotificationHubSample.Android.csproj │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ └── Resources │ │ ├── AboutResources.txt │ │ ├── Resource.designer.cs │ │ ├── layout │ │ ├── Tabbar.xml │ │ └── Toolbar.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── icon.xml │ │ └── icon_round.xml │ │ ├── mipmap-hdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ │ ├── mipmap-mdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ │ └── values │ │ ├── colors.xml │ │ └── styles.xml ├── NotificationHubSample.iOS │ ├── AppDelegate.cs │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon1024.png │ │ │ ├── Icon120.png │ │ │ ├── Icon152.png │ │ │ ├── Icon167.png │ │ │ ├── Icon180.png │ │ │ ├── Icon20.png │ │ │ ├── Icon29.png │ │ │ ├── Icon40.png │ │ │ ├── Icon58.png │ │ │ ├── Icon60.png │ │ │ ├── Icon76.png │ │ │ ├── Icon80.png │ │ │ └── Icon87.png │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── NotificationHubSample.iOS.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Resources │ │ ├── Default-568h@2x.png │ │ ├── Default-Portrait.png │ │ ├── Default-Portrait@2x.png │ │ ├── Default.png │ │ ├── Default@2x.png │ │ └── LaunchScreen.storyboard ├── NotificationHubSample.sln ├── NotificationHubSample │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── Constants.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ └── NotificationHubSample.csproj ├── README.md └── bindings │ ├── NHubSampleXamarinAndroid │ ├── Assets │ │ └── AboutAssets.txt │ ├── InstallationEnrichmentVisitor.cs │ ├── InstallationSaveFailedListener.cs │ ├── InstallationSavedListener.cs │ ├── MainActivity.cs │ ├── NHubSampleXamarinAndroid.csproj │ ├── NHubSampleXamarinAndroid.sln │ ├── NotificationListener.cs │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── Resource.designer.cs │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── content_main.xml │ │ ├── menu │ │ │ └── menu_main.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── SampleInstallationAdapter.cs │ └── NHubSampleXamariniOS │ ├── AppDelegate.cs │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon1024.png │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ └── Icon87.png │ ├── DevSettings.plist │ ├── Entitlements.plist │ ├── Info.plist │ ├── InstallationEnrichmentDelegate.cs │ ├── InstallationLifecycleDelegate.cs │ ├── InstallationManagementDelegate.cs │ ├── LaunchScreen.storyboard │ ├── Main.cs │ ├── Main.storyboard │ ├── NHubSampleXamariniOS.csproj │ ├── NHubSampleXamariniOS.sln │ ├── NotificationDelegate.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Resources │ └── LaunchScreen.xib │ ├── SceneDelegate.cs │ ├── ViewController.cs │ └── ViewController.designer.cs └── src ├── Microsoft.Azure.NotificationHubs.Client.sln ├── Microsoft.Azure.NotificationHubs.Client ├── IInstallationEnrichmentAdapter.shared.cs ├── IInstallationManagementAdapter.shared.cs ├── Installation.shared.cs ├── InstallationSaveFailedEventArgs.shared.cs ├── InstallationSavedEventArgs.shared.cs ├── InstallationTemplate.shared.cs ├── Microsoft.Azure.NotificationHubs.Client.csproj ├── NotificationHub.android.cs ├── NotificationHub.ios.cs ├── NotificationHub.net.cs ├── NotificationHub.shared.cs ├── NotificationHubMessageDelegate.ios.cs ├── NotificationListener.android.cs └── NotificationMessageReceivedEventArgs.shared.cs └── bindings ├── Android └── Xamarin.Azure.NotificationHubs.Android │ ├── Additions │ └── AboutAdditions.txt │ ├── Jars │ └── AboutJars.txt │ ├── Transforms │ ├── EnumFields.xml │ ├── EnumMethods.xml │ └── Metadata.xml │ ├── Xamarin.Azure.NotificationHubs.Android.csproj │ └── Xamarin.Azure.NotificationHubs.Android.sln ├── External-Dependency-Info.txt ├── build.cake ├── cgmanifest.json └── iOS └── Xamarin.Azure.NotificationHubs.iOS ├── ApiDefinition.cs ├── StructsAndEnums.cs ├── Xamarin.Azure.NotificationHubs.iOS.csproj └── Xamarin.Azure.NotificationHubs.iOS.sln /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | ***Exception or Stack Trace*** 14 | Add the exception log and stack trace if available 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 19 | ***Code Snippet*** 20 | Add the code snippet that causes the issue. 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Setup (please complete the following information):** 29 | - OS: [e.g. iOS 13.x] 30 | - IDE : [e.g. Visual Studio 2019] 31 | - Version of the Library used 32 | 33 | **Additional context** 34 | Add any other context about the problem here. 35 | 36 | **Information Checklist** 37 | Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report 38 | - [ ] Bug Description Added 39 | - [ ] Repro Steps Added 40 | - [ ] Setup information Added -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE REQ]" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | 22 | **Information Checklist** 23 | Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report 24 | - [ ] Description Added 25 | - [ ] Expected solution specified -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question-query-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question/Query template 3 | about: Use this template to file a question/query for the SDK team 4 | title: "[QUERY]" 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Query/Question** 11 | A clear and concise ask/query. 12 | 13 | ***Why is this not a Bug or a feature Request?*** 14 | A clear explanation of why is this not a bug or a feature request? 15 | 16 | **Setup (please complete the following information if applicable):** 17 | - OS: [e.g. iOS 13.x] 18 | - IDE : [e.g. Visual Studio 2019] 19 | - Version of the Library used 20 | 21 | **Information Checklist** 22 | Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report 23 | - [ ] Query Added 24 | - [ ] Setup information Added -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | Things to consider before you submit the PR: 11 | 12 | * [ ] Are tests passing locally? 13 | * [ ] Are the files formatted correctly? 14 | * [ ] Did you add unit tests? 15 | * [ ] Did you test your change with either the sample apps that are included in the repository or with a blank app that uses your change? 16 | 17 | ## Description 18 | 19 | A few sentences describing the overall goals of the pull request. 20 | 21 | ## Related PRs or issues 22 | 23 | List related PRs and other issues. 24 | 25 | ## Misc 26 | 27 | Add what's missing, notes on what you tested, additional thoughts or questions. -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.github/icons/aznh-icon-128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/.github/icons/aznh-icon-128x128.png -------------------------------------------------------------------------------- /.github/icons/aznh-icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/.github/icons/aznh-icon-512x512.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # General 2 | .DS_Store 3 | .AppleDouble 4 | .LSOverride 5 | 6 | # Icon must end with two \r 7 | Icon 8 | 9 | 10 | # Thumbnails 11 | ._* 12 | 13 | # Files that might appear in the root of a volume 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | 22 | # Directories potentially created on remote AFP share 23 | .AppleDB 24 | .AppleDesktop 25 | Network Trash Folder 26 | Temporary Items 27 | .apdisk 28 | 29 | # Windows thumbnail cache files 30 | Thumbs.db 31 | Thumbs.db:encryptable 32 | ehthumbs.db 33 | ehthumbs_vista.db 34 | 35 | # Dump file 36 | *.stackdump 37 | 38 | # Folder config file 39 | [Dd]esktop.ini 40 | 41 | # Recycle Bin used on file shares 42 | $RECYCLE.BIN/ 43 | 44 | # Windows Installer files 45 | *.cab 46 | *.msi 47 | *.msix 48 | *.msm 49 | *.msp 50 | 51 | # Windows shortcuts 52 | *.lnk 53 | 54 | ## Ignore Visual Studio temporary files, build results, and 55 | ## files generated by popular Visual Studio add-ons. 56 | ## 57 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 58 | 59 | # User-specific files 60 | *.rsuser 61 | *.suo 62 | *.user 63 | *.userosscache 64 | *.sln.docstates 65 | 66 | # User-specific files (MonoDevelop/Xamarin Studio) 67 | *.userprefs 68 | 69 | # Mono auto generated files 70 | mono_crash.* 71 | 72 | # Build results 73 | [Dd]ebug/ 74 | [Dd]ebugPublic/ 75 | [Rr]elease/ 76 | [Rr]eleases/ 77 | x64/ 78 | x86/ 79 | [Aa][Rr][Mm]/ 80 | [Aa][Rr][Mm]64/ 81 | bld/ 82 | [Bb]in/ 83 | [Oo]bj/ 84 | [Ll]og/ 85 | [Ll]ogs/ 86 | 87 | # Visual Studio 2015/2017 cache/options directory 88 | .vs/ 89 | # Uncomment if you have tasks that create the project's static files in wwwroot 90 | #wwwroot/ 91 | 92 | # Visual Studio 2017 auto generated files 93 | Generated\ Files/ 94 | 95 | # MSTest test Results 96 | [Tt]est[Rr]esult*/ 97 | [Bb]uild[Ll]og.* 98 | 99 | # NUnit 100 | *.VisualState.xml 101 | TestResult.xml 102 | nunit-*.xml 103 | 104 | # Build Results of an ATL Project 105 | [Dd]ebugPS/ 106 | [Rr]eleasePS/ 107 | dlldata.c 108 | 109 | # Benchmark Results 110 | BenchmarkDotNet.Artifacts/ 111 | 112 | # .NET Core 113 | project.lock.json 114 | project.fragment.lock.json 115 | artifacts/ 116 | 117 | # StyleCop 118 | StyleCopReport.xml 119 | 120 | # Files built by Visual Studio 121 | *_i.c 122 | *_p.c 123 | *_h.h 124 | *.ilk 125 | *.meta 126 | *.obj 127 | *.iobj 128 | *.pch 129 | *.pdb 130 | *.ipdb 131 | *.pgc 132 | *.pgd 133 | *.rsp 134 | *.sbr 135 | *.tlb 136 | *.tli 137 | *.tlh 138 | *.tmp 139 | *.tmp_proj 140 | *_wpftmp.csproj 141 | *.log 142 | *.vspscc 143 | *.vssscc 144 | .builds 145 | *.pidb 146 | *.svclog 147 | *.scc 148 | 149 | # Chutzpah Test files 150 | _Chutzpah* 151 | 152 | # Visual C++ cache files 153 | ipch/ 154 | *.aps 155 | *.ncb 156 | *.opendb 157 | *.opensdf 158 | *.sdf 159 | *.cachefile 160 | *.VC.db 161 | *.VC.VC.opendb 162 | 163 | # Visual Studio profiler 164 | *.psess 165 | *.vsp 166 | *.vspx 167 | *.sap 168 | 169 | # Visual Studio Trace Files 170 | *.e2e 171 | 172 | # TFS 2012 Local Workspace 173 | $tf/ 174 | 175 | # Guidance Automation Toolkit 176 | *.gpState 177 | 178 | # ReSharper is a .NET coding add-in 179 | _ReSharper*/ 180 | *.[Rr]e[Ss]harper 181 | *.DotSettings.user 182 | 183 | # TeamCity is a build add-in 184 | _TeamCity* 185 | 186 | # DotCover is a Code Coverage Tool 187 | *.dotCover 188 | 189 | # AxoCover is a Code Coverage Tool 190 | .axoCover/* 191 | !.axoCover/settings.json 192 | 193 | # Visual Studio code coverage results 194 | *.coverage 195 | *.coveragexml 196 | 197 | # NCrunch 198 | _NCrunch_* 199 | .*crunch*.local.xml 200 | nCrunchTemp_* 201 | 202 | # MightyMoose 203 | *.mm.* 204 | AutoTest.Net/ 205 | 206 | # Web workbench (sass) 207 | .sass-cache/ 208 | 209 | # Installshield output folder 210 | [Ee]xpress/ 211 | 212 | # DocProject is a documentation generator add-in 213 | DocProject/buildhelp/ 214 | DocProject/Help/*.HxT 215 | DocProject/Help/*.HxC 216 | DocProject/Help/*.hhc 217 | DocProject/Help/*.hhk 218 | DocProject/Help/*.hhp 219 | DocProject/Help/Html2 220 | DocProject/Help/html 221 | 222 | # Click-Once directory 223 | publish/ 224 | 225 | # Publish Web Output 226 | *.[Pp]ublish.xml 227 | *.azurePubxml 228 | # Note: Comment the next line if you want to checkin your web deploy settings, 229 | # but database connection strings (with potential passwords) will be unencrypted 230 | *.pubxml 231 | *.publishproj 232 | 233 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 234 | # checkin your Azure Web App publish settings, but sensitive information contained 235 | # in these scripts will be unencrypted 236 | PublishScripts/ 237 | 238 | # NuGet Packages 239 | *.nupkg 240 | # NuGet Symbol Packages 241 | *.snupkg 242 | # The packages folder can be ignored because of Package Restore 243 | **/[Pp]ackages/* 244 | # except build/, which is used as an MSBuild target. 245 | !**/[Pp]ackages/build/ 246 | # Uncomment if necessary however generally it will be regenerated when needed 247 | #!**/[Pp]ackages/repositories.config 248 | # NuGet v3's project.json files produces more ignorable files 249 | *.nuget.props 250 | *.nuget.targets 251 | 252 | # Microsoft Azure Build Output 253 | csx/ 254 | *.build.csdef 255 | 256 | # Microsoft Azure Emulator 257 | ecf/ 258 | rcf/ 259 | 260 | # Windows Store app package directories and files 261 | AppPackages/ 262 | BundleArtifacts/ 263 | Package.StoreAssociation.xml 264 | _pkginfo.txt 265 | *.appx 266 | *.appxbundle 267 | *.appxupload 268 | 269 | # Visual Studio cache files 270 | # files ending in .cache can be ignored 271 | *.[Cc]ache 272 | # but keep track of directories ending in .cache 273 | !?*.[Cc]ache/ 274 | 275 | # Others 276 | ClientBin/ 277 | ~$* 278 | *~ 279 | *.dbmdl 280 | *.dbproj.schemaview 281 | *.jfm 282 | *.pfx 283 | *.publishsettings 284 | orleans.codegen.cs 285 | 286 | # Including strong name files can present a security risk 287 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 288 | #*.snk 289 | 290 | # Since there are multiple workflows, uncomment next line to ignore bower_components 291 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 292 | #bower_components/ 293 | 294 | # RIA/Silverlight projects 295 | Generated_Code/ 296 | 297 | # Backup & report files from converting an old project file 298 | # to a newer Visual Studio version. Backup files are not needed, 299 | # because we have git ;-) 300 | _UpgradeReport_Files/ 301 | Backup*/ 302 | UpgradeLog*.XML 303 | UpgradeLog*.htm 304 | ServiceFabricBackup/ 305 | *.rptproj.bak 306 | 307 | # SQL Server files 308 | *.mdf 309 | *.ldf 310 | *.ndf 311 | 312 | # Business Intelligence projects 313 | *.rdl.data 314 | *.bim.layout 315 | *.bim_*.settings 316 | *.rptproj.rsuser 317 | *- [Bb]ackup.rdl 318 | *- [Bb]ackup ([0-9]).rdl 319 | *- [Bb]ackup ([0-9][0-9]).rdl 320 | 321 | # Microsoft Fakes 322 | FakesAssemblies/ 323 | 324 | # GhostDoc plugin setting file 325 | *.GhostDoc.xml 326 | 327 | # Node.js Tools for Visual Studio 328 | .ntvs_analysis.dat 329 | node_modules/ 330 | 331 | # Visual Studio 6 build log 332 | *.plg 333 | 334 | # Visual Studio 6 workspace options file 335 | *.opt 336 | 337 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 338 | *.vbw 339 | 340 | # Visual Studio LightSwitch build output 341 | **/*.HTMLClient/GeneratedArtifacts 342 | **/*.DesktopClient/GeneratedArtifacts 343 | **/*.DesktopClient/ModelManifest.xml 344 | **/*.Server/GeneratedArtifacts 345 | **/*.Server/ModelManifest.xml 346 | _Pvt_Extensions 347 | 348 | # Paket dependency manager 349 | .paket/paket.exe 350 | paket-files/ 351 | 352 | # FAKE - F# Make 353 | .fake/ 354 | 355 | # CodeRush personal settings 356 | .cr/personal 357 | 358 | # Python Tools for Visual Studio (PTVS) 359 | __pycache__/ 360 | *.pyc 361 | 362 | # Cake - Uncomment if you are using it 363 | # tools/** 364 | # !tools/packages.config 365 | 366 | # Tabs Studio 367 | *.tss 368 | 369 | # Telerik's JustMock configuration file 370 | *.jmconfig 371 | 372 | # BizTalk build output 373 | *.btp.cs 374 | *.btm.cs 375 | *.odx.cs 376 | *.xsd.cs 377 | 378 | # OpenCover UI analysis results 379 | OpenCover/ 380 | 381 | # Azure Stream Analytics local run output 382 | ASALocalRun/ 383 | 384 | # MSBuild Binary and Structured Log 385 | *.binlog 386 | 387 | # NVidia Nsight GPU debugger configuration file 388 | *.nvuser 389 | 390 | # MFractors (Xamarin productivity tool) working folder 391 | .mfractor/ 392 | 393 | # Local History for Visual Studio 394 | .localhistory/ 395 | 396 | # BeatPulse healthcheck temp database 397 | healthchecksdb 398 | 399 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 400 | MigrationBackup/ 401 | 402 | # Ionide (cross platform F# VS Code tools) working folder 403 | .ionide/ 404 | 405 | # Secret Files 406 | google-services.json 407 | 408 | # Rest of Bindings 409 | externals 410 | output 411 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 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.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). 40 | 41 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/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 your 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 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 |  2 | using Android.App; 3 | using Android.Content.PM; 4 | using Android.Runtime; 5 | using Android.OS; 6 | 7 | namespace NotificationHubSample.Droid 8 | { 9 | [Activity(Label = "NotificationHubSample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 10 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 11 | { 12 | protected override void OnCreate(Bundle savedInstanceState) 13 | { 14 | TabLayoutResource = Resource.Layout.Tabbar; 15 | ToolbarResource = Resource.Layout.Toolbar; 16 | 17 | base.OnCreate(savedInstanceState); 18 | 19 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 20 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 21 | LoadApplication(new App()); 22 | } 23 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) 24 | { 25 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 26 | 27 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/NotificationHubSample.Android.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB} 7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df} 9 | Library 10 | NotificationHubSample.Droid 11 | NotificationHubSample.Android 12 | True 13 | True 14 | Resources\Resource.designer.cs 15 | Resource 16 | Properties\AndroidManifest.xml 17 | Resources 18 | Assets 19 | v10.0 20 | true 21 | true 22 | Xamarin.Android.Net.AndroidClientHandler 23 | 24 | 25 | 26 | 27 | true 28 | portable 29 | false 30 | bin\Debug 31 | DEBUG; 32 | prompt 33 | 4 34 | None 35 | 36 | 37 | true 38 | portable 39 | true 40 | bin\Release 41 | prompt 42 | 4 43 | true 44 | false 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | {0661DE01-DD76-4027-96F4-60CAF19362DC} 96 | NotificationHubSample 97 | 98 | 99 | {B7753626-34C8-4981-828B-75D7282C51C2} 100 | Microsoft.Azure.NotificationHubs.Client 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/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 | [assembly: AssemblyTitle("NotificationHubSample.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("NotificationHubSample.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | [assembly: AssemblyVersion("1.0.0.0")] 26 | [assembly: AssemblyFileVersion("1.0.0.0")] 27 | 28 | // Add some common permissions, these can be removed if not needed 29 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 30 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 31 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/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 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/Resource.designer.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | [assembly: global::Android.Runtime.ResourceDesignerAttribute("NotificationHubSample.Droid.Resource", IsApplication=true)] 12 | 13 | namespace NotificationHubSample.Droid 14 | { 15 | 16 | 17 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.1.99.123")] 18 | public partial class Resource 19 | { 20 | 21 | static Resource() 22 | { 23 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 24 | } 25 | 26 | public static void UpdateIdValues() 27 | { 28 | global::Microsoft.Azure.NotificationHubs.Client.Resource.Drawable.ic_launcher = global::NotificationHubSample.Droid.Resource.Drawable.ic_launcher; 29 | global::Microsoft.Azure.NotificationHubs.Client.Resource.Integer.google_play_services_version = global::NotificationHubSample.Droid.Resource.Integer.google_play_services_version; 30 | global::Microsoft.Azure.NotificationHubs.Client.Resource.String.app_name = global::NotificationHubSample.Droid.Resource.String.app_name; 31 | global::Microsoft.Azure.NotificationHubs.Client.Resource.String.common_google_play_services_unknown_issue = global::NotificationHubSample.Droid.Resource.String.common_google_play_services_unknown_issue; 32 | global::Microsoft.Azure.NotificationHubs.Client.Resource.String.fcm_fallback_notification_channel_label = global::NotificationHubSample.Droid.Resource.String.fcm_fallback_notification_channel_label; 33 | global::Microsoft.Azure.NotificationHubs.Client.Resource.String.firebase_preference_file_key = global::NotificationHubSample.Droid.Resource.String.firebase_preference_file_key; 34 | global::Microsoft.Azure.NotificationHubs.Client.Resource.String.installation_enrichment_file_key = global::NotificationHubSample.Droid.Resource.String.installation_enrichment_file_key; 35 | } 36 | 37 | public partial class Attribute 38 | { 39 | 40 | static Attribute() 41 | { 42 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 43 | } 44 | 45 | private Attribute() 46 | { 47 | } 48 | } 49 | 50 | public partial class Color 51 | { 52 | 53 | // aapt resource value: 0x7F010000 54 | public const int colorAccent = 2130771968; 55 | 56 | // aapt resource value: 0x7F010001 57 | public const int colorPrimary = 2130771969; 58 | 59 | // aapt resource value: 0x7F010002 60 | public const int colorPrimaryDark = 2130771970; 61 | 62 | // aapt resource value: 0x7F010003 63 | public const int launcher_background = 2130771971; 64 | 65 | static Color() 66 | { 67 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 68 | } 69 | 70 | private Color() 71 | { 72 | } 73 | } 74 | 75 | public partial class Drawable 76 | { 77 | 78 | // aapt resource value: 0x7F020000 79 | public const int ic_launcher = 2130837504; 80 | 81 | static Drawable() 82 | { 83 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 84 | } 85 | 86 | private Drawable() 87 | { 88 | } 89 | } 90 | 91 | public partial class Id 92 | { 93 | 94 | // aapt resource value: 0x7F030000 95 | public const int APP_NAME = 2130903040; 96 | 97 | // aapt resource value: 0x7F030001 98 | public const int app_name = 2130903041; 99 | 100 | // aapt resource value: 0x7F030002 101 | public const int sliding_tabs = 2130903042; 102 | 103 | // aapt resource value: 0x7F030003 104 | public const int toolbar = 2130903043; 105 | 106 | static Id() 107 | { 108 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 109 | } 110 | 111 | private Id() 112 | { 113 | } 114 | } 115 | 116 | public partial class Integer 117 | { 118 | 119 | // aapt resource value: 0x7F040000 120 | public const int google_play_services_version = 2130968576; 121 | 122 | static Integer() 123 | { 124 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 125 | } 126 | 127 | private Integer() 128 | { 129 | } 130 | } 131 | 132 | public partial class Layout 133 | { 134 | 135 | // aapt resource value: 0x7F050000 136 | public const int Tabbar = 2131034112; 137 | 138 | // aapt resource value: 0x7F050001 139 | public const int Toolbar = 2131034113; 140 | 141 | static Layout() 142 | { 143 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 144 | } 145 | 146 | private Layout() 147 | { 148 | } 149 | } 150 | 151 | public partial class Mipmap 152 | { 153 | 154 | // aapt resource value: 0x7F060000 155 | public const int icon = 2131099648; 156 | 157 | // aapt resource value: 0x7F060001 158 | public const int icon_round = 2131099649; 159 | 160 | // aapt resource value: 0x7F060002 161 | public const int launcher_foreground = 2131099650; 162 | 163 | static Mipmap() 164 | { 165 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 166 | } 167 | 168 | private Mipmap() 169 | { 170 | } 171 | } 172 | 173 | public partial class String 174 | { 175 | 176 | // aapt resource value: 0x7F070000 177 | public const int app_name = 2131165184; 178 | 179 | // aapt resource value: 0x7F070001 180 | public const int common_google_play_services_unknown_issue = 2131165185; 181 | 182 | // aapt resource value: 0x7F070002 183 | public const int fcm_fallback_notification_channel_label = 2131165186; 184 | 185 | // aapt resource value: 0x7F070003 186 | public const int firebase_preference_file_key = 2131165187; 187 | 188 | // aapt resource value: 0x7F070004 189 | public const int installation_enrichment_file_key = 2131165188; 190 | 191 | static String() 192 | { 193 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 194 | } 195 | 196 | private String() 197 | { 198 | } 199 | } 200 | 201 | public partial class Style 202 | { 203 | 204 | // aapt resource value: 0x7F080000 205 | public const int AppCompatDialogStyle = 2131230720; 206 | 207 | // aapt resource value: 0x7F080001 208 | public const int MainTheme = 2131230721; 209 | 210 | // aapt resource value: 0x7F080002 211 | public const int MainTheme_Base = 2131230722; 212 | 213 | static Style() 214 | { 215 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 216 | } 217 | 218 | private Style() 219 | { 220 | } 221 | } 222 | } 223 | } 224 | #pragma warning restore 1591 225 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/layout/Tabbar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/layout/Toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 24 | 27 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace NotificationHubSample.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 | LoadApplication(new App()); 27 | 28 | return base.FinishedLaunching(app, options); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.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 | 9.0 25 | CFBundleDisplayName 26 | NotificationHubSample 27 | CFBundleIdentifier 28 | com.microsoft.NotificationHubSample 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | NotificationHubSample 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | UIBackgroundModes 38 | 39 | remote-notification 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace NotificationHubSample.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, typeof(AppDelegate)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/NotificationHubSample.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | iPhoneSimulator 6 | 8.0.30703 7 | 2.0 8 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9} 9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {6143fdea-f3c2-4a09-aafa-6e230626515e} 11 | Exe 12 | NotificationHubSample.iOS 13 | Resources 14 | NotificationHubSample.iOS 15 | true 16 | NSUrlSessionHandler 17 | automatic 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\iPhoneSimulator\Debug 24 | DEBUG 25 | prompt 26 | 4 27 | x86_64 28 | None 29 | true 30 | 31 | 32 | none 33 | true 34 | bin\iPhoneSimulator\Release 35 | prompt 36 | 4 37 | None 38 | x86_64 39 | 40 | 41 | true 42 | full 43 | false 44 | bin\iPhone\Debug 45 | DEBUG 46 | prompt 47 | 4 48 | ARM64 49 | iPhone Developer 50 | true 51 | Entitlements.plist 52 | None 53 | -all 54 | 55 | 56 | none 57 | true 58 | bin\iPhone\Release 59 | prompt 60 | 4 61 | ARM64 62 | iPhone Developer 63 | Entitlements.plist 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | false 76 | 77 | 78 | false 79 | 80 | 81 | false 82 | 83 | 84 | false 85 | 86 | 87 | false 88 | 89 | 90 | false 91 | 92 | 93 | false 94 | 95 | 96 | false 97 | 98 | 99 | false 100 | 101 | 102 | false 103 | 104 | 105 | false 106 | 107 | 108 | false 109 | 110 | 111 | false 112 | 113 | 114 | false 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | {0661DE01-DD76-4027-96F4-60CAF19362DC} 132 | NotificationHubSample 133 | 134 | 135 | {B7753626-34C8-4981-828B-75D7282C51C2} 136 | Microsoft.Azure.NotificationHubs.Client 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.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 | [assembly: AssemblyTitle("NotificationHubSample.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NotificationHubSample.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Resources/Default.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/NotificationHubSample.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /samples/NotificationHubSample.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 | -------------------------------------------------------------------------------- /samples/NotificationHubSample.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 16 3 | VisualStudioVersion = 16.0.30204.135 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.NotificationHubs.Client", "..\src\Microsoft.Azure.NotificationHubs.Client\Microsoft.Azure.NotificationHubs.Client.csproj", "{B7753626-34C8-4981-828B-75D7282C51C2}" 6 | EndProject 7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationHubSample.Android", "NotificationHubSample.Android\NotificationHubSample.Android.csproj", "{083F45FF-F7EC-4E50-B279-A81A9B1246FB}" 8 | EndProject 9 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationHubSample.iOS", "NotificationHubSample.iOS\NotificationHubSample.iOS.csproj", "{0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}" 10 | EndProject 11 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationHubSample", "NotificationHubSample\NotificationHubSample.csproj", "{0661DE01-DD76-4027-96F4-60CAF19362DC}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Debug|anycpu = Debug|anycpu 17 | Debug|iPhone = Debug|iPhone 18 | Debug|iPhoneSimulator = Debug|iPhoneSimulator 19 | Release|Any CPU = Release|Any CPU 20 | Release|anycpu = Release|anycpu 21 | Release|iPhone = Release|iPhone 22 | Release|iPhoneSimulator = Release|iPhoneSimulator 23 | EndGlobalSection 24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 25 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|anycpu.ActiveCfg = Debug|Any CPU 28 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|anycpu.Build.0 = Debug|Any CPU 29 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|iPhone.ActiveCfg = Debug|Any CPU 30 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|iPhone.Build.0 = Debug|Any CPU 31 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 32 | {B7753626-34C8-4981-828B-75D7282C51C2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 33 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|anycpu.ActiveCfg = Release|Any CPU 36 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|anycpu.Build.0 = Release|Any CPU 37 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|iPhone.ActiveCfg = Release|Any CPU 38 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|iPhone.Build.0 = Release|Any CPU 39 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 40 | {B7753626-34C8-4981-828B-75D7282C51C2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 41 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 42 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|Any CPU.Build.0 = Debug|Any CPU 43 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 44 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|anycpu.ActiveCfg = Debug|Any CPU 45 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|anycpu.Build.0 = Debug|Any CPU 46 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|iPhone.ActiveCfg = Debug|Any CPU 47 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|iPhone.Build.0 = Debug|Any CPU 48 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 49 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 50 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|Any CPU.ActiveCfg = Release|Any CPU 51 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|Any CPU.Build.0 = Release|Any CPU 52 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|anycpu.ActiveCfg = Release|Any CPU 53 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|anycpu.Build.0 = Release|Any CPU 54 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|iPhone.ActiveCfg = Release|Any CPU 55 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|iPhone.Build.0 = Release|Any CPU 56 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 57 | {083F45FF-F7EC-4E50-B279-A81A9B1246FB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 58 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator 59 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator 60 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|anycpu.ActiveCfg = Debug|iPhoneSimulator 61 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|anycpu.Build.0 = Debug|iPhoneSimulator 62 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|iPhone.ActiveCfg = Debug|iPhone 63 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|iPhone.Build.0 = Debug|iPhone 64 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator 65 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator 66 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator 67 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|Any CPU.Build.0 = Release|iPhoneSimulator 68 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|anycpu.ActiveCfg = Release|iPhoneSimulator 69 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|anycpu.Build.0 = Release|iPhoneSimulator 70 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|iPhone.ActiveCfg = Release|iPhone 71 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|iPhone.Build.0 = Release|iPhone 72 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator 73 | {0DE139B0-F9D1-4D3F-9B58-D7AD9C07BCA9}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator 74 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 75 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|Any CPU.Build.0 = Debug|Any CPU 76 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|anycpu.ActiveCfg = Debug|Any CPU 77 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|anycpu.Build.0 = Debug|Any CPU 78 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|iPhone.ActiveCfg = Debug|Any CPU 79 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|iPhone.Build.0 = Debug|Any CPU 80 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU 81 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU 82 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|Any CPU.ActiveCfg = Release|Any CPU 83 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|Any CPU.Build.0 = Release|Any CPU 84 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|anycpu.ActiveCfg = Release|Any CPU 85 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|anycpu.Build.0 = Release|Any CPU 86 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|iPhone.ActiveCfg = Release|Any CPU 87 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|iPhone.Build.0 = Release|Any CPU 88 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU 89 | {0661DE01-DD76-4027-96F4-60CAF19362DC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU 90 | EndGlobalSection 91 | GlobalSection(SolutionProperties) = preSolution 92 | HideSolutionNode = FALSE 93 | EndGlobalSection 94 | GlobalSection(ExtensibilityGlobals) = postSolution 95 | SolutionGuid = {B813118B-21CC-46F5-89AB-F6717C9C3C4D} 96 | EndGlobalSection 97 | EndGlobal 98 | -------------------------------------------------------------------------------- /samples/NotificationHubSample/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/NotificationHubSample/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xamarin.Forms; 3 | using Xamarin.Forms.Xaml; 4 | 5 | namespace NotificationHubSample 6 | { 7 | public partial class App : Application 8 | { 9 | public App() 10 | { 11 | InitializeComponent(); 12 | 13 | MainPage = new MainPage(); 14 | } 15 | 16 | protected override void OnStart() 17 | { 18 | } 19 | 20 | protected override void OnSleep() 21 | { 22 | } 23 | 24 | protected override void OnResume() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/NotificationHubSample/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.Xaml; 2 | 3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] -------------------------------------------------------------------------------- /samples/NotificationHubSample/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace NotificationHubSample 2 | { 3 | public static class Constants 4 | { 5 | public static string ConnectionString = "Endpoint=sb://xamarinforms-matthewp-ns.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=oz/3QRQJqtu6veNzwk+udvicxoHwdHsQ1PxQcOQor2U="; 6 | public static string HubName = "xamarinforms-matthewp-hub"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/NotificationHubSample/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /samples/NotificationHubSample/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using Xamarin.Forms; 4 | using Microsoft.Azure.NotificationHubs.Client; 5 | 6 | namespace NotificationHubSample 7 | { 8 | // Learn more about making custom code visible in the Xamarin.Forms previewer 9 | // by visiting https://aka.ms/xamarinforms-previewer 10 | [DesignTimeVisible(false)] 11 | public partial class MainPage : ContentPage 12 | { 13 | 14 | public MainPage() 15 | { 16 | InitializeComponent(); 17 | 18 | // Add a handler for receiving push notifications 19 | NotificationHub.NotificationMessageReceived += OnNotificationMessageReceived; 20 | 21 | // Add handlers for save and save failed for installations 22 | NotificationHub.InstallationSaved += OnInstallatedSaved; 23 | NotificationHub.InstallationSaveFailed += OnInstallationSaveFailed; 24 | 25 | // Create Notification Hub 26 | NotificationHub.Start(Constants.ConnectionString, Constants.HubName); 27 | 28 | // Add a tag 29 | NotificationHub.AddTag("platform_XamarinForms"); 30 | } 31 | 32 | private void OnInstallationSaveFailed(object sender, InstallationSaveFailedEventArgs e) 33 | { 34 | Console.WriteLine($"Failed to save installation: {e.Exception.Message}"); 35 | } 36 | 37 | private void OnInstallatedSaved(object sender, InstallationSavedEventArgs e) 38 | { 39 | Console.WriteLine($"Installation ID: {e.Installation.InstallationId} saved successfully"); 40 | } 41 | 42 | private void OnNotificationMessageReceived(object sender, NotificationMessageReceivedEventArgs e) 43 | { 44 | // Write the message contents 45 | Console.WriteLine(e.Title); 46 | Console.WriteLine(e.Body); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /samples/NotificationHubSample/NotificationHubSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | true 6 | 7 | 8 | 9 | portable 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/README.md: -------------------------------------------------------------------------------- 1 | # Sample applications for Azure Notification Hubs SDK for Xamarin 2 | 3 | This directory contains the sample applications for the following: 4 | 5 | - [Xamarin.Forms](NotificationHubSample) 6 | - [Xamarin.iOS](bindings/NHubSampleXamariniOS) 7 | - [Xamarin.Android](bindings/NHubSampleXamarinAndroid) 8 | 9 | ## Xamarin Forms 10 | 11 | The [Xamarin.Forms](NotificationHubSample) uses the `Microsoft.Azure.NotificationHubs.Client` source project to create a cross platform implementation using Azure Notification Hubs. This sample provides support for both iOS and Android. This sample only needs code in the main NotificationHubSample project to start the SDK and listen for messages. 12 | 13 | In the `MainPage.xaml` file, you can initialize the Azure Notification Hubs using the followingc code to listen for messages, set up installation lifecycle management, and to initialize the SDK with the Access Policy connection string and hub name. 14 | 15 | ```csharp 16 | using Microsoft.Azure.NotificationHubs.Client; 17 | 18 | public class MainPage 19 | { 20 | public MainPage() 21 | { 22 | InitializeComponent(); 23 | 24 | // Listen for messages 25 | NotificationHub.NotificationMessageReceived += OnNotificationMessageReceived; 26 | 27 | // Listen for installation save updates/failures 28 | NotificationHub.InstallationSaved += OnInstallatedSaved; 29 | NotificationHub.InstallationSaveFailed += OnInstallationSaveFailed; 30 | 31 | // Start the SDK 32 | NotificationHub.Start(Constants.ConnectionString, Constants.HubName); 33 | } 34 | } 35 | ``` 36 | 37 | We can then listen for messages using the `OnNotificationMessageReceived` method which has the title, body, and dictionary of the message itself. Here, you can display the message contents. 38 | 39 | ```csharp 40 | private void OnNotificationMessageReceived(object sender, NotificationMessageReceivedEventArgs e) 41 | { 42 | // Write the message contents 43 | Console.WriteLine(e.Title); 44 | Console.WriteLine(e.Body); 45 | } 46 | ``` 47 | 48 | We can listen for installation saved success or failures which can be helpful for diagnosing issues. 49 | 50 | ```csharp 51 | private void OnInstallationSaveFailed(object sender, InstallationSaveFailedEventArgs e) 52 | { 53 | Console.WriteLine($"Failed to save installation: {e.Exception.Message}"); 54 | } 55 | 56 | private void OnInstallatedSaved(object sender, InstallationSavedEventArgs e) 57 | { 58 | Console.WriteLine($"Installation ID: {e.Installation.InstallationId} saved successfully"); 59 | } 60 | ``` 61 | 62 | ## Xamarin.iOS 63 | 64 | We also have a [Xamarin.iOS](bindings/NHubSampleXamariniOS) sample which shows the basic usage of the [Xamarin.Azure.NotificationHubs.iOS](https://www.nuget.org/packages/Xamarin.Azure.NotificationHubs.iOS/) NuGet package which is published through the [Xamarin Components](https://github.com/xamarin/XamarinComponents/tree/master/XPlat/AzureMessaging) repository. 65 | 66 | To get started, register for messages in the `AppDelegate.cs` class with the following code to listen for messages, set up installation lifecycle management, and to initialize the SDK with the Access Policy connection string and hub name. 67 | 68 | ```csharp 69 | using WindowsAzure.Messaging.NotificationHubs; 70 | 71 | [Register("AppDelegate")] 72 | public class AppDelegate : UIResponder, IUIApplicationDelegate 73 | { 74 | [Export("application:didFinishLaunchingWithOptions:")] 75 | public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) 76 | { 77 | // Listen for messages 78 | MSNotificationHub.SetDelegate(new NotificationDelegate()); 79 | 80 | // Listen for installation saved success/failure 81 | MSNotificationHub.SetLifecycleDelegate(new InstallationLifecycleDelegate()); 82 | 83 | // Start the Notification Hub SDK 84 | MSNotificationHub.Start(Constants.ConnectionString, Constants.HubName); 85 | 86 | return true; 87 | } 88 | } 89 | ``` 90 | 91 | To listen for messages from APNS, create a class that inherits from `MSNotificationHubDelegate` which has the `DidReceivePushNotification` method. 92 | 93 | ```csharp 94 | public class NotificationDelegate : MSNotificationHubDelegate 95 | { 96 | public override void DidReceivePushNotification(MSNotificationHub notificationHub, MSNotificationHubMessage message) 97 | { 98 | // Determine whether in foreground or background 99 | if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Background) 100 | { 101 | Console.WriteLine($"Message received in the background with title {message.Title} and body {message.Body}"); 102 | } 103 | else 104 | { 105 | Console.WriteLine($"Message received in the foreground with title {message.Title} and body {message.Body}"); 106 | } 107 | } 108 | } 109 | ``` 110 | 111 | To listen to lifecycle management such as whether the installation save succeeded or failed on the backend, you can implement a class which inherits from the `MSInstallationLifecycleDelegate` class. 112 | 113 | ```csharp 114 | public class InstallationLifecycleDelegate : MSInstallationLifecycleDelegate 115 | { 116 | public override void DidFailToSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation, NSError error) 117 | { 118 | Console.WriteLine($"Save installation failed with exception: {error.LocalizedDescription}"); 119 | } 120 | 121 | public override void DidSaveInstallation(MSNotificationHub notificationHub, MSInstallation installation) 122 | { 123 | Console.WriteLine($"Installation successfully saved with Installation ID: {installation.InstallationId}"); 124 | } 125 | } 126 | ``` 127 | 128 | ## Xamarin.Android 129 | 130 | In addition to Xamarin Forms, we also have a sample using [Xamarin.Android](bindings/NHubSampleXamarinAndroid) which shows the basic usage of the [Xamarin.Azure.NotificationHubs.Android](https://www.nuget.org/packages/Xamarin.Azure.NotificationHubs.Android/) NuGet package which is published through the [Xamarin Components](https://github.com/xamarin/XamarinComponents/tree/master/XPlat/AzureMessaging) repository. 131 | 132 | To get started, register for messages in the `MainActivity.cs` class with the following code to listen for messages, set up installation lifecycle management, and to initialize the SDK with the Access Policy connection string and hub name. 133 | 134 | ```csharp 135 | using WindowsAzure.Messaging.NotificationHubs; 136 | 137 | public class MainActivity : AppCompatActivity 138 | { 139 | protected override void OnCreate(Bundle savedInstanceState) 140 | { 141 | // Set listener for receiving messages 142 | NotificationHub.SetListener(new SampleNotificationListener()); 143 | 144 | // Set listener for installation save success and failure 145 | NotificationHub.SetInstallationSavedListener(new InstallationSavedListener()); 146 | NotificationHub.SetInstallationSaveFailureListener(new InstallationSaveFailedListener()); 147 | 148 | // Initialize with hub name and connection string 149 | NotificationHub.Start(Application, Constants.HubName, Constants.ConnectionString); 150 | } 151 | } 152 | ``` 153 | 154 | To listen for messages from Firebase, create a class that inherits from `INotificationListener` interface which has the `OnPushNotificationReceived` method. 155 | 156 | ```csharp 157 | public class SampleNotificationListener : Java.Lang.Object, INotificationListener 158 | { 159 | public void OnPushNotificationReceived(Context context, INotificationMessage message) 160 | { 161 | Console.WriteLine($"Message received with title {message.Title} and body {message.Body}"); 162 | } 163 | } 164 | ``` 165 | 166 | To listen to lifecycle management such as whether the installation save succeeded or failed on the backend, you can implement classes which inherits from the `IInstallationAdapterListener` interface for successful saves with the `OnInstallationSaved` method which contains the current `Installation`. 167 | 168 | ```csharp 169 | // Listen for installation saved success 170 | public class InstallationSavedListener : Java.Lang.Object, IInstallationAdapterListener 171 | { 172 | public void OnInstallationSaved(Installation installation) 173 | { 174 | Console.WriteLine($"Installation successfully saved with Installation ID: {installation.InstallationId}"); 175 | } 176 | } 177 | ``` 178 | 179 | We can then listen for installation saved failures using the `IInstallationAdapterErrorListener` interface which has the `OnInstallationSaveError` method with the exception. 180 | 181 | ```csharp 182 | public class InstallationSaveFailedListener : Java.Lang.Object, IInstallationAdapterErrorListener 183 | { 184 | public void OnInstallationSaveError(Java.Lang.Exception javaException) 185 | { 186 | var exception = Throwable.FromException(javaException); 187 | Console.WriteLine($"Save installation failed with exception: {exception.Message}"); 188 | } 189 | } 190 | ``` 191 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/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 your 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"); -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/InstallationEnrichmentVisitor.cs: -------------------------------------------------------------------------------- 1 | using WindowsAzure.Messaging.NotificationHubs; 2 | 3 | namespace NHubSampleXamarinAndroid 4 | { 5 | public class InstallationEnrichmentVisitor : Java.Lang.Object, IInstallationVisitor 6 | { 7 | public void VisitInstallation(Installation installation) 8 | { 9 | // Add a sample tag 10 | installation.AddTag("platform_XamarinAndroid"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/InstallationSaveFailedListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Java.Lang; 3 | using WindowsAzure.Messaging.NotificationHubs; 4 | 5 | namespace NHubSampleXamarinAndroid 6 | { 7 | public class InstallationSaveFailedListener : Java.Lang.Object, IInstallationAdapterErrorListener 8 | { 9 | public InstallationSaveFailedListener() 10 | { 11 | } 12 | 13 | public void OnInstallationSaveError(Java.Lang.Exception javaException) 14 | { 15 | var exception = Throwable.FromException(javaException); 16 | Console.WriteLine($"Save installation failed with exception: {exception.Message}"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/InstallationSavedListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using WindowsAzure.Messaging.NotificationHubs; 3 | 4 | namespace NHubSampleXamarinAndroid 5 | { 6 | public class InstallationSavedListener : Java.Lang.Object, IInstallationAdapterListener 7 | { 8 | public void OnInstallationSaved(Installation installation) 9 | { 10 | Console.WriteLine($"Installation successfully saved with Installation ID: {installation.InstallationId}"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Android.App; 4 | using Android.OS; 5 | using Android.Runtime; 6 | using Android.Support.Design.Widget; 7 | using Android.Support.V7.App; 8 | using Android.Views; 9 | using WindowsAzure.Messaging.NotificationHubs; 10 | using Xamarin.Essentials; 11 | 12 | namespace NHubSampleXamarinAndroid 13 | { 14 | [Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar", MainLauncher = true)] 15 | public class MainActivity : AppCompatActivity 16 | { 17 | protected override void OnCreate(Bundle savedInstanceState) 18 | { 19 | base.OnCreate(savedInstanceState); 20 | Xamarin.Essentials.Platform.Init(this, savedInstanceState); 21 | SetContentView(Resource.Layout.activity_main); 22 | 23 | // Read the connections and hub name from somewhere 24 | var connectionString = ""; 25 | var hubName = ""; 26 | 27 | // Set listener for receiving messages 28 | NotificationHub.SetListener(new SampleNotificationListener()); 29 | 30 | // Set an enrichment visitor 31 | NotificationHub.UseVisitor(new InstallationEnrichmentVisitor()); 32 | 33 | // Set listener for installation save success and failure 34 | NotificationHub.SetInstallationSavedListener(new InstallationSavedListener()); 35 | NotificationHub.SetInstallationSaveFailureListener(new InstallationSaveFailedListener()); 36 | 37 | // Initialize with hub name and connection string 38 | NotificationHub.Start(Application, hubName, connectionString); 39 | 40 | // Add a tag 41 | NotificationHub.AddTag("target_XamarinAndroid"); 42 | 43 | Android.Support.V7.Widget.Toolbar toolbar = FindViewById(Resource.Id.toolbar); 44 | SetSupportActionBar(toolbar); 45 | 46 | FloatingActionButton fab = FindViewById(Resource.Id.fab); 47 | fab.Click += FabOnClick; 48 | } 49 | 50 | public void AddTags() 51 | { 52 | var language = Resources.Configuration.Locales.Get(0).Language; 53 | var countryCode = Resources.Configuration.Locales.Get(0).Country; 54 | 55 | var languageTag = $"language_{language}"; 56 | var countryCodeTag = $"country_{countryCode}"; 57 | 58 | NotificationHub.AddTags(new [] { languageTag, countryCodeTag }); 59 | } 60 | 61 | public void AddTemplate() 62 | { 63 | var language = Resources.Configuration.Locales.Get(0).Language; 64 | var countryCode = Resources.Configuration.Locales.Get(0).Country; 65 | 66 | var languageTag = $"language_{language}"; 67 | var countryCodeTag = $"country_{countryCode}"; 68 | 69 | var body = "{\"data\":{\"message\":\"$(message)\"}}"; 70 | var template = new InstallationTemplate(); 71 | template.Body = body; 72 | 73 | template.AddTags(new[] { languageTag, countryCodeTag }); 74 | 75 | NotificationHub.SetTemplate("template1", template); 76 | } 77 | 78 | public override bool OnCreateOptionsMenu(IMenu menu) 79 | { 80 | MenuInflater.Inflate(Resource.Menu.menu_main, menu); 81 | return true; 82 | } 83 | 84 | public override bool OnOptionsItemSelected(IMenuItem item) 85 | { 86 | int id = item.ItemId; 87 | if (id == Resource.Id.action_settings) 88 | { 89 | return true; 90 | } 91 | 92 | return base.OnOptionsItemSelected(item); 93 | } 94 | 95 | private void FabOnClick(object sender, EventArgs eventArgs) 96 | { 97 | View view = (View)sender; 98 | Snackbar.Make(view, "Replace with your own action", Snackbar.LengthLong) 99 | .SetAction("Action", (View.IOnClickListener)null).Show(); 100 | } 101 | 102 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) 103 | { 104 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); 105 | 106 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/NHubSampleXamarinAndroid.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {37D1A3E8-3A1D-4A57-9BB8-3491162637B1} 9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | {84dd83c5-0fe3-4294-9419-09e7c8ba324f} 11 | Library 12 | Properties 13 | NHubSampleXamarinAndroid 14 | NHubSampleXamarinAndroid 15 | 512 16 | True 17 | True 18 | Resources\Resource.designer.cs 19 | Resource 20 | Off 21 | v10.0 22 | Properties\AndroidManifest.xml 23 | Resources 24 | Assets 25 | true 26 | true 27 | 28 | 29 | True 30 | portable 31 | False 32 | bin\Debug\ 33 | DEBUG;TRACE 34 | prompt 35 | 4 36 | True 37 | None 38 | False 39 | 40 | 41 | True 42 | portable 43 | True 44 | bin\Release\ 45 | TRACE 46 | prompt 47 | 4 48 | true 49 | False 50 | SdkOnly 51 | True 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Designer 79 | 80 | 81 | Designer 82 | 83 | 84 | 85 | 86 | 87 | 88 | 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 | 124 | 125 | 126 | 127 | 128 | 129 | 136 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/NHubSampleXamarinAndroid.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHubSampleXamarinAndroid", "NHubSampleXamarinAndroid.csproj", "{37D1A3E8-3A1D-4A57-9BB8-3491162637B1}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {37D1A3E8-3A1D-4A57-9BB8-3491162637B1}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/NotificationListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Content; 3 | using WindowsAzure.Messaging.NotificationHubs; 4 | 5 | namespace NHubSampleXamarinAndroid 6 | { 7 | public class SampleNotificationListener : Java.Lang.Object, INotificationListener 8 | { 9 | public SampleNotificationListener() 10 | { 11 | } 12 | 13 | public void OnPushNotificationReceived(Context context, INotificationMessage message) 14 | { 15 | Console.WriteLine($"Message received with title {message.Title} and body {message.Body}"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/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 | [assembly: AssemblyTitle("NHubSampleXamarinAndroid")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("NHubSampleXamarinAndroid")] 14 | [assembly: AssemblyCopyright("Copyright © 2018")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | [assembly: AssemblyVersion("1.0.0.0")] 26 | [assembly: AssemblyFileVersion("1.0.0.0")] 27 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/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/ 12 | icon.png 13 | 14 | layout/ 15 | main.xml 16 | 17 | values/ 18 | strings.xml 19 | 20 | In order to get the build system to recognize Android resources, set the build action to 21 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 22 | instead operate on resource IDs. When you compile an Android application that uses resources, 23 | the build system will package the resources for distribution and generate a class called "R" 24 | (this is an Android convention) that contains the tokens for each one of the resources 25 | included. For example, for the above Resources layout, this is what the R class would expose: 26 | 27 | public class R { 28 | public class drawable { 29 | public const int icon = 0x123; 30 | } 31 | 32 | public class layout { 33 | public const int main = 0x456; 34 | } 35 | 36 | public class strings { 37 | public const int first_string = 0xabc; 38 | public const int second_string = 0xbcd; 39 | } 40 | } 41 | 42 | You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main 43 | to reference the layout/main.xml file, or R.strings.first_string to reference the first 44 | string in the dictionary file values/strings.xml. -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-notificationhubs-xamarin/3d8ef12a4ff09a9b48165ebd932b333fbdf3474c/samples/bindings/NHubSampleXamarinAndroid/Resources/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2c3e50 4 | #1B3147 5 | #3498db 6 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #2C3E50 4 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NHubSampleXamarinAndroid 4 | Settings 5 | -------------------------------------------------------------------------------- /samples/bindings/NHubSampleXamarinAndroid/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 14 |