SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution beginSeongJae Park
 
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line Bot
如何透過 Golang 與 Heroku 來一鍵部署 臉書機器人與 Line BotEvan 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.ioSteven Cooper
 
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 GradleAntonio Mas
 
RESTful API Development using Go
RESTful API Development using GoRESTful API Development using Go
RESTful API Development using GoBaiju 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 2017Codemotion
 
Development of Mobile Applications
Development of Mobile ApplicationsDevelopment of Mobile Applications
Development of Mobile ApplicationsDávid Kaya
 
Coding with golang
Coding with golangCoding with golang
Coding with golangHannahMoss14
 
ChromeとAndroidの過去・現在・未来
ChromeとAndroidの過去・現在・未来ChromeとAndroidの過去・現在・未来
ChromeとAndroidの過去・現在・未来Shinobu Okano
 
Intro to Flutter
Intro to FlutterIntro to Flutter
Intro to FlutterEason 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 - FlutterAbdElmomenKadhim
 
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 ModulesMitali 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 NativeKorhan Bircan
 
Introduction to go
Introduction to goIntroduction to go
Introduction to goAnthony Chow
 

Tendances (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
 

En vedette

A microservice architecture based on golang
A microservice architecture based on golangA microservice architecture based on golang
A microservice architecture based on golangGianfranco 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 Symfony2Almog Baku
 
Symfony2 form type
Symfony2 form typeSymfony2 form type
Symfony2 form typeAlmog Baku
 
Drupal & javascript
Drupal & javascriptDrupal & javascript
Drupal & javascriptAlmog 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 GomobileTakahiro 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 storyAerospike
 
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 DockerNguyen 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 SignalFxSignalFx
 
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 & JenkinsB1 Systems GmbH
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in PracticeNoah Davis
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-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 RezabJan 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 MeetupJérôme Petazzoni
 
Proposal format
Proposal formatProposal format
Proposal formatMr SMAK
 
The Future of Everything
The Future of EverythingThe Future of Everything
The Future of EverythingCharbel Zeaiter
 

En vedette (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
 

Similaire à 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 180Mahmoud Samir Fayed
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go langAmal 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 casesKaty 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 IOpersys 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 DevelopmentJay Graves
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with goVimlesh Sharma
 
Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeOpersys inc.
 
Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Embedded Android Workshop / ELC 2013
Embedded Android Workshop / ELC 2013Opersys 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 2013Opersys 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
 
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 DevelopmentNelsonSEO
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to GoSimon Hewitt
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys 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 AndroidJovica Popovic
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
 
Adobe phonegap-workshop-2013
Adobe phonegap-workshop-2013Adobe phonegap-workshop-2013
Adobe phonegap-workshop-2013Haig Armen
 

Similaire à 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
 

Dernier

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Dernier (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

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