diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 5509140f..00000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.DS_Store diff --git a/Example.Shared.Application/Droid/MainActivity.cs b/Example.Shared.Application/Droid/MainActivity.cs index 7c41a423..fb977e4d 100644 --- a/Example.Shared.Application/Droid/MainActivity.cs +++ b/Example.Shared.Application/Droid/MainActivity.cs @@ -14,29 +14,65 @@ public class MainActivity : Activity protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); + + OneSignal.NotificationReceived exampleNotificationReceivedDelegate = delegate (OSNotification notification) + { + try + { + System.Console.WriteLine("OneSignal Notification Received:\nMessage: {0}", notification.payload.body); + Dictionary additionalData = notification.payload.additionalData; + + if (additionalData.Count > 0) + System.Console.WriteLine("additionalData: {0}", additionalData); + } + catch (System.Exception e) + { + System.Console.WriteLine(e.StackTrace); + } + }; - // Notification Opened Delegate - OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate(string message, Dictionary additionalData, bool isActive) { - try - { - System.Console.WriteLine ("OneSignal Notification opened:\nMessage: {0}", message); - - if (additionalData != null) - { - if (additionalData.ContainsKey("customKey")) - System.Console.WriteLine ("customKey: {0}", additionalData ["customKey"]); - - System.Console.WriteLine ("additionalData: {0}", additionalData); - } - } - catch (System.Exception e) - { - System.Console.WriteLine (e.StackTrace); - } - }; + // Notification Opened Delegate + OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate (OSNotificationOpenedResult result) + { + try + { + System.Console.WriteLine("OneSignal Notification opened:\nMessage: {0}", result.notification.payload.body); + Dictionary additionalData = result.notification.payload.additionalData; + if (additionalData.Count > 0) + System.Console.WriteLine("additionalData: {0}", additionalData); + + + List> actionButtons = result.notification.payload.actionButtons; + if (actionButtons.Count > 0) + System.Console.WriteLine("actionButtons: {0}", actionButtons); + } + catch (System.Exception e) + { + System.Console.WriteLine(e.StackTrace); + } + }; + + // Initialize OneSignal + OneSignal.StartInit("4ba9ec31-b65a-4f5f-b210-a5077a245b3d", "703322744261") + .HandleNotificationReceived(exampleNotificationReceivedDelegate) + .HandleNotificationOpened(exampleNotificationOpenedDelegate) + .InFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification) + .Settings(new Dictionary { { OneSignal.kOSSettingsKeyAutoPrompt, true }, { OneSignal.kOSSettingsKeyInAppLaunchURL, false } }) + .EndInit(); - // Initialize OneSignal - OneSignal.Init (exampleNotificationOpenedDelegate); + OneSignal.IdsAvailable((playerID, pushToken) => + { + try + { + System.Console.WriteLine("Player ID: " + playerID); + if (pushToken != null) + System.Console.WriteLine("Push Token: " + pushToken); + } + catch (System.Exception e) + { + System.Console.WriteLine(e.StackTrace); + } + }); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); diff --git a/Example.Shared.Application/Droid/Properties/AndroidManifest.xml b/Example.Shared.Application/Droid/Properties/AndroidManifest.xml index 06b907e0..a95a7282 100644 --- a/Example.Shared.Application/Droid/Properties/AndroidManifest.xml +++ b/Example.Shared.Application/Droid/Properties/AndroidManifest.xml @@ -10,10 +10,6 @@ - - diff --git a/Example.Shared.Application/Droid/Resources/Resource.designer.cs b/Example.Shared.Application/Droid/Resources/Resource.designer.cs index 444e5e55..778f5103 100644 --- a/Example.Shared.Application/Droid/Resources/Resource.designer.cs +++ b/Example.Shared.Application/Droid/Resources/Resource.designer.cs @@ -2,7 +2,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.17020 +// Mono Runtime Version: 4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -241,7 +241,7 @@ public partial class Drawable public const int common_signin_btn_text_pressed_light = 2130837529; // aapt resource value: 0x7f02001a - public const int monoandroidsplash = 2130837530; + public const int ic_os_notification_fallback_white_24dp = 2130837530; // aapt resource value: 0x7f02001b public const int powered_by_google_dark = 2130837531; @@ -280,6 +280,15 @@ public partial class Id // aapt resource value: 0x7f0a0002 public const int normal = 2131361794; + // aapt resource value: 0x7f0a0008 + public const int os_bgimage_notif_bgimage = 2131361800; + + // aapt resource value: 0x7f0a000a + public const int os_bgimage_notif_body = 2131361802; + + // aapt resource value: 0x7f0a0009 + public const int os_bgimage_notif_title = 2131361801; + // aapt resource value: 0x7f0a0003 public const int satellite = 2131361795; @@ -318,6 +327,9 @@ public partial class Layout // aapt resource value: 0x7f040000 public const int Main = 2130968576; + // aapt resource value: 0x7f040001 + public const int onesignal_bgimage_notif_layout = 2130968577; + static Layout() { global::Android.Runtime.ResourceIdManager.UpdateIdValues(); @@ -502,9 +514,6 @@ private String() public partial class Style { - // aapt resource value: 0x7f070001 - public const int Mono_Android_Theme_Splash = 2131165185; - // aapt resource value: 0x7f070000 public const int Theme_IAPTheme = 2131165184; diff --git a/Example.Shared.Application/Droid/obj/Debug/R.cs.flag b/Example.Shared.Application/Droid/obj/Debug/R.cs.flag deleted file mode 100644 index e69de29b..00000000 diff --git a/Example.Shared.Application/Droid/obj/Debug/android/com/companyname/example_shared_application/R.java b/Example.Shared.Application/Droid/obj/Debug/android/com/companyname/example_shared_application/R.java deleted file mode 100644 index 54b7e655..00000000 --- a/Example.Shared.Application/Droid/obj/Debug/android/com/companyname/example_shared_application/R.java +++ /dev/null @@ -1,32 +0,0 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package com.companyname.example_shared_application; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int monoandroidsplash=0x7f020000; - } - public static final class id { - public static final int myButton=0x7f070000; - } - public static final class layout { - public static final int main=0x7f040000; - } - public static final class mipmap { - public static final int icon=0x7f030000; - } - public static final class string { - public static final int app_name=0x7f050001; - public static final int hello=0x7f050000; - } - public static final class style { - public static final int Mono_Android_Theme_Splash=0x7f060000; - } -} diff --git a/Example.Shared.Application/Droid/obj/Debug/libraryimports.cache b/Example.Shared.Application/Droid/obj/Debug/libraryimports.cache deleted file mode 100644 index d74d7c0c..00000000 --- a/Example.Shared.Application/Droid/obj/Debug/libraryimports.cache +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Example.Shared.Application/Droid/obj/Debug/libraryprojectimports.cache b/Example.Shared.Application/Droid/obj/Debug/libraryprojectimports.cache deleted file mode 100644 index 0aa225f2..00000000 --- a/Example.Shared.Application/Droid/obj/Debug/libraryprojectimports.cache +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Example.Shared.Application/Droid/obj/Debug/res/drawable/monoandroidsplash.png b/Example.Shared.Application/Droid/obj/Debug/res/drawable/monoandroidsplash.png deleted file mode 100644 index a76ad0cd..00000000 Binary files a/Example.Shared.Application/Droid/obj/Debug/res/drawable/monoandroidsplash.png and /dev/null differ diff --git a/Example.Shared.Application/Droid/obj/Debug/res/layout/main.xml b/Example.Shared.Application/Droid/obj/Debug/res/layout/main.xml deleted file mode 100644 index b944ff58..00000000 --- a/Example.Shared.Application/Droid/obj/Debug/res/layout/main.xml +++ /dev/null @@ -1 +0,0 @@ -