Skip to content

Instantly share code, notes, and snippets.

View Bucimis's full-sized avatar

Jared Poelman Bucimis

View GitHub Profile

Trigger Setup

To process triggers in your app, you can add an observer on BrazeTask.BrazeTriggers:

m.BrazeTask.observeField("BrazeTriggers", "onTrigger")

Then within your handler, you have access to the active triggers:

active_triggers = m.BrazeTask.BrazeTriggers

You can then decide what to do with the triggers. Some of the fields available on the trigger:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
if (deviceToken.count == 0) {
print("Device token length was 0. Doing nothing.")
return;
}
let deviceTokenString = deviceToken.map { String(format: "%02x", $0) }.joined()
print("Registering device token with Braze: " + deviceTokenString)
Appboy.sharedInstance()!.registerPushToken(deviceTokenString)
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSString *tokenString;
if (@available(iOS 13.0, *)) {
NSUInteger dataLength = deviceToken.length;
if (dataLength == 0) {
return;
}
const unsigned char *dataBuffer = deviceToken.bytes;
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
@Bucimis
Bucimis / changelog_example.md
Last active December 7, 2016 21:28
Changelog update example

1.16.1

Breaking
  • Adds a breaking change.
Added
  • Adds a feature.
Fixed
  • Fixes a bug.
@Bucimis
Bucimis / gist:0ebab697bae14bd8b06f
Last active March 1, 2016 18:26
Appboy PlaceIQ Integration

Android

Background Location Tracking Set Up

Follow the directions at https://gist.github.com/Bucimis/909dbd68edad61ac869c to set up background location tracking with Appboy.

Google Play Ad Services Set Up

In your app build.gradle, add Google Play ad services with the following compile statment. Replace LATEST_PLAY_SERVICES_VERSION with the latest version of Google Play Services.

# uninstall droidboy
adb uninstall com.appboy.sample
# start droidboy
adb shell monkey -p com.appboy.sample -c android.intent.category.LAUNCHER 1
# press home key
adb shell input keyevent 3
# open sqlite database
@Bucimis
Bucimis / gist:909dbd68edad61ac869c
Last active October 16, 2015 22:37
Appboy Background Location Tracking

Android

Manifest Set Up

  1. In your AndroidManifest.xml, request fine location permissions:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

  1. In the application element of your AndroidManifest.xml, declare the Appboy location service: