Skip to content

Commit f2f61d5

Browse files
committed
Attempt to read Binder version
1 parent ae4d061 commit f2f61d5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Demo/app/src/main/swift/MainActivity.swift

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import Foundation
99
import AndroidKit
1010
import JavaLang
11+
import Binder
1112

1213
@JavaClass("com.pureswift.swiftandroid.MainActivity")
1314
open class MainActivity: AndroidApp.Activity {
@@ -56,6 +57,10 @@ private extension MainActivity {
5657

5758
// need to recreate views
5859
setRootView()
60+
61+
Task {
62+
printBinderVersion()
63+
}
5964
}
6065

6166
func runAsync() {
@@ -310,6 +315,17 @@ private extension MainActivity {
310315
.add(2001, fragment1)
311316
.commit()
312317
}
318+
319+
private func printBinderVersion() {
320+
// Print Binder version
321+
do {
322+
let version = try BinderVersion.current
323+
logInfo("Binder Version: \(version)")
324+
}
325+
catch {
326+
logError("Unable to read binder: \(error)")
327+
}
328+
}
313329
}
314330

315331
extension MainActivity {
@@ -338,5 +354,8 @@ extension MainActivity {
338354
func logError(_ string: String) {
339355
Self.logError(string)
340356
}
357+
358+
func logInfo(_ string: String) {
359+
Self.logInfo(string)
360+
}
341361
}
342-

0 commit comments

Comments
 (0)