问题
We are using branch.io to pass custom data to App. For that we are following this steps in branch dashboard.
1) Ads -> Partner Management -> Facebook -> Create Facebook Link
2) Set data in Key/Value under "Deep Linking" Section (data which we need in our app)
3) We set Play/App Store URL in Android/iOs respectively Or set Default Redirects under "Redirects" section
That's it!!!
Now Go to Facebook Ads Manager and select App Install Campaign.
1) Select Play/App Store under App Section.
2) Set above generated URL under "deffered deep link"
You can read more here : https://docs.branch.io/pages/deep-linked-ads/facebook-app-install-ads/
Now Our Problem is :
- When user clicked on any branch link with deep link params it able to receive data in both case when user fresh install the application and if user has already app installed.
- When we clicked on Facebook ads with same url we are unable to get branch data if user has not installed application (Mostly in case when user redirect from App Store/play store) . But user has installed the app we can able to receive all branch data from same url.
So Question is:
1) Do we need any permission from Facebook or missing any configuration on Branch or Facebook?
2) The same thing will work with both (e.g. Android and iOs) devices?
Thanks
回答1:
Unfortunately the branch.io documentation for setting this is up is pretty incomplete - we just spent about a week testing and debugging the SDK to figure out how to get it to work. The necessary changes itself are actually quite simple.
On Android:
- Integrate the Facebook SDK if you haven't done so already
- Ensure that the
facebook_app_id
string resource you added as part of (1) is not prefixed with "fb" - If you are using ProGuard, add rules to keep the relevant parts of the Facebook SDK
- Call
enableFacebookAppLinkCheck()
on yourBranch
instance right after initializing it
On iOS:
- Integrate the Facebook SDK if you haven't done so already
- Call
registerFacebookDeepLinkingClass(FBSDKAppLinkUtility.self)
on yourBranch
instance right after initializing it
回答2:
I had this exact same problem, but in a React Native project, so I'm using react-native-branch. @henning-dodenhof 's answer helped me a lot (thanks for figuring this out!), but I needed a couple of further adaptations, so I add this answer in case it's useful for someone else since this post was the main thing I found regarding this issue:
For iOS: The FB SDK registration needs to happen before initializing Branch, not after as the above answer suggests. So, before this line that you add as part of the normal library setup:
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
You need get the Branch instance from RNBranch and then register this FB SDK class:
[[RNBranch branch] registerFacebookDeepLinkingClass:[FBSDKAppLinkUtility class]];
Adding this new line before the initialization is critical, doesn't work if it's done after.
For Android:
Here the setup code already gets an instance with Branch.getAutoInstance(this)
, so we can just chain the registration:
Branch.getAutoInstance(this).enableFacebookAppLinkCheck();
It looks like the getAutoInstance
above doesn't actually fully initializes the instance, so you can call enableFacebookAppLinkCheck
right after, and the instance gets fully initialized after the first use.
来源:https://stackoverflow.com/questions/49955368/branch-io-deep-linked-url-not-passing-data-in-app-from-facebook-ads