Giter VIP home page Giter VIP logo

branchmetrics / android-branch-deep-linking-attribution Goto Github PK

View Code? Open in Web Editor NEW
396.0 396.0 156.0 32.74 MB

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.

Home Page: https://docs.branch.io/pages/apps/android/

License: MIT License

Java 38.71% Shell 0.03% HTML 57.85% JavaScript 0.03% CSS 0.52% Kotlin 2.85%

android-branch-deep-linking-attribution's People

Contributors

aaaronlopez avatar aaustin avatar aeromusek avatar agerstner-branch avatar agrimn avatar apeterson-branch avatar austinhay avatar bklastaitis-branch avatar code-crusher avatar csalmi-branch avatar echo-branch avatar evangelosg avatar gdeluna-branch avatar gfletcher-branch avatar hubt avatar jagadeeshkaricherla-branch avatar jdee avatar kdama-branch avatar msiddiq-branch avatar nidhidixit09 avatar noln avatar nsingh-branch avatar pcappelli-branch avatar qinweigong avatar radixdev avatar sarkar avatar shortstuffsushi avatar sleeplessbyte avatar sojanpr avatar themarshal99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-branch-deep-linking-attribution's Issues

Activity recreation issue (configuration change)

When changing configurations twice, Branch will spawn the "Trouble initializing Branch. [...]" error, if implemented as documented.

To reproduce:
initSession in an activity onStart
closeSession in an activity onStop

Start the app and rotate twice.

getFirstReferringParams always empty..

branch doc for android is confusing.

Here's my setup and I can't figure out why clicking the link I created won't seem to do no good. ie. getFirstReferringParams return empty.

manifest

     <meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_hkbLTX5FhhLkWx=====" />
     <meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_dkcNL46yckHbYFkCABN====" />

MyApplication.java

 @Override
 public void onCreate() {
     super.onCreate();

     // branch.io
     // https://dev.branch.io/recipes/quickstart_guide/android/#alternatives-to-application-subclass
     Branch.getAutoInstance(this);
 }

Then I create a link to share like the following..

 public void createInvitationUrl(String invitation_id, final Handler.Callback callback) {
     BranchUniversalObject branchUniversalObject = new BranchUniversalObject()
         .setCanonicalIdentifier(EVENT_NAME)
         .addContentMetadata(INVITATION_ID_PARAM_NAME, invitation_id);

     LinkProperties linkProperties = new LinkProperties()
         .setFeature("sharing");

     Context context = LittleHomeApplication.getContext();

     branchUniversalObject.generateShortUrl(context, linkProperties, new Branch.BranchLinkCreateListener() {
         @Override
         public void onLinkCreate(String url, BranchError error) {
             if (error == null) {
                 Log.i("MyApp", "got my Branch link to share: " + url);

                 Message message = new Message();
                 message.obj = url;
                 callback.handleMessage(message);
             }

         }
     });
 }

Now my app is published to the playstore and when I click the link and install the app via playstore.

I see JSONObject installParams = branch.getFirstReferringParams(); is empty..

why? I can't figure this out for a whole day..

Memory Leak in BranchWindowCallback

I'm using leakcanary to detect memory leaks in my app. I just added the Branch SDK to my app and it looks like it's leaking the activity:

* GC ROOT static io.branch.referral.Branch.branchReferral_
* references io.branch.referral.Branch.longPressed_
* references io.branch.referral.Branch$BranchWindowCallback$1.this$1 (anonymous class implements java.lang.Runnable)
* references io.branch.referral.Branch$BranchWindowCallback.callback_
* leaks com.foo.myapp.MainActivity instance

UTF-8 character "filtering"

This line tries to filter out bad parameter values.

  • If you download this repository on Windows, the file will be mangled and show � instead of Õ. As far as I know Android itself doesn't support converting this from unicode notation either.
  • I think the filtering itself is limited. If you want to retain the user data, consider base64-url-safe encoding. I might want to keep new lines, right?
  • Is there a reason that only this character (apart from the newlines and carriage returns) is filtered?

("same" as #23)

encoding errors in Android Studio 1.01 Linux

Upon attempting to build my project with the branch project in place
i'm getting...

/home/creator/AndroidStudioProjects/la/branch/src/io/branch/referral/Branch.java
Error:(897, 125) error: unmappable character for encoding UTF-8
Error:(897, 125) error: unmappable character for encoding UTF-8

on line 897:

filteredObj.put(key, inputObj.getString(key).replace("\n", "\\n").replace("\r", "\\r").replace("\"", "\\\"").replace("�", "'"));

crash report

java.util.ConcurrentModificationException
at java.util.LinkedList$LinkIterator.next(LinkedList.java:124)
at io.branch.referral.ServerRequestQueue$1.run(ServerRequestQueue.java:52)
at java.lang.Thread.run(Thread.java:841)

Branch SDK version: 1.3.8
Android version: 4.3
Device: Hydro LIFE (C6530N)

Use a Builder pattern for getting a new shortUrl

Currently there are only a few options to generate a short url:

getShortUrlSync()
getShortUrlSync(JSONObject params)
getShortUrlSync(String channel, JSONObject params)
getReferralUrlSync(Collection<String> tags, String channel, JSONObject params)
getContentUrlSync(String channel, JSONObject params)
getContentUrlSync(Collection<String> tags, String channel, JSONObject params)
getShortUrlSync(String channel, String feature, String stage, JSONObject params)
getShortUrlSync(String alias, String channel, String feature, String stage, JSONObject params)
getShortUrlSync(int type, String channel, String feature, String stage, JSONObject params)
getShortUrlSync(String channel, String feature, String stage, JSONObject params, int duration)
getShortUrlSync(Collection<String> tags, String channel, String feature, String stage, JSONObject params)
getShortUrlSync(String alias, Collection<String> tags, String channel, String feature, String stage, JSONObject params)
getShortUrlSync(int type, Collection<String> tags, String channel, String feature, String stage, JSONObject params)
getShortUrlSync(Collection<String> tags, String channel, String feature, String stage, JSONObject params, int duration)

And their a-sync equivalents:

getShortUrl(BranchLinkCreateListener callback)
getShortUrl(JSONObject params, BranchLinkCreateListener callback)
getReferralUrl(String channel, JSONObject params, BranchLinkCreateListener callback)
getReferralUrl(Collection<String> tags, String channel, JSONObject params, BranchLinkCreateListener callback)
getContentUrl(String channel, JSONObject params, BranchLinkCreateListener callback)
getContentUrl(Collection<String> tags, String channel, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(String channel, String feature, String stage, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(String alias, String channel, String feature, String stage, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(int type, String channel, String feature, String stage, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(String channel, String feature, String stage, JSONObject params, int duration, BranchLinkCreateListener callback)
getShortUrl(Collection<String> tags, String channel, String feature, String stage, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(String alias, Collection<String> tags, String channel, String feature, String stage, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(int type, Collection<String> tags, String channel, String feature, String stage, JSONObject params, BranchLinkCreateListener callback)
getShortUrl(Collection<String> tags, String channel, String feature, String stage, JSONObject params, int duration, BranchLinkCreateListener callback)

With just 28 options to create a link, I wouldn't worry too much about maintainability once you add a new optional parameter and the equivalent number of 2 - 36 new methods. /sarc

Instead, with eye on #83 and #76, consider replacing the above with a builder pattern:

String Builder#build
void Builder#buildAsync( BranchLinkCreateListener )
Builder Builder#setChannel( String channel )
Builder Builder#setAlias( String alias )
[...]
Builder Builder#setDuration( int duration )

Adding a new parameter will then add a whopping 1 new method. Not only that, you can defer asyncafication until building the url. Bonus: make it Parcelable and it can be passed around easily.

I think this would be a great addition.

Problem integrating Branch SDK

Hi!
I have been having problems integrating the SDK.

I followed the steps indicated in the latest version of the README and of the website: https://dev.branch.io/recipes/quickstart_guide/android/

It worked in the Nexus 5 (Api Level 22) with no problems, but I cannot make it work in other phones like Samsung Galaxy S4 (Api Level 19). When starting the app I am getting the following exception:

java.lang.NoClassDefFoundError: io.branch.referral.Branch$SESSION_STATE
            at io.branch.referral.Branch.<init>(Branch.java:319)
            at io.branch.referral.Branch.initInstance(Branch.java:528)
            at io.branch.referral.Branch.getBranchInstance(Branch.java:431)
            at io.branch.referral.Branch.getTestInstance(Branch.java:482)
            at io.branch.referral.BranchApp.onCreate(BranchApp.java:37)
            at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1025)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4581)
            at android.app.ActivityThread.access$1600(ActivityThread.java:161)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1325)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:157)
            at android.app.ActivityThread.main(ActivityThread.java:5356)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
            at dalvik.system.NativeStart.main(Native Method)

Do you know by chance which could be the reason to my problem?

Thanks in advance!

Short URL conflicts lead to repeated requests

If a conflict occurs while using BranchShortLinkBuilder.generateShortUrl() the request will never be removed from the queue. Looking at BranchPostTask.onPoseExecute() it seems that requests are not removed from the queue when the statusCode is 409. This means that any time the request queue is nudged the same request will be retried.

https://github.com/BranchMetrics/Android-Deferred-Deep-Linking-SDK/blob/6b4358e11c8adbe3d25d7b72919ce80647675612/Branch-SDK/src/io/branch/referral/Branch.java#L2883

Non-hierarchical URI's in Intent-data crash

Setting an Intent's data to a Non-hierarchical URI invokes a crash. The data wasn't intended for Branch in the first place.

[...]
     Caused by: java.lang.UnsupportedOperationException: This isn't a hierarchical URI.
            at android.net.Uri.getQueryParameter(Uri.java:1662)
            at io.branch.referral.Branch.initSession(Branch.java:168)
            at com.paystik.droid.behaviors.BranchMetricsBehavior.initSession(BranchMetricsBehavior.java:106)
            at com.paystik.droid.behaviors.BranchMetricsBehavior.onAction(BranchMetricsBehavior.java:63)
            at com.paystik.droid.activities.BaseActivity.onAction(BaseActivity.java:264)
            at com.paystik.droid.behaviors.BranchMetricsBehavior.initSession(BranchMetricsBehavior.java:188)
            at com.paystik.droid.activities.BaseActivity.onStart(BaseActivity.java:157)
            at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
            at android.app.Activity.performStart(Activity.java:5241)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5146)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)

click_timestamp is 3 hours in future?

We have integrated the Branch SDK into our project. In our BranchReferralInitListener, we are passing the referring params up to Mixpanel for tracking.

On the Mixpanel dashboard, I noticed the value of the click_timestamp attribute was 1455130572. This value is documented to be an epoch time value, but it converts to 18:56:12 (UTC) and 13:56:12 (EST). Since it is currently 11:08:45 (EST), this value appears to be three hours in the future.

I have verified that my device (HTC One M7, Android 4.4.2) has the correct timezone (GMT-05:00, Eastern Standard Time) and correct time set.

What could be causing this discrepancy?

Receiving ConcurrentModificationException from ServerRequest.getPostWithInstrumentationValues()

We're receiving exceptions on Crashlytics with the following stacktrace:

Fatal Exception: java.lang.RuntimeException: An error occured while executing doInBackground()
       at android.os.AsyncTask$3.done(AsyncTask.java:300)
       at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
       at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
       at java.util.concurrent.FutureTask.run(FutureTask.java:242)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:841)
Caused by java.util.ConcurrentModificationException
       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
       at java.util.HashMap$KeyIterator.next(HashMap.java:833)
       at io.branch.referral.ServerRequest.getPostWithInstrumentationValues(ServerRequest.java:166)
       at io.branch.referral.Branch$BranchPostTask.doInBackground(Branch.java:3337)
       at io.branch.referral.Branch$BranchPostTask.doInBackground(Branch.java:3313)
       at android.os.AsyncTask$2.call(AsyncTask.java:288)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:841)

Are we doing something wrong? It seems some bug on the SDK. Our app is using basic Branch deeplink implementation, with branchUniversalObject.generateShortUrl()

Thank you

Generate Url on server side

Hi Guys...!
I am implementing branch io in an application. My question is that can I generate short url from the server side? I didn't find any documentation about this...!
I am trying to generate a url only when the item is saving on the server, in this way I don't need to generate a new url from branch io every time...!
Please update me for the implementation of the branch io on server-hand.

errors in importing Branch-Android-SDK-TestBed

Error:Android Dex: [Branch-SDK-TestBed] Unable to execute DX
Error:Android Dex: [Branch-SDK-TestBed] com.android.dex.DexException: Multiple dex files define Lio/branch/referral/ApkParser;
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
Error:Android Dex: [Branch-SDK-TestBed] at com.android.dx.command.dexer.Main.run(Main.java:246)
Error:Android Dex: [Branch-SDK-TestBed] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:Android Dex: [Branch-SDK-TestBed] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error:Android Dex: [Branch-SDK-TestBed] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error:Android Dex: [Branch-SDK-TestBed] at java.lang.reflect.Method.invoke(Method.java:606)
Error:Android Dex: [Branch-SDK-TestBed] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161)
Error:Android Dex: [Branch-SDK-TestBed] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294)
Error:Android Dex: [Branch-SDK-TestBed] at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:121)

Leaked instance

D/LeakCanary﹕ * GC ROOT static io.branch.referral.Branch.branchReferral_
D/LeakCanary﹕ * references io.branch.referral.Branch.initSessionFinishedCallback_
D/LeakCanary﹕ * references com.paystik.droid.behaviors.BranchMetricsBehavior$$Lambda$3.arg$1 (anonymous class implements io.branch.referral.Branch$BranchReferralInitListener)
D/LeakCanary﹕ * references com.paystik.droid.behaviors.BranchMetricsLoggedOutBehavior.activity
D/LeakCanary﹕ * Class io.branch.referral.Branch
D/LeakCanary﹕ |   static branchReferral_ = io.branch.referral.Branch [id=0xa5087f40]
D/LeakCanary﹕ * Instance of io.branch.referral.Branch
D/LeakCanary﹕ |   static branchReferral_ = io.branch.referral.Branch [id=0xa5087f40]
D/LeakCanary﹕ |   activityLifeCycleObserver_ = io.branch.referral.Branch$BranchActivityLifeCycleObserver [id=0xa507f158]
D/LeakCanary﹕ |   debugOnTouchListener_ = io.branch.referral.Branch$4 [id=0xa507eb40]
D/LeakCanary﹕ |   systemObserver_ = io.branch.referral.SystemObserver [id=0xa50aeb90]
D/LeakCanary﹕ |   initSessionFinishedCallback_ = com.paystik.droid.behaviors.BranchMetricsBehavior$$Lambda$3 [id=0xa5411198]
D/LeakCanary﹕ |   requestQueue_ = io.branch.referral.ServerRequestQueue [id=0xa50a6e30]
D/LeakCanary﹕ |   kRemoteInterface_ = io.branch.referral.BranchRemoteInterface [id=0xa508a1e0]
D/LeakCanary﹕ |   prefHelper_ = io.branch.referral.PrefHelper [id=0xa50108e0]
D/LeakCanary﹕ |   longPressed_ = io.branch.referral.Branch$BranchWindowCallback$1 [id=0xa55579a8]
D/LeakCanary﹕ * Instance of com.paystik.droid.behaviors.BranchMetricsBehavior$$Lambda$3
D/LeakCanary﹕ |   arg$1 = com.paystik.droid.behaviors.BranchMetricsLoggedOutBehavior [id=0xa56f1b10]
D/LeakCanary﹕ * Instance of com.paystik.droid.behaviors.BranchMetricsLoggedOutBehavior

If I reference an Activity in the callback, it can leak.

Public API revisitation

With eye on #76, this would probably a great time to clean-up the public API exposed by the library.

The files

  • ApkParser
  • BranchLinkData
  • BranchRemoteInterface
  • RemoteInterface
  • ServerRequest
  • ServerRequestQueue
  • ServerResponse
  • SystemObserver

should be package-local and not public. They are not supported in terms of "outside-branch" use and might undergo heavy modification and thus should not be publicly exposed.

Simply remove the word public in front of the class. Since are all in the same package, it won't change anything internally. Bonus: since they are not public any more, Proguard can do way better job.

Secure Branch Key in XML?

So, the branch key is the gateway to the underlying system,
if one's app is designed to use branch as a clearinghouse for pts/invite code access
that would make that key highly valuable.

The android manifest can be seen by anyone with sense...

Can you suggest ways to access the key within the manifests' xml but from outside the application itself...say an external file?

thanks

Issue using res/values/strings.xml for the key

Hey, I'm working on an Air Native Extensions for Branch io, basically it's a bridge between AS3 and your Java SDK.

Unfortunately, I'm not able to use the res/values/strings.xml with an ANE, however I've access to the Manifest.xml
Does the key could be setup directly in the Manifest? Why do you use the res/values/strings.xml ?

Here is an example of Google Play Games ' key set directly in the Manifest: <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ aKey" />

Branch links don't expand on Android

Might be related to #24

The URL https://bnc.lt/l/2enuGxU-2g resolves.
evgbr://open?link_click_id=81743897969033762 but only fills in referringParams on iOS, not Android.

To reproduce:

  • Clean app open after app is killed using the link
  • Get Branch Instance
  • Set Identity (if any)
  • Init session with BranchReferralInitListener, Activity#getIntent#getData, Activity

Below the lines from the log showing the problem

I/Evergive﹕ [1] 2.onInitFinished: [branch-behavior] initialization finished for evgbr://open?link_click_id=81743897969033762
V/Evergive﹕ [1] BranchMetricsBehavior.handleBranchLink: [branch-behavior] error: null, referringParams: {}

No Connection problem on Chrome browser

Hi guys,
I have an issue with Branch sdk. The issue is that when I clicked on any URL (generated generated by Branch sdk), it works fine on HTC One X (API: 17) but when I tried the same link on Note 5, HTC E8 or any other device having an android version greater than API: 18, it shows me the error on chrome browser No Connection found on chrome browser and if I use any other browser, it open the application in play store instead of open the application in the mobile.

1.10.5 breaking builds

I don't see a tag for it 1.10.5, but its on jcenter, being vended out to gradle configs using compile 'io.branch.sdk.android:library:1.+' and is also up on your AWS direct download.

Build-break being caused by this PR #204

java.util.ConcurrentModificationException in ServerRequestQueue

using branch 'io.branch.sdk.android:library:1.10.2'
is this the same issue as this one
java.util.HashMap$HashIterator.nextEntry (HashMap.java:806) org.json.JSONArray.toString (JSONArray.java:574) io.branch.referral.ServerRequestQueue$1.run (ServerRequestQueue.java:81) java.lang.Thread.run (Thread.java:841)

screen shot 2016-02-17 at 1 01 41 pm

Session can't be closed when links are just created

V/Evergive﹕ [1] BranchMetricsBehavior.onAction: [branch-behavior] ACTION: SEND INVITE
V/[branch]﹕ processing queue so keep alive
V/[branch]﹕ hook onto life support
I/BranchSDK﹕ posting to https://api.branch.io/v1/url
I/BranchSDK﹕ Post value = {"tags":["version1","android","group"],"session_id":"86226031148532384","device_fingerprint_id":"82715523476882253","identity_id":"82715523510436686","data":"{ [.. data ..] }"
I/BranchSDK﹕ returned {"url":"https://bnc.lt/l/2mJYRLU-1q"}
D/Evergive﹕ [28282] InvitationTextApi.notify: [invitation-text-api] code: 200
I/Timeline﹕ Timeline: Activity_launch_request id:com.hipchat time:225768382
V/Evergive﹕ [1] BranchMetricsBehavior.onAction: [branch-behavior] ACTION: CLOSE SESSION
V/[branch]﹕ not closing: keep alive
V/[branch]﹕ unplug from life support
V/Evergive﹕ [1] BranchMetricsBehavior.onAction: [branch-behavior] ACTION: INIT SESSION null
V/[branch]﹕ init user session (internal)
V/[branch]﹕ init with user and session - nothing open in queue
I/Evergive﹕ [1] 1.onInitFinished: [branch-behavior] initialization finished for null
  • When a branch link is to be created, Branch is kept alive (hooked onto life support).
  • When the callback launches an activity, it's still hooked onto life support, and isn't unplugged until the next Activity is already started (Timeline)
  • When returning to the activity, the session was never closed, thus branch is not called.

Proposed resolution: keepAlive_ when the link is created or when the callback is called.

Use case:

  1. Select share intent
  2. Create link and follow intent
  3. Test my own link
  4. Re-opens app
  5. Should be a new session

Crash report

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at io.branch.referral.ServerRequestQueue.containsClose(ServerRequestQueue.java:159)
at io.branch.referral.Branch$6.run(Branch.java:452)
at java.lang.Thread.run(Thread.java:818)

BranchUniversalObject and LinkProperties always are null

Hello,
I have tested AndroidTestBed with my own marketing link.
Callback always returns BUO == null and LinkProperties == null.

Step to reproduce:

  • launch TestBed
  • hide TestBed
  • switch to Chrome
  • enter a short link like "bnc.lt/my_link" into Chrome search

What I expect:

  • app will be launched and I will receive my marketing info (channel, metadata etc.)

What happens:

  • app is launched but BUO == null and LinkProperties == null

Method onStart:

    protected void onStart() {
        super.onStart();
        branch = Branch.getInstance();

        branch.initSession(new Branch.BranchUniversalReferralInitListener() {
            @Override
            public void onInitFinished(BranchUniversalObject branchUniversalObject, LinkProperties linkProperties, BranchError error) {
                if (error != null) {
                    Log.i("BranchTestBed", "branch init failed. Caused by -" + error.getMessage());
                } else {
                    Log.i("BranchTestBed", "branch init complete!");
                    if (branchUniversalObject != null) {
                        Log.i("BranchTestBed", "title " + branchUniversalObject.getTitle());
                        Log.i("BranchTestBed", "CanonicalIdentifier " + branchUniversalObject.getCanonicalIdentifier());
                        Log.i("ContentMetaData", "metadata " + branchUniversalObject.getMetadata());
                    }
                    else {
                        Log.i("BranchTestBed", "branchUniversalObject == null");
                    }

                    if (linkProperties != null) {
                        Log.i("BranchTestBed", "Channel " + linkProperties.getChannel());
                        Log.i("BranchTestBed", "control params " + linkProperties.getControlParams());
                    }
                    else {
                        Log.i("BranchTestBed", "linkProperties == null");
                    }
                }
            }
        }, this.getIntent().getData(), this);
    }

Log:

01-19 00:04:16.596 10555-10899/io.branch.branchandroiddemo I/BranchSDK: posting to https://api.branch.io/v1/open
01-19 00:04:16.606 10555-10899/io.branch.branchandroiddemo I/BranchSDK: Post value = {
                                                                            "update": 1,
                                                                            "os": "Android",
                                                                            "lat_val": 1,
                                                                            "identity_id": "217735047510246975",
                                                                            "app_version": "1.10.2",
                                                                            "debug": true,
                                                                            "instrumentation": {
                                                                                "v1\/open-qwt": "0",
                                                                                "v1\/close-lrtt": "1148"
                                                                            },
                                                                            "branch_key": "key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc",
                                                                            "os_version": 19,
                                                                            "external_intent_extra": "{\"com.android.browser.application_id\":\"com.android.chrome\"}",
                                                                            "google_advertising_id": "8b31c12c-d31d-47de-aee7-bdc0616f78f2",
                                                                            "is_referrable": 1,
                                                                            "retryNumber": 0,
                                                                            "device_fingerprint_id": "217735047514502627",
                                                                            "external_intent_uri": "branchtesturi:\/\/open?link_click_id=150250810058515220",
                                                                            "sdk": "android1.10.2",
                                                                            "link_identifier": "150250810058515220"
                                                                        }
01-19 00:04:24.126 10555-10899/io.branch.branchandroiddemo I/BranchSDK: returned {"session_id":"217738206572739989","identity_id":"217735047510246975","device_fingerprint_id":"217735047514502627","browser_fingerprint_id":null,"link":"https://bnc.lt/a/key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc?%24identity_id=217735047510246975","data":"{\"+is_first_session\":false,\"+clicked_branch_link\":false}"}
01-19 00:04:24.176 10555-10555/io.branch.branchandroiddemo I/BranchTestBed: branch init complete!
01-19 00:04:24.176 10555-10555/io.branch.branchandroiddemo I/BranchTestBed: branchUniversalObject == null
01-19 00:04:24.176 10555-10555/io.branch.branchandroiddemo I/BranchTestBed: linkProperties == null
01-19 00:06:12.546 10555-10900/io.branch.branchandroiddemo I/BranchSDK: posting to https://api.branch.io/v1/close
01-19 00:06:12.546 10555-10900/io.branch.branchandroiddemo I/BranchSDK: Post value = {
                                                                            "session_id": "217738206572739989",
                                                                            "retryNumber": 0,
                                                                            "sdk": "android1.10.2",
                                                                            "instrumentation": {
                                                                                "v1\/open-lrtt": "5882",
                                                                                "v1\/close-qwt": "1"
                                                                            },
                                                                            "branch_key": "key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc",
                                                                            "device_fingerprint_id": "217735047514502627",
                                                                            "identity_id": "217735047510246975"
                                                                        }

Help please!

Only open default web page in case app is not opened

i follow this example to learn how to integrate Branch.io deeep link into Android app.

At first, I create a new Branch.io app and make sure Always try to open app is checked, Also set up app scheme to test:// and package to com.example.myapplication and default web page to https://www.google.com/. From debug log, Branch url is https://bnc.lt/qyyh/4iU683D8Yq

I notice when open this link from Chrome browser while my Android app is active, then Chrome will redirect into Android app. However if I close the Android app, then when open link in Chrome, it will redirect into default web page instead.

As I know in Android, when open deep link, Android app can be opened even that app hasn't been started yet. And I think Branch deep link should has the same behavior. Do I mis-configure anything?

I am Using BranchIO for my project , I am sending Title and image in the branch Universal object which can be show in the message send via whatsapp, but since the whatsapp has been upgraded the title and image is not been show , as it was earlier.Please help me ,What is the problem?

BranchUniversalObject branchUniversalObject = new BranchUniversalObject()
// The identifier is what Branch will use to de-dupe the content across many different Universal Objects
.setCanonicalIdentifier("item/12345")
// This is where you define the open graph structure and how the object will appear on Facebook or in a deepview
.setTitle("Suits")
.setContentDescription("Great suits here")
.setContentImageUrl("http://steezo.com/wp-content/uploads/2012/12/man-in-suit.jpg")
// You use this to specify whether this content can be discovered publicly - default is public
.setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
// Here is where you can add custom keys/values to the deep link data
.addContentMetadata("picurl", "http://steezo.com/wp-content/uploads/2012/12/man-in-suit.jpg");

THis Title and ContentImageUrl is not working

cannot add a JSONObject as BranchUniversalObject metadata field

There's no way right now to add a JSONObject when I create a BranchUniversalObject, before I was able to do this:

final JSONObject ps = new JSONObject();
ps.put("params", new JSONObject("{\"a_key\":\"a_value\"}"));
final BranchShortLinkBuilder shortLinkBuilder = new BranchShortLinkBuilder(defaultContext);
shortLinkBuilder.setParameters(ps);
shortLinkBuilder.generateShortUrl(/* … */);

Even if I try to do this:

final JSONObject values = new JSONObject();
values.put("a_key", "a_value");
final JSONObject params = new JSONObject();
params.put("params", values);
BranchUniversalObject branchUniversalObject = BranchUniversalObject.createInstance(params);

params values is casted to a String.

"+clicked_branch_link":false all the time

Manifest:

 <activity
        android:name=".activity.LoginScreen"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustResize"
        android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>

        <intent-filter>
            <data android:scheme="myscheme" android:host="open" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>
    <meta-data android:name="io.branch.sdk.TestMode" android:value="true" />
    <meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_my_key" />
    <meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_my_key" />

Custom Application class:

  public class MyApplication extends MultiDexApplication {
       @Override
       public void onCreate() {
       super.onCreate();

       Branch.getAutoInstance(this);
 }

And login screen:

@Override
protected void onStart() {
    super.onStart();

    Branch branch = null;
    try {
        branch = Branch.getInstance();
    } catch (BranchException e) {
        e.printStackTrace();
    }
    final Branch finalBranch = branch;
    branch.initSession(new Branch.BranchReferralInitListener() {
        @Override
        public void onInitFinished(final JSONObject jsonObject, final BranchError branchError) {
            Log.v("params", jsonObject.toString());
        }
    }, this.getIntent().getData(), this);
}

@Override
public void onNewIntent(Intent intent) {
    this.setIntent(intent);
}

And here is the issue, case is next:

  1. App is closed
  2. User click on branch link
  3. App opening, Login screen starts
  4. in onInitFinished callback I always got next params:
    {"+is_first_session":false,"+clicked_branch_link":false}

Why clicked branch_link = false ? I'm clicking on link...What I missed ?

Thanks,
Dmytro

Urgent: Drop ApacheClient for Marshmellow / Update minSDK to 9

Because of the behaviour changes for Android M it is now vital to drop the 'org.apache.http.legacy' package. It is no longer included on Android M and with good reason.

At the very least:

  • Update the minimum SDK to 9. Froyo and below is less than 0.5% (source 1 2)
  • Switch to HttpURLConnection

Currently, if you build for Android M, the classes will not be found and the app crashes. If you use Proguard, these problems arise compile time.

Work around is module-level com.android.application build.gradle

android {
    useLibrary 'org.apache.http.legacy'
}

Perhaps think about moving over to Volley or OkHttp, since projects that include this library already are using these or even better, provide adapters to use either or none.

Crash on new install open application

Hello,
I am using Branch-1.8.4.jar with my project. When I installed my app from the play store (alpha testing version) and try to open the first time, the app crashed. I checked the logs and saw below crash logs.

More info:
The params I passed when creating a branch referral url
branch.getReferralUrl("android-app", null, new Branch.BranchLinkCreateListener() { }
But I think this has nothing to do with the crash, since I have installed the app by searching in Play Store , not by clicking the referral link generated by the app.

Crash Logs:
java.lang.RuntimeException: Unable to start receiver io.branch.referral.InstallListener: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2586)
at android.app.ActivityThread.access$1700(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at io.branch.referral.InstallListener.onReceive(SourceFile:39)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2579)
            at android.app.ActivityThread.access$1700(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)

I want to add two links in the ShareSheetStyle part of branch io one of details of the post and second for the playstore link, how to do this in android ? Please help me as I am working on this since last week.

final LinkProperties linkProperties = new LinkProperties()
.setChannel("facebook")
.setFeature("sharing")
.addControlParameter("id",""+id)
.addControlParameter("$desktop_url",share_link)
// .addControlParameter("$android_deeplink_path", "Download App -https://play.google.com/store/apps/details?id=com.clinate.clinate&hl=en");
.addControlParameter("$android_url1", share_link)
.addControlParameter("$android_url2", "Download APP -"+"https://play.google.com/store/apps/details?id=com.clinate.clinate&hl=en");

Hard tabs everywhere!

Stop using hard tabs. Replace all hard tabs with soft tabs (for Java and Android, that's 4 spaces).

onInitFinished referringParams not cleared

after onInitFinished(JSONObject referringParams, BranchError error)

i get the params I want from referringParams and that works perfectly, but then when I go to a different app and back, the call to method onInitFinished still is triggered with the same params as previously.

I noticed then when I call Branch.getInstance().resetUserSession(); from inside the onInitFinished callback, the call is not repeated, but is that the correct way?

User identity can not be set

I/BranchMetricsLoggedInBehavior﹕ [branch-behavior] branch identity result 
{
    "error_message": "Trouble reaching server. Please try again in a few minutes"
}

Trouble setting the user alias. Check network connectivity and that you properly initialized

Oh, and I am connected. For sure.

How do you know that your session is initialized when you use automatic session management?

Branch.getAutoInstance() does automatic session management according to the doc.

Does that mean I can use any of the branch functionality freely in any place of my code (in any activity)?

In older style, there's a BranchReferralInitListener which I could use to make sure branch is fully initialized.

How can I tell Branch is initialized if I use the automatic session management?

Share sheet is not internationalized

"Copy link" and "More" are hardcoded which makes it impossible to internationalize them.

Would be great to support dynamic names for those items so they can be internationalized.

Thanks.

gradle project dependency

Hello Branch Team,

Loved your Product . As everybody moving to android studio. It would be better if you can add a gradle dependency on documention .

dependencies {
compile '........'
}
Thanks

Branch stopped working "User session has not been initialized!"

[behavior] CREATED: BranchMetricsLoggedInBehavior
I/BranchSDK﹕ Branch Warning: You are using your test app's Branch Key. Remember to change it to live Branch Key during deployment.
I/BranchSDK﹕ Branch Error: User session has not been initialized!
[branch-behavior] user is @derkasaurus/978
[branch-behavior] initializing for null intent data
I/BranchSDK﹕ Branch Error: User session has not been initialized!
  • In MyCustomApplicationClass call Branch.getAutoInstance( this );.
  • In MyActivity call Branch.getInstance( Activity#getApplicationContext(), activity#getString( 0 R.string.api_branch_key ) ); or Branch.getInstance( Activity#getApplicationContext()
  • Set identity using Branch#setIdentity
  • Call Branch#initSession( ( referringParams, error ) -> { ... } )

The biggest problem with all this is that initSession does not return. The callback is never called. No error messages except for the logs. Short url generation also doesn't work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.