BranchMetrics / android-branch-deep-linking-attribution

The Branch Android SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/pages/apps/android/
MIT License
399 stars 156 forks source link

bug: [android] Http connect exception for "api2.branch.io" #920

Closed tafelnl closed 2 years ago

tafelnl commented 3 years ago

On initializing the branch SDK I get the following error:

I/BranchSDK: posting to https://api2.branch.io/v1/install
I/BranchSDK: Http connect exception: Unable to resolve host "api2.branch.io": No address associated with hostname

I could reproduce this error on a Samsung S10 with Android 9. It used to work before on the exact same device. No changes are made to the code as far as I am aware. I tried SDK implementation 'io.branch.sdk.android:library:5.0.3' through implementation 'io.branch.sdk.android:library:5.0.8'

On the other hand, on a Samsung 9 with Android 10 it does not produce any error at all.

tafelnl commented 3 years ago

It might be related to #844 . But the solutions mentioned there (this one for example) do not solve it unfortunately.

tafelnl commented 3 years ago

Okay, so I found out why it refused to work. The phone I was testing on, was using an ad-blocker. The ad-blocker blocks all requests to api2.branch.io all together. Disabling the ad-blocker solved the problem. I am not sure if it is fair for this major ad-blocker to block those API endpoints. I guess it is, since it allows for cross-application attribution.

vishalkumarsinghvi commented 3 years ago

@tafelnl Thank you so much I used adblocking DNS that's why My branch is not working after turn off working fine.

vishalkumarsinghvi commented 3 years ago

But most of people will use adblocker they can't use branch io SDK :(

tafelnl commented 3 years ago

You are correct, I also changed my mind about this. Branch should use a fallback when people are using an addblocker. Branch should in such a case just rely on the native deeplinking ability.

jf-branch commented 2 years ago

Thanks for the input all, the Branch team is certainly taking this into consideration as we continue to develop our product.

ahnafnafee commented 2 years ago

Any updates on a fallback for users using adblock?

jf-branch commented 2 years ago

Hi all, we have implemented a default retry limit for non fail-able requests such as no internet or ad blocked with release 5.2.2. The default is 3, but you can override that and set your own through https://github.com/BranchMetrics/android-branch-deep-linking-attribution/blob/master/Branch-SDK/src/main/java/io/branch/referral/Branch.java#L746

tafelnl commented 2 years ago

@jf-branch Thanks for the update. But I don't think it actually solves the issue in this thread right? Because as long as the adblocker is enabled, it will block all HTTP requests to the branch.io host (depending on the adblocker of course, but the ones I tested, block this host by default). So you can retry all you want, but it will keep blocking them.

jf-branch commented 2 years ago

@tafelnl correct, this does not allow for branch to bypass the Adblocker to make the request. Unfortunately there is not much we can do to stop the ad blocker from blacklisting us.

tafelnl commented 2 years ago

Agreed. But it may be well possible to implement some sort of fallback. Of course we cannot do the attribution we could have done otherwise. But we can resort to the native default deeplinking ability provided by Android/iOS and do some basic stuff.

tafelnl commented 2 years ago

Of course shortened links are quite useless then (since the SDK would not be able to transform them into the correct data). But the long links would still work quite well.

jf-branch commented 2 years ago

@tafelnl that is true, let me bring this to the team and see if on opens, the non-fail-able retries fail, we still complete the callback forwarding the referring url.

Mihai-github commented 5 months ago

Okay, so I found out why it refused to work. The phone I was testing on, was using an ad-blocker. The ad-blocker blocks all requests to api2.branch.io all together. Disabling the ad-blocker solved the problem. I am not sure if it is fair for this major ad-blocker to block those API endpoints. I guess it is, since it allows for cross-application attribution.

How do I see if I have the adblocker on since I don't have any application installed for this?

brianinator commented 3 months ago

@tafelnl "The phone I was testing on, was using an ad-blocker." What ad-blocker specifically was installed?

tafelnl commented 3 months ago

@brianinator It was a long time ago, so I'm not sure anymore. I think it might have been AdGuard.

brianinator commented 3 months ago

I have been able to reproduce issue with the following steps:

  1. Open Android device.
  2. Open Google Play Store.
  3. Download & install Wize Adblock app.
  4. Open and activate/enable Wize Adblock blocking on Home tab.
  5. Open your app with Branch. (This is to get Wize to track activity with domain: api2.branch.io)
  6. Close your app completely.
  7. Go back to Wize Adblock app and open Activity tab.
  8. Find api2.branch.io in Activity tab.
  9. Tap on it.
  10. Hit the bottom button: “Add to Forwarded”.
  11. Reopen your app.

Yeah so depends on your app's error handling if you can see it. My company's app reports errors to App Center so I can see it there.