Push Notifications

Discussion in 'Buildbox General Discussion' started by Nasser, Aug 8, 2016.

  1. Nasser

    Nasser Boxer

    Joined:
    Jul 13, 2016
    Messages:
    30
    Likes Received:
    20
    Sporty and Christoph like this.
  2. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    How did you implement it?
     
  3. qbeesoft

    qbeesoft Avid Boxer

    Joined:
    Dec 17, 2015
    Messages:
    119
    Likes Received:
    23
    i will try to implement it :) will give tut if i get success
     
  4. Nasser

    Nasser Boxer

    Joined:
    Jul 13, 2016
    Messages:
    30
    Likes Received:
    20
    Hello @Christoph

    Part 1:
    1) Follow the instruction by creating push certificate ( https://documentation.onesignal.com/docs/generating-an-ios-push-certificate ) and link it to the app id.
    2) Download both certifications (Development & Production)

    Part 2:
    1) Created account in onesignal ( www.onesignal.com )
    2) Add your app to their dashboard and upload (Push Certifications)
    3) Continue with the steps and download "Onesingal SDK" ( Download SDK 2.0.1 - https://github.com/OneSignal/OneSignal-iOS-SDK/releases ).

    Part 3:
    1) Export your BB game and open it in xcode.
    2) Install "Onesignal SDK" framework under framework section (Same as installing heyzap framework).
    3) Ensure -ObjC is there in "Build Settings" - "Other Linker Flags".
    4) Add SystemConfiguration.framework to "Link Binary with Libraries" under "Build Phases".
    5) Select the root project and Under Capabilities Enable "Push Notifications".
    6) Next Enable "Background Modes" and check "Remote notifications".
    7) Add following code to your AppDelegate.

    Code:
    #import "AppDelegate.h"
    
    //Add this line
    #import <OneSignal/OneSignal.h>
    
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
    
    //Add this line. Replace '5eb5a37e-b458-11e3-ac11-000c2940e62c' with your OneSignal App ID.
    [OneSignal initWithLaunchOptions:launchOptions appId:mad:"5eb5a37e-b458-11e3-ac11-000c2940e62c"];
    
    return YES;
    }
    
    NOTE:
    - The app onesignal ID is available in onesignal dashboard under APP SETTINGS -> Keys&IDs
    - Part 3 documentation is available in ( https://documentation.onesignal.com/docs/using-onesignal-in-your-ios-app ).

    Screen Shot 2016-08-09 at 01.53.11.png


    WHERE TO UPLOAD THE PUSH CERTIFICATIONS:

    Screen Shot 2016-08-09 at 01.53.11.png


    ADDING NEW APP WIZARD:
    Screen Shot 2016-08-09 at 02.02.10.png


    ONESIGNAL APP ID (To add/replace it in xcode project)
    Screen Shot 2016-08-09 at 02.17.24.png
     
    Last edited by a moderator: Aug 8, 2016
  5. Nasser

    Nasser Boxer

    Joined:
    Jul 13, 2016
    Messages:
    30
    Likes Received:
    20
    i dont think xcode will accept emoji in the code section :p, Better to copy and pasted from the onesingal documentation.
     
  6. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Incredibly awesome. Thanks Nasser!

    When do the push notification appear? When opening the app? Or can this be chosen somehow?
     
  7. Nasser

    Nasser Boxer

    Joined:
    Jul 13, 2016
    Messages:
    30
    Likes Received:
    20
    @Christoph

    You most welcome bro...

    It appears in background / iphone screen (If the user accept the notification request at the first time he open the app), then whenever you send notification from onesignal backend. it should delivered to everyone accepted the notifications request. and you also can check every notification report from onesingal backend.

    But the thing; It is only notification that the user will receive but for the callback / deeplinking is something that the developer needs to configure and i'm still trying to figure this out (i.e when notification is opened the action will takes the user to game store or anything else).


    Enabling background notification (xcode):
    Background Modes.png


    Notification delivery report (Onesingal):
    Screen Shot 2016-08-09 at 02.46.07.png
     
    Christoph likes this.
  8. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    added tags for code. ;-)
     
    Qdeveloper likes this.
  9. Nasser

    Nasser Boxer

    Joined:
    Jul 13, 2016
    Messages:
    30
    Likes Received:
    20
  10. trudnai

    trudnai Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,235
    Likes Received:
    701
  11. Arsmen Studio

    Arsmen Studio Avid Boxer

    Joined:
    Dec 6, 2015
    Messages:
    454
    Likes Received:
    170
    where do i put
    #import "AppDelegate.h"

    //Add this line
    #import <OneSignal/OneSignal.h>

    @implementation AppDelegate

    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

    //Add this line. Replace '5eb5a37e-b458-11e3-ac11-000c2940e62c' with your OneSignal App ID.
    [OneSignal initWithLaunchOptions:launchOptions appId:mad:"5eb5a37e-b458-11e3-ac11-000c2940e62c"];

    return YES;
    }



    i don't know where is appdelegate... do you mean (app controller.mm) ? i dont know where do i have to paste these . i got a lot of errors after trying.@Christoph
     
    Last edited: Dec 13, 2016
  12. PaulW

    PaulW Boxer

    Joined:
    Feb 14, 2016
    Messages:
    7
    Likes Received:
    0
    REALLY interested in this as I'm also having issues as the last post... WHERE to actually put the code because there is no AppDelegate file? Could anyone please help?
     
  13. eyal

    eyal Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    642
    Likes Received:
    121
    Thank you for this detailed tutorial but I don't understand something -

    This part -

    "
    #import "AppDelegate.h"

    //Add this line
    #import <OneSignal/OneSignal.h>

    @implementation AppDelegate

    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

    //Add this line. Replace '5eb5a37e-b458-11e3-ac11-000c2940e62c' with your OneSignal App ID.
    [OneSignal initWithLaunchOptions:launchOptions appId:mad:"5eb5a37e-b458-11e3-ac11-000c2940e62c"];

    return YES;
    }

    We don't use AppDelegate in BB and also there is no OneSignal.h file

    What to do ?

    Also when importing the SDK - where to and which file ?

    Thank you
     

Share This Page