Exemplo n.º 1
0
    void Start()
    {
        extraMessage = null;

        // Enable line below to debug issues with setuping OneSignal. (logLevel, visualLogLevel)
        OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);

        // If you set to true, the user will have to provide consent
        // using OneSignal.UserDidProvideConsent(true) before the
        // SDK will initialize
        OneSignal.SetRequiresUserPrivacyConsent(requiresUserPrivacyConsent);

        // The only required method you need to call to setup OneSignal to receive push notifications.
        // Call before using any other methods on OneSignal (except setLogLevel or SetRequiredUserPrivacyConsent)
        // Should only be called once when your app is loaded.
        // OneSignal.Init(OneSignal_AppId);
        OneSignal.StartInit("241adf49-a128-4b4b-830a-5edd482602b3")
        .HandleNotificationReceived(HandleNotificationReceived)
        .HandleNotificationOpened(HandleNotificationOpened)
        .HandleInAppMessageClicked(HandlerInAppMessageClicked)
        .EndInit();

        OneSignal.inFocusDisplayType         = OneSignal.OSInFocusDisplayOption.Notification;
        OneSignal.permissionObserver        += OneSignal_permissionObserver;
        OneSignal.subscriptionObserver      += OneSignal_subscriptionObserver;
        OneSignal.emailSubscriptionObserver += OneSignal_emailSubscriptionObserver;

        var pushState = OneSignal.GetPermissionSubscriptionState();

        OneSignalInAppMessageTriggerExamples();
    }