Skip to content

Instantly share code, notes, and snippets.

View aaustin's full-sized avatar

Alex Austin aaustin

View GitHub Profile
Branch *branch = [Branch getInstance];
[branch createDiscoverableContentWithTitle:self.monsterName
description:self.monsterDescription
thumbnailUrl:[NSURL URLWithString:@"https://s3-us-west-1.amazonaws.com/branchmonsterfactory/321png"]
linkParams:@{@"monster_face_index":@3,
@"monster_body_index":@2,
@"monster_color_index":@1,
@"monster_id":@"1234"}
publiclyIndexable:YES];
@aaustin
aaustin / ul-init.m
Last active September 21, 2015 17:36
[[Branch getInstance] initSessionWithLaunchOptions:launchOptions andRegisterDeepLinkHandler:^(NSDictionary *deepLinkParams, NSError *error) {
if (!error) {
NSLog(@"finished init with params = %@", [deepLinkParams description]);
if ([deepLinkParams objectForKey:@"object_id"]) {
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
NSString * storyboardName = @"Main";
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
UIViewController *nextVC = [storyboard instantiateViewControllerWithIdentifier:@"ObjectViewController"];
[navController setViewControllers:@[nextVC] animated:YES];
}
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler {
BOOL handledByBranch = [[Branch getInstance] continueUserActivity:userActivity];
return handledByBranch;
}
NSString *shareString = @"Super amazing thing I want to share!";
NSDictionary*params = [[NSDictionary alloc] initWithObjects:@[
@"1234",
@"here is another object!!",
@"Kindred",
@"https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"]
forKeys:@[
@"object_id",
@"key2",
@"$og_title",
[[Branch getInstance] createDiscoverableContentWithTitle:@"MyApp"
description:@"My app is disrupting apps"
thumbnailUrl:[NSURL URLWithString:@"https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"]
linkParams:@{@"object_id": @"1234",
@"object_data": @"Here's some important deep link data"}
publiclyIndexable:YES];
[[Branch getInstance] createDiscoverableContentWithTitle:@"MyApp"
description:@"My app is disrupting apps"
thumbnailUrl:[NSURL URLWithString:@"https://s3-us-west-1.amazonaws.com/branchhost/mosaic_og.png"]
linkParams:@{@"object_id": @"1234",
@"object_data": @"Here's some important deep link data"}
type:@"content/image"
publiclyIndexable:YES
keywords:[NSSet setWithObjects:@"apps", @"disruption", @"next_facebook", nil]];
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
String action = intent.getAction();
Uri data = intent.getData();
if (data != null && data.isHierarchical()) {
Log.i(“MyApp”, “Received link click on URL: “ + intent.getDataString());
<activity ...>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="yoursite.com" />
<data android:scheme="https" android:host="yoursite.com" />
</intent-filter>
</activity>
var assetlinks = fs.readFileSync(__dirname + '/static/assetlinks.json');
app.get('/.well-known/assetlinks.json', function(req, res, next) {
res.set('Content-Type', 'application/json');
res.status(200).send(assetlinks);
});