Skip to content

Commit df32586

Browse files
committed
More testbed edits
1 parent 8450fad commit df32586

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

Branch-SDK-TestBed/src/main/java/io/branch/branchandroidtestbed/CustomBranchApp.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ public final class CustomBranchApp extends Application {
1717
public void onCreate() {
1818
super.onCreate();
1919

20-
IBranchLoggingCallbacks loggingCallbacks = new IBranchLoggingCallbacks() {
21-
@Override
22-
public void onBranchLog(String tag, String message) {
23-
String logMessage = tag + ": " + message;
24-
Log.d("BranchTestbed", logMessage);
25-
saveLogToFile(logMessage);
26-
}
20+
IBranchLoggingCallbacks loggingCallbacks = (message, tag) -> {
21+
Log.d("BranchTestbed", message);
22+
saveLogToFile(message);
2723
};
2824
Branch.enableLogging(loggingCallbacks);
25+
2926
Branch.getAutoInstance(this);
3027
}
3128

Branch-SDK-TestBed/src/main/java/io/branch/branchandroidtestbed/MainActivity.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,18 @@ public void onClick(View v) {
598598
.setSearchQuery("product name")
599599
.addCustomDataProperty("Custom_Event_Property_Key1", "Custom_Event_Property_val1")
600600
.addContentItems(branchUniversalObject)
601-
.logEvent(MainActivity.this);
602-
Toast.makeText(getApplicationContext(), "Sent Branch Content Event", Toast.LENGTH_SHORT).show();
601+
.logEvent(MainActivity.this, new BranchEvent.BranchLogEventCallback() {
602+
@Override
603+
public void onSuccess(int responseCode) {
604+
Toast.makeText(getApplicationContext(), "Sent Branch Content Event: " + responseCode, Toast.LENGTH_SHORT).show();
605+
}
606+
607+
@Override
608+
public void onFailure(Exception e) {
609+
Log.d("BranchSDK_Tester", e.toString());
610+
Toast.makeText(getApplicationContext(), "Error sending Branch Content Event: " + e.toString(), Toast.LENGTH_SHORT).show();
611+
}
612+
});
603613
}
604614
});
605615

@@ -613,8 +623,18 @@ public void onClick(View v) {
613623
.setDescription("User created an account")
614624
.addCustomDataProperty("registrationID", "12345")
615625
.addContentItems(branchUniversalObject)
616-
.logEvent(MainActivity.this);
617-
Toast.makeText(getApplicationContext(), "Sent Branch Lifecycle Event", Toast.LENGTH_SHORT).show();
626+
.logEvent(MainActivity.this, new BranchEvent.BranchLogEventCallback() {
627+
@Override
628+
public void onSuccess(int responseCode) {
629+
Toast.makeText(getApplicationContext(), "Sent Branch Lifecycle Event: " + responseCode, Toast.LENGTH_SHORT).show();
630+
}
631+
632+
@Override
633+
public void onFailure(Exception e) {
634+
Log.d("BranchSDK_Tester", e.toString());
635+
Toast.makeText(getApplicationContext(), "Error sending Branch Lifecycle Event: " + e.toString(), Toast.LENGTH_SHORT).show();
636+
}
637+
});
618638
}
619639
});
620640

Branch-SDK-TestBed/src/main/res/layout/activity_log_output.xml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
android:layout_width="match_parent"
44
android:layout_height="match_parent">
55

6-
<TextView
7-
android:id="@+id/logOutputTextView"
6+
<ScrollView
87
android:layout_width="match_parent"
98
android:layout_height="match_parent"
10-
android:padding="16dp"
11-
android:textSize="14sp"
12-
android:text="Logs will appear here" />
9+
android:padding="16dp">
10+
11+
<TextView
12+
android:id="@+id/logOutputTextView"
13+
android:layout_width="match_parent"
14+
android:layout_height="wrap_content"
15+
android:textSize="14sp"
16+
android:text="Logs will appear here" />
17+
</ScrollView>
1318
</RelativeLayout>

0 commit comments

Comments
 (0)