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

What's hot

Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution begin
SeongJae Park
 
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
Evan Lin
 
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
Evan Lin
 
Fastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリー
Fumiya Nakamura
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
Steven Cooper
 
Jedi knight
Jedi knightJedi knight
Jedi knight
Antonio Mas
 
Librerías Opensoure de Square
Librerías Opensoure de Square Librerías Opensoure de Square
Librerías Opensoure de Square
betabeers
 
Spring-batch Groovy y Gradle
Spring-batch Groovy y GradleSpring-batch Groovy y Gradle
Spring-batch Groovy y Gradle
Antonio Mas
 
RESTful API Development using Go
RESTful API Development using GoRESTful API Development using Go
RESTful API Development using Go
Baiju Muthukadan
 
Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017
Codemotion
 
Development of Mobile Applications
Development of Mobile ApplicationsDevelopment of Mobile Applications
Development of Mobile Applications
Dávid Kaya
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
HannahMoss14
 
ChromeとAndroidの過去・現在・未来
ChromeとAndroidの過去・現在・未来ChromeとAndroidの過去・現在・未来
ChromeとAndroidの過去・現在・未来
Shinobu Okano
 
Intro to Flutter
Intro to FlutterIntro to Flutter
Intro to Flutter
Eason Pai
 
Google I/O 2018 Extended, Baghdad - Flutter
Google I/O 2018 Extended, Baghdad  - FlutterGoogle I/O 2018 Extended, Baghdad  - Flutter
Google I/O 2018 Extended, Baghdad - Flutter
AbdElmomenKadhim
 
Intro. to Git and Github
Intro. to Git and GithubIntro. to Git and Github
Intro. to Git and Github
Olmo F. Maldonado
 
Understanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for Modules
Understanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for ModulesUnderstanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for Modules
Understanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for Modules
Mitali Bisht
 
Cross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React NativeCross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React Native
Korhan Bircan
 
Go lang
Go langGo lang
Introduction to go
Introduction to goIntroduction to go
Introduction to go
Anthony Chow
 

What's hot (20)

Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution begin
 
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
 
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
iThome Chatbot Day: 透過 Golang 無痛建置機器學習聊天機器人
 
Fastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリー
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
 
Jedi knight
Jedi knightJedi knight
Jedi knight
 
Librerías Opensoure de Square
Librerías Opensoure de Square Librerías Opensoure de Square
Librerías Opensoure de Square
 
Spring-batch Groovy y Gradle
Spring-batch Groovy y GradleSpring-batch Groovy y Gradle
Spring-batch Groovy y Gradle
 
RESTful API Development using Go
RESTful API Development using GoRESTful API Development using Go
RESTful API Development using Go
 
Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017Getting started with Go - Florin Patan - Codemotion Rome 2017
Getting started with Go - Florin Patan - Codemotion Rome 2017
 
Development of Mobile Applications
Development of Mobile ApplicationsDevelopment of Mobile Applications
Development of Mobile Applications
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
 
ChromeとAndroidの過去・現在・未来
ChromeとAndroidの過去・現在・未来ChromeとAndroidの過去・現在・未来
ChromeとAndroidの過去・現在・未来
 
Intro to Flutter
Intro to FlutterIntro to Flutter
Intro to Flutter
 
Google I/O 2018 Extended, Baghdad - Flutter
Google I/O 2018 Extended, Baghdad  - FlutterGoogle I/O 2018 Extended, Baghdad  - Flutter
Google I/O 2018 Extended, Baghdad - Flutter
 
Intro. to Git and Github
Intro. to Git and GithubIntro. to Git and Github
Intro. to Git and Github
 
Understanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for Modules
Understanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for ModulesUnderstanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for Modules
Understanding Pseudo-Versions Moving to Go 1.13 What is in Go 1.14+ for Modules
 
Cross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React NativeCross-Platform App Development with Flutter, Xamarin, React Native
Cross-Platform App Development with Flutter, Xamarin, React Native
 
Go lang
Go langGo lang
Go lang
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
 

Viewers also liked

Functional go
Functional goFunctional go
Functional go
Geison Goes
 
A microservice architecture based on golang
A microservice architecture based on golangA microservice architecture based on golang
A microservice architecture based on golang
Gianfranco Reppucci
 
Build REST APIs like a Jedi with Symfony2
Build REST APIs like a Jedi with Symfony2Build REST APIs like a Jedi with Symfony2
Build REST APIs like a Jedi with Symfony2
Almog Baku
 
Symfony2 form type
Symfony2 form typeSymfony2 form type
Symfony2 form type
Almog Baku
 
Drupal & javascript
Drupal & javascriptDrupal & javascript
Drupal & javascript
Almog Baku
 
Go goes Mobile: Quick Exploration on Go 1.5 and Gomobile
Go goes Mobile: Quick Exploration on Go 1.5 and GomobileGo goes Mobile: Quick Exploration on Go 1.5 and Gomobile
Go goes Mobile: Quick Exploration on Go 1.5 and Gomobile
Takahiro Yoshimura
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
Aerospike
 
Introduction to Go-Lang
Introduction to Go-LangIntroduction to Go-Lang
Introduction to Go-Lang
Folio3 Software
 
Docker-hanoi meetup #1: introduction about Docker
Docker-hanoi meetup #1: introduction about DockerDocker-hanoi meetup #1: introduction about Docker
Docker-hanoi meetup #1: introduction about Docker
Nguyen Anh Tu
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
SignalFx
 
Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
Wooga
 
Continuous Integration using Docker & Jenkins
Continuous Integration using Docker & JenkinsContinuous Integration using Docker & Jenkins
Continuous Integration using Docker & Jenkins
B1 Systems GmbH
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
Noah Davis
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
Cloudflare
 
Social Media Platforms, Insights & Data - Engage Bali 2016 by Jan Rezab
Social Media Platforms, Insights & Data - Engage Bali 2016 by Jan RezabSocial Media Platforms, Insights & Data - Engage Bali 2016 by Jan Rezab
Social Media Platforms, Insights & Data - Engage Bali 2016 by Jan Rezab
Jan Rezab
 
Docker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing MeetupDocker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing Meetup
Jérôme Petazzoni
 
Proposal format
Proposal formatProposal format
Proposal format
Mr SMAK
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of Everything
Charbel Zeaiter
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
Natasha Murashev
 

Viewers also liked (20)

Functional go
Functional goFunctional go
Functional go
 
A microservice architecture based on golang
A microservice architecture based on golangA microservice architecture based on golang
A microservice architecture based on golang
 
Build REST APIs like a Jedi with Symfony2
Build REST APIs like a Jedi with Symfony2Build REST APIs like a Jedi with Symfony2
Build REST APIs like a Jedi with Symfony2
 
Symfony2 form type
Symfony2 form typeSymfony2 form type
Symfony2 form type
 
Drupal & javascript
Drupal & javascriptDrupal & javascript
Drupal & javascript
 
Go goes Mobile: Quick Exploration on Go 1.5 and Gomobile
Go goes Mobile: Quick Exploration on Go 1.5 and GomobileGo goes Mobile: Quick Exploration on Go 1.5 and Gomobile
Go goes Mobile: Quick Exploration on Go 1.5 and Gomobile
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 
Introduction to Go-Lang
Introduction to Go-LangIntroduction to Go-Lang
Introduction to Go-Lang
 
Docker-hanoi meetup #1: introduction about Docker
Docker-hanoi meetup #1: introduction about DockerDocker-hanoi meetup #1: introduction about Docker
Docker-hanoi meetup #1: introduction about Docker
 
Go debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFxGo debugging and troubleshooting tips - from real life lessons at SignalFx
Go debugging and troubleshooting tips - from real life lessons at SignalFx
 
Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
 
Continuous Integration using Docker & Jenkins
Continuous Integration using Docker & JenkinsContinuous Integration using Docker & Jenkins
Continuous Integration using Docker & Jenkins
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming Go Profiling - John Graham-Cumming
Go Profiling - John Graham-Cumming
 
Social Media Platforms, Insights & Data - Engage Bali 2016 by Jan Rezab
Social Media Platforms, Insights & Data - Engage Bali 2016 by Jan RezabSocial Media Platforms, Insights & Data - Engage Bali 2016 by Jan Rezab
Social Media Platforms, Insights & Data - Engage Bali 2016 by Jan Rezab
 
Docker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing MeetupDocker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing Meetup
 
Proposal format
Proposal formatProposal format
Proposal format
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of Everything
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Similar to Android is going to Go! Android and Golang

The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
Mahmoud Samir Fayed
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N
 
When, how &amp; why use golang in 2021 go benefits &amp; use cases
When, how &amp; why use golang in 2021  go benefits &amp; use casesWhen, how &amp; why use golang in 2021  go benefits &amp; use cases
When, how &amp; why use golang in 2021 go benefits &amp; use cases
Katy Slemon
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
sangam biradar
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
Opersys inc.
 
What's New in Hybrid App Development
What's New in Hybrid App DevelopmentWhat's New in Hybrid App Development
What's New in Hybrid App Development
Jay Graves
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
Vimlesh Sharma
 
Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC Europe
Opersys inc.
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013
Opersys inc.
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
ShubhamMishra485
 
Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013
Opersys inc.
 
Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...
Katy Slemon
 
Features of go
Features of goFeatures of go
Features of go
Manjitsing Valvi
 
5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development
NelsonSEO
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
Simon Hewitt
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
Opersys inc.
 
Gomobile: gophers in the land of Android
Gomobile: gophers in the land of AndroidGomobile: gophers in the land of Android
Gomobile: gophers in the land of Android
Jovica Popovic
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
Opersys inc.
 
Adobe phonegap-workshop-2013
Adobe phonegap-workshop-2013Adobe phonegap-workshop-2013
Adobe phonegap-workshop-2013
Haig Armen
 

Similar to Android is going to Go! Android and Golang (20)

The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
When, how &amp; why use golang in 2021 go benefits &amp; use cases
When, how &amp; why use golang in 2021  go benefits &amp; use casesWhen, how &amp; why use golang in 2021  go benefits &amp; use cases
When, how &amp; why use golang in 2021 go benefits &amp; use cases
 
welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
 
What's New in Hybrid App Development
What's New in Hybrid App DevelopmentWhat's New in Hybrid App Development
What's New in Hybrid App Development
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC Europe
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013
 
Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...Hire golang developers and make the shift to brighter business future (build ...
Hire golang developers and make the shift to brighter business future (build ...
 
Features of go
Features of goFeatures of go
Features of go
 
5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development5 Reasons why Business Choose Go Program for Software Development
5 Reasons why Business Choose Go Program for Software Development
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Gomobile: gophers in the land of Android
Gomobile: gophers in the land of AndroidGomobile: gophers in the land of Android
Gomobile: gophers in the land of Android
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
Adobe phonegap-workshop-2013
Adobe phonegap-workshop-2013Adobe phonegap-workshop-2013
Adobe phonegap-workshop-2013
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 

Android is going to Go! Android and Golang

  • 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