- In your
AndroidManifest.xml, request fine location permissions:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- In the
applicationelement of yourAndroidManifest.xml, declare the Appboy location service:
| # 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 |
Follow the directions at https://gist.github.com/Bucimis/909dbd68edad61ac869c to set up background location tracking with Appboy.
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.
| - (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)]; |
| 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) | |
| } |
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: