SlideShare a Scribd company logo
Android is going to Go!
Android and golang
Who are you?
@AlmogBaku on github
1. A serial entrepreneur
2. Co-Founder & CTO @ Rimoto
3. Developer for 12 years
4. GitHub addicted.
5. Blog about entrepreneurship and
development:
www.AlmogBaku.com
What is Rimoto?
Rimoto enable apps to sponsor their user’s mobile-data, and
to became accessible for international travellers,
regardless their data-plan, boosting their engagement.
What are we going to talk about?
1. What is Go?
2. How can we use Go with Android?
3. When is it useful?
Disclaimer
You wanna know more? Google it!
Google tip: use the keyword “golang”
Who heard
about Go?
Why use Go, and what is it?!
• New modern language (since 2009)
• Super fast (native) compiling
• Concurrent
• Performant
• Garbage collected
• Standard libraries
Hello world
package main
import "fmt"
func main() {
fmt.Println("Hello DroidCon!")
}
RUN
Goroutines
func boring() {
for i := 0; i < 10; i++ {
sayIt(i)
}
}
func sayIt(i int) {
time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond)
fmt.Println("I'm saying ", i)
}
RUN
Goroutines
func not_boring() {
for i := 0; i < 10; i++ {
go sayIt(i)
}
time.Sleep(2 * time.Second)
}
func sayIt(i int) {
time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond)
fmt.Println("I'm saying ", i)
}
RUN
Goroutines syncing / WaitGroup
func not_boring_at_all() {
wg := sync.WaitGroup{}
wg.Add(10)
for i := 0; i < 10; i++ {
go sayIt(i, &wg)
}
wg.Wait()
}
func sayIt(i int, wg *sync.WaitGroup) {
defer wg.Done()
time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond)
fmt.Println("I'm saying ", i)
}
RUN
Goroutines communications / Channels
package main
import "fmt"
func main() {
c := make(chan string)
for i := 0; i < 5; i++ {
go func() {
c <- "ping"
}()
}
for i := 0; i < 5; i++ {
go func() {
c <- "pong"
}()
}
for i := 0; i < 10; i++ {
fmt.Println(<-c)
}
}
RUN
Standard libraries
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there!")
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}
Go Mobile
A tool for using Golang for native mobile apps easily!
Caution
The Go Mobile project is experimental. Use this at your own
risk.
Why?
1. Full-stack development
2. Write a single cross-platform Go library
3. Bring a simple and modern language
and development tooling to mobile
4. Enjoy Go benefits of native, faster, and
much more concurrent code
How?
Native Apps
● Write the whole app in Go (with OpenGL)
● Use Go packages for graphics, event handling, audio,
etc.
● When Native App UI is not required (i.e. games)
SDK Apps
● Write common functionality in
Go, as a library
Native Go Apps
• 100% Go app
• Multi platform: Android, iOS and Desktop
• GUI with OpenGL
Behind the scenes
NativeActivity
Android
App
Gomobile
A tool that automate this process
– Toolchain installation
– Creating NativeActivity
– Attach the Go runtime to the app
– Bind the App binary to the app
– Multi Architecture build
– Cross platform(Android/iOS) build
$ gomobile build golang.org/x/mobile/example/basic
$ gomobile install golang.org/x/mobile/example/basic
DEMO
SDKs
• Build the app natively with Java/Swift/Obj. C
• Write a simple regular Go library
• Reuse libraries across platforms and projects
Common library
iOS
Android
Backend
service A
Backend
service B
3rd party
Behind the scenes
JNI
Android
App
Go shared binary
rpc
Behind the scenes
package mypkg
func Hello() (string, error) { return "Gopher", nil }
public abstract class Mypkg {
public static String hello() throws Exception { ... }
}
Go Library:
Java API:
Gomobile
A tool that automate this process
– Multi Architecture build
– Build as shared library
– Automatically generate the binding for Java/Swift/Obj. C
– Bundle everything to an .aar
– Cross platform(Android/iOS) build
$ gomobile bind -target=android golang.org/x/mobile/example/bind/hello
DEMO
Disadvantages
Nothing is perfect..
• .aar includes all architecture binaries (increase size)
• go binaries are currently statically linked
• Go as a native app is lack of many sensors and
integrations with the Android/iOS APIs
• The communication between the Platform and the go
binary is not free
Questions?
Thanks.
@AlmogBaku

More Related Content

PDF
GITS Class #17: Coding Multiple Apps with Flutter
PDF
[ABC2018Spring]Flutterアプリ開発入門
PPTX
Flutter 1
PDF
A good intro to Flutter and its magic
PPTX
Reactive declarative UI as code - DroidCon Vietnam 2019
PDF
Flutter bus 2018
PPTX
Flutter Festival - Intro Session
PDF
Hello Flutterの次におさえたい Flutterのポイント その6 (レイアウト編)
GITS Class #17: Coding Multiple Apps with Flutter
[ABC2018Spring]Flutterアプリ開発入門
Flutter 1
A good intro to Flutter and its magic
Reactive declarative UI as code - DroidCon Vietnam 2019
Flutter bus 2018
Flutter Festival - Intro Session
Hello Flutterの次におさえたい Flutterのポイント その6 (レイアウト編)

What's hot (20)

PDF
What is flutter and why should i care? Lightning talk
PPTX
Captivate 5 and Android
PDF
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
PPTX
Introduction to Flutter
PDF
ARText in Cocoaheads Taipei 201709
PDF
Introduction to mobile cross platform solutions(Xamarin vs React Native vs Fl...
PDF
Google IO 2015
PDF
Flutter tutorial for Beginner Step by Step
PDF
Grokking TechTalk #26: Kotlin, Understand the Magic
PDF
#Code2Create:: Introduction to App Development in Flutter with Dart
PDF
Practical Android Course Part I - Introduction, Activities (KNI)
PDF
From your pocket to your wrist with Android Wear
PDF
Google IO 2015 Highlights
PDF
Cross Platform App Development Benefits
PDF
Google I/O 2015 Android & Tech Announcements
PPTX
Google I/O 2016 Key notes
PDF
Introduction to Flutter - truly crossplatform, amazingly fast
PPTX
Cross-Platform Mobile Apps with Ruby, MWRC
PDF
ABC2018 Autumn: Android PIe UI Design
PDF
Google I/O 2018 KeynoteとDeveloper KeynoteのOverview
What is flutter and why should i care? Lightning talk
Captivate 5 and Android
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Introduction to Flutter
ARText in Cocoaheads Taipei 201709
Introduction to mobile cross platform solutions(Xamarin vs React Native vs Fl...
Google IO 2015
Flutter tutorial for Beginner Step by Step
Grokking TechTalk #26: Kotlin, Understand the Magic
#Code2Create:: Introduction to App Development in Flutter with Dart
Practical Android Course Part I - Introduction, Activities (KNI)
From your pocket to your wrist with Android Wear
Google IO 2015 Highlights
Cross Platform App Development Benefits
Google I/O 2015 Android & Tech Announcements
Google I/O 2016 Key notes
Introduction to Flutter - truly crossplatform, amazingly fast
Cross-Platform Mobile Apps with Ruby, MWRC
ABC2018 Autumn: Android PIe UI Design
Google I/O 2018 KeynoteとDeveloper KeynoteのOverview
Ad

Viewers also liked (18)

PDF
Mobile SDKs: Use with Caution - Ori Lentzitzky
PDF
Android Application Optimization: Overview and Tools - Oref Barad, AVG
PPTX
Good Rules for Bad Apps - Shem magnezi
PDF
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
PPTX
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
PPTX
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
PDF
Cognitive interaction using Wearables - Eyal herman, IBM
PDF
Engineering Wunderlist for Android - Ceasr Valiente, 6Wunderkinder
PDF
Intro to Dependency Injection - Or bar
PPTX
Creating killer apps powered by watson cognitive services - Ronen Siman-Tov, IBM
PDF
3 things every Android developer must know about Microsoft - Ido Volff, Micro...
PPTX
Set it and forget it: Let the machine learn its job - Guy Baron, Vonage
PDF
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
PDF
Context is Everything - Royi Benyossef
PDF
Knock knock! Who's there? Doze. - Yonatan Levin
PPTX
Optimize your delivery and quality with the right release methodology and too...
PDF
Android Continuous Integration and Automation - Enrique Lopez Manas, Sixt
PDF
Build an App with Blindfold - Britt Barak
Mobile SDKs: Use with Caution - Ori Lentzitzky
Android Application Optimization: Overview and Tools - Oref Barad, AVG
Good Rules for Bad Apps - Shem magnezi
Write code that writes code! A beginner's guide to Annotation Processing - Ja...
Will it run or will it not run? Background processes in Android 6 - Anna Lifs...
Tricks to Making a Realtime SurfaceView Actually Perform in Realtime - Maarte...
Cognitive interaction using Wearables - Eyal herman, IBM
Engineering Wunderlist for Android - Ceasr Valiente, 6Wunderkinder
Intro to Dependency Injection - Or bar
Creating killer apps powered by watson cognitive services - Ronen Siman-Tov, IBM
3 things every Android developer must know about Microsoft - Ido Volff, Micro...
Set it and forget it: Let the machine learn its job - Guy Baron, Vonage
Think Async: Understanding the Complexity of Multithreading - Avi Kabizon & A...
Context is Everything - Royi Benyossef
Knock knock! Who's there? Doze. - Yonatan Levin
Optimize your delivery and quality with the right release methodology and too...
Android Continuous Integration and Automation - Enrique Lopez Manas, Sixt
Build an App with Blindfold - Britt Barak
Ad

Similar to Android is going to Go! - Android and goland - Almog Baku (20)

PDF
Develop Android/iOS app using golang
PDF
Go for Mobile Games
PDF
Develop Android app using Golang
PDF
Gomobile: gophers in the land of Android
PDF
Mobile Apps by Pure Go with Reverse Binding
PPTX
Ready, set, go! An introduction to the Go programming language
PDF
(Live) build and run golang web server on android.avi
PDF
Introduction to Go
PDF
Java to Golang: An intro by Ryan Dawson Seldon.io
PDF
What's New in Hybrid App Development
PDF
Physical Computing Using Go and Arduino
PDF
Go After 4 Years in Production - QCon 2015
PPTX
Comparing C and Go
PPTX
Scaling applications with go
PDF
Inroduction to golang
PDF
The Go features I can't live without, 2nd round
PDF
Beyond the Hype: 4 Years of Go in Production
PDF
Mender.io | Develop embedded applications faster | Comparing C and Golang
PDF
Why and what is go
PPTX
Go fundamentals
Develop Android/iOS app using golang
Go for Mobile Games
Develop Android app using Golang
Gomobile: gophers in the land of Android
Mobile Apps by Pure Go with Reverse Binding
Ready, set, go! An introduction to the Go programming language
(Live) build and run golang web server on android.avi
Introduction to Go
Java to Golang: An intro by Ryan Dawson Seldon.io
What's New in Hybrid App Development
Physical Computing Using Go and Arduino
Go After 4 Years in Production - QCon 2015
Comparing C and Go
Scaling applications with go
Inroduction to golang
The Go features I can't live without, 2nd round
Beyond the Hype: 4 Years of Go in Production
Mender.io | Develop embedded applications faster | Comparing C and Golang
Why and what is go
Go fundamentals

More from DroidConTLV (20)

PDF
Mobile Development in the Information Age - Yossi Elkrief, Nike
PDF
Doing work in the background - Darryn Campbell, Zebra Technologies
PDF
No more video loss - Alex Rivkin, Motorola Solutions
PDF
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
PDF
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
PDF
MVVM In real life - Lea Cohen Tannoudji, Lightricks
PDF
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
PDF
Building Apps with Flutter - Hillel Coren, Invoice Ninja
PDF
New Android Project: The Most Important Decisions - Vasiliy Zukanov
PDF
Designing a Design System - Shai Mishali, Gett
PDF
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
PDF
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
PDF
Flutter State Management - Moti Bartov, Tikal
PDF
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
PDF
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
PDF
DroidconTLV 2019
PDF
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
PDF
Introduction to React Native - Lev Vidrak, Wix
PDF
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
PDF
Educating your app – adding ML edge to your apps - Maoz Tamir
Mobile Development in the Information Age - Yossi Elkrief, Nike
Doing work in the background - Darryn Campbell, Zebra Technologies
No more video loss - Alex Rivkin, Motorola Solutions
Mobile at Scale: from startup to a big company - Dor Samet, Booking.com
LiveData on Steroids - Giora Shevach + Shahar Ben Moshe, Climacell
MVVM In real life - Lea Cohen Tannoudji, Lightricks
Best Practices for Using Mobile SDKs - Lilach Wagner, SafeDK (AppLovin)
Building Apps with Flutter - Hillel Coren, Invoice Ninja
New Android Project: The Most Important Decisions - Vasiliy Zukanov
Designing a Design System - Shai Mishali, Gett
The Mighty Power of the Accessibility Service - Guy Griv, Pepper
Kotlin Multiplatform in Action - Alexandr Pogrebnyak - IceRockDev
Flutter State Management - Moti Bartov, Tikal
Reactive UI in android - Gil Goldzweig Goldbaum, 10bis
Fun with flutter animations - Divyanshu Bhargava, GoHighLevel
DroidconTLV 2019
Ok google, it's time to bot! - Hadar Franco, Albert + Stav Levi, Monday
Introduction to React Native - Lev Vidrak, Wix
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Educating your app – adding ML edge to your apps - Maoz Tamir

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
Spectroscopy.pptx food analysis technology
Programs and apps: productivity, graphics, security and other tools
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Approach and Philosophy of On baking technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
Digital-Transformation-Roadmap-for-Companies.pptx
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Android is going to Go! - Android and goland - Almog Baku

  • 1. Android is going to Go! Android and golang
  • 2. Who are you? @AlmogBaku on github 1. A serial entrepreneur 2. Co-Founder & CTO @ Rimoto 3. Developer for 12 years 4. GitHub addicted. 5. Blog about entrepreneurship and development: www.AlmogBaku.com
  • 3. What is Rimoto? Rimoto enable apps to sponsor their user’s mobile-data, and to became accessible for international travellers, regardless their data-plan, boosting their engagement.
  • 4. What are we going to talk about? 1. What is Go? 2. How can we use Go with Android? 3. When is it useful?
  • 5. Disclaimer You wanna know more? Google it! Google tip: use the keyword “golang”
  • 7. Why use Go, and what is it?! • New modern language (since 2009) • Super fast (native) compiling • Concurrent • Performant • Garbage collected • Standard libraries
  • 8. Hello world package main import "fmt" func main() { fmt.Println("Hello DroidCon!") } RUN
  • 9. Goroutines func boring() { for i := 0; i < 10; i++ { sayIt(i) } } func sayIt(i int) { time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond) fmt.Println("I'm saying ", i) } RUN
  • 10. Goroutines func not_boring() { for i := 0; i < 10; i++ { go sayIt(i) } time.Sleep(2 * time.Second) } func sayIt(i int) { time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond) fmt.Println("I'm saying ", i) } RUN
  • 11. Goroutines syncing / WaitGroup func not_boring_at_all() { wg := sync.WaitGroup{} wg.Add(10) for i := 0; i < 10; i++ { go sayIt(i, &wg) } wg.Wait() } func sayIt(i int, wg *sync.WaitGroup) { defer wg.Done() time.Sleep(time.Duration(rand.Intn(1e3)) * time.Millisecond) fmt.Println("I'm saying ", i) } RUN
  • 12. Goroutines communications / Channels package main import "fmt" func main() { c := make(chan string) for i := 0; i < 5; i++ { go func() { c <- "ping" }() } for i := 0; i < 5; i++ { go func() { c <- "pong" }() } for i := 0; i < 10; i++ { fmt.Println(<-c) } } RUN
  • 13. Standard libraries package main import ( "fmt" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there!") } func main() { http.HandleFunc("/", handler) http.ListenAndServe(":8080", nil) }
  • 14. Go Mobile A tool for using Golang for native mobile apps easily!
  • 15. Caution The Go Mobile project is experimental. Use this at your own risk.
  • 16. Why? 1. Full-stack development 2. Write a single cross-platform Go library 3. Bring a simple and modern language and development tooling to mobile 4. Enjoy Go benefits of native, faster, and much more concurrent code
  • 17. How? Native Apps ● Write the whole app in Go (with OpenGL) ● Use Go packages for graphics, event handling, audio, etc. ● When Native App UI is not required (i.e. games) SDK Apps ● Write common functionality in Go, as a library
  • 18. Native Go Apps • 100% Go app • Multi platform: Android, iOS and Desktop • GUI with OpenGL
  • 20. Gomobile A tool that automate this process – Toolchain installation – Creating NativeActivity – Attach the Go runtime to the app – Bind the App binary to the app – Multi Architecture build – Cross platform(Android/iOS) build $ gomobile build golang.org/x/mobile/example/basic $ gomobile install golang.org/x/mobile/example/basic
  • 21. DEMO
  • 22. SDKs • Build the app natively with Java/Swift/Obj. C • Write a simple regular Go library • Reuse libraries across platforms and projects Common library iOS Android Backend service A Backend service B 3rd party
  • 24. Behind the scenes package mypkg func Hello() (string, error) { return "Gopher", nil } public abstract class Mypkg { public static String hello() throws Exception { ... } } Go Library: Java API:
  • 25. Gomobile A tool that automate this process – Multi Architecture build – Build as shared library – Automatically generate the binding for Java/Swift/Obj. C – Bundle everything to an .aar – Cross platform(Android/iOS) build $ gomobile bind -target=android golang.org/x/mobile/example/bind/hello
  • 26. DEMO
  • 27. Disadvantages Nothing is perfect.. • .aar includes all architecture binaries (increase size) • go binaries are currently statically linked • Go as a native app is lack of many sensors and integrations with the Android/iOS APIs • The communication between the Platform and the go binary is not free