This document discusses developing Android apps in Go using the gomobile tool. It covers cross-compiling Go code for Android, using cgo to access Android platform APIs, and developing both SDK and native Android apps in Go. It then describes how gomobile bind can generate bindings between Go and Java to allow accessing Android platform APIs from Go code through reverse bindings. This allows writing fully native Android apps directly in Go.
I talked this presentation in GopherCon 2016.
Go Mobile (golang.org/x/mobile) is a project which shows new possibilities for mobile apps development.
Especially, for mobile games which requires high performance processing, Go can be expected to be an alternative to C and C++.
This session explains how to develop game apps using some packages such as app, event and sprite provided by Go Mobile project.
Furthermore the session introduces a way to call Android API from Go codes, and solutions for some problems which occurs when we distribute apps on Google Play.
I would like to show current capabilities and future potentials of Go Mobile.
I talked this presentation in GopherCon 2016.
Go Mobile (golang.org/x/mobile) is a project which shows new possibilities for mobile apps development.
Especially, for mobile games which requires high performance processing, Go can be expected to be an alternative to C and C++.
This session explains how to develop game apps using some packages such as app, event and sprite provided by Go Mobile project.
Furthermore the session introduces a way to call Android API from Go codes, and solutions for some problems which occurs when we distribute apps on Google Play.
I would like to show current capabilities and future potentials of Go Mobile.
Slides for a presentation given at the Go MN meetup https://www.meetup.com/golangmn/ given on 4/15/2020.
The associated code is available at https://github.com/andreburgaud/meetup-golang-lua. The topic is about the interoperability between Go and Lua, or Lua and Go.
Android is going to Go! Android and GolangAlmog Baku
I recently talked in Droidcon about building using Go with Android
We talked about what is Go? And why it's so awesome? And how can we use it with Android?
On this session we've learnt a little bit about Go, and how can we use it with Android- about the use cases, and the secret
tricks to use it with mobile applications.
This is a 45-60-minute tech talk introducing developers to coding new projects using Google APIs with Python. While most of the examples use G Suite APIs, they work for most Google APIs in general.
(Live) build and run golang web server on android.aviSeongJae Park
Presented from gdg devfair 2014 and gdg korea golang seoul meetup 2015.
Added explanation about go 1.4 official android support a little from gdg korea golang seoul meetup presentation.
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...Andy Maleh
You may not already know, but it is possible to build native desktop applications for Mac, Windows, and Linux using Ruby, including native packaging as APP/DMG/PKG files on Mac, EXE/MSI files on Windows, and DEB/RPM files on Linux. In fact, Ruby syntax makes developing such applications much quicker with better maintainability than in traditional desktop development languages like C, C++, C#, Objective C, Swift, and Java. That is courtesy of Glimmer DSL for SWT, a JRuby Desktop Development GUI Framework that enables using the robust SWT cross-platform native GUI toolkit the Ruby way.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
1. Mobile Apps
by Pure Go
with Reverse Binding
GopherCon India
22nd Feb. 2017
The Go gopher was designed by Renee French.
The gopher stickers was made by Takuya Ueda.
Licensed under the Creative Commons 3.0
Attributions license.
Slide URL: https://goo.gl/OG55gT
2. Slide URL: https://goo.gl/OG55gT
Who am I?
Mercari, Inc./Souzoh, Inc.
Takuya Ueda
twitter: @tenntenn
■ Communities
Google Cloud Platform User Group (GCPUG) Tokyo
Go Beginners in Tokyo, Japan
golang.tokyo
Go Conference in Tokyo, Japan
■ Works
Developing Mercari Atte in GAE/Go
2
3. Slide URL: https://goo.gl/OG55gT
What is this talk about?
● The Basics of Go Mobile
○ Cross-compile / cgo for Android
○ What is Go Mobile?
○ SDK Apps and Native Apps
● Developing Android Apps in pure Go
○ gomobile bind
○ What is Reverse Bindings?
○ Use Platform APIs from Go
3
5. Slide URL: https://goo.gl/OG55gT
Cross-compile
● GOOS and GOARCH
○ Go can cross-compile
○ GOOS indicates target OS
○ GOARCH indicates target architecture
5
# Build for 32bit Windows
$ GOOS=windows GOARCH=386 go build
# Build for arm Linux
$ GOOS=linux GOARCH=arm go build
A linux/arm binary also works on android devices.
7. Slide URL: https://goo.gl/OG55gT
cgo
● C codes into Go codes
7
import "unsafe"
/*
#include <stdio.h>
#include <stdlib.h>
void hello(char *s) { printf("Hello, %sn", s); }
*/
import "C"
func main() {
str := C.CString("GopherCon India")
C.hello(str)
C.free(unsafe.Pointer(str))
}
Comments before import "C"
would be built as C codes
Call C’s function from Go code
8. Slide URL: https://goo.gl/OG55gT
cgo for Android
● cgo codes also can be cross-compiled
8
$ CGO_ENABLED=1
CC=arm-linux-androideabi-gcc
GOOS=android
GOARCH=arm
GOARM=7
go build -buildmode=pie hellocgo.go
$ adb push hellocgo /data/local/tmp
$ chmod 755 /data/local/tmp/hellocgo
$ /data/local/tmp/hellocgo
Hello, GopherCon India
GOOS should be android
when CGO_ENABLED is 1.
Enable cgo at cross-compiling
adb shell
PC
9. Slide URL: https://goo.gl/OG55gT
buildmode
● Change output formats
○ archive, c-archive
■ build into C archive (.a file)
○ shared, c-shared
■ build into shared library (.so file)
○ plugin
■ bulid into Go Plugin (<= Go 1.8)
○ exe
■ build into executable file
○ pie
■ build into PIE style executable file
9
archive and
shared ignore
main package
Go can build to .so files for Android
10. Slide URL: https://goo.gl/OG55gT
Go Mobile
● What is Go Mobile?
○ Go Mobile is a toolkit for Mobile Platform
(Android and iOS) in Go.
● How Go Mobile works?
○ Go Mobile provides bindings of Android
and iOS through cgo.
10
Go C
Java
Obj-C
JNIcgo
Android
iOS
12. Slide URL: https://goo.gl/OG55gT
Installation
● Install gomobile comand
● Initialize the build tool chain
○ gomobile init initializes the build tool
chain for mobile apps.
12
$ gomobile init -v
$ ls $GOPATH/pkg/gomobile
android_ndk_root pkg_android_amd64
pkg_android_arm64 pkg_darwin_arm version
pkg_android_386 pkg_android_arm
pkg_darwin_amd64 pkg_darwin_arm64
$ go get -u golang.org/x/mobile/cmd/gomobile
13. Slide URL: https://goo.gl/OG55gT
gomobile command
gomobile command provides sub-commands.
● Sub-commands
13
bind build a library for Android and iOS
build compile Android APK and iOS app
clean remove object files and cached gomobile files
init install android compiler toolchain
install compile android APK and install on device
version print version
14. Slide URL: https://goo.gl/OG55gT
SDK Apps and Native Apps
Go Mobile provides two ways to develop mobile
apps.
■ SDK Apps
● Write common funcations in Go as a
library
■ Native Apps
● Write UI and all codes in Go
14
15. Slide URL: https://goo.gl/OG55gT
SDK Apps and Native Apps
● SDK Apps for Android
● Native Apps for Android
15
Go
aar file
Binding Classes (Java)
Shared library (.so)
Java
UI, IAB, ...
As a library
gomobile bind
apk file
Go
GoNativeActivity
Shared library (.so)UI, audio, ...
gomobile build
16. Slide URL: https://goo.gl/OG55gT
An Example of SDK Apps: Ivy
● Ivy big number calculator (source code)
○ Interpriter for APL-like language
○ Android App and iOS App use a same engine
○ The engine is written in Go by Rob Pike
16
Google Play App Store
17. Slide URL: https://goo.gl/OG55gT
An Example of Native Apps
● Flappy Gopher
○ A mobile game written in Go Mobile
○ Developed by Andrew Gerrand
for Go Conference 2015 Winter
○ Source Code
17
19. Slide URL: https://goo.gl/OG55gT
gomobile bind
● Generate an Android Archive (.aar)
○ a shared library (.so) written in Go
○ a JAR file which is bult Java bindings
● Develop with Android Studio Plugin
○ Runs gomobile bind
○ Links to a generated .aar file
19
$ gomobile bind [-target ios|android] mypkg
21. Slide URL: https://goo.gl/OG55gT
Calling Go code from Java code
21
Bindings
Java codes
Application Codes
(Java)
C codes
Go/cgo codes
JNI Generated by
gomobile bind
SDK Codes
(Go)
cgo
22. Slide URL: https://goo.gl/OG55gT
An Example of Bindings
22
package sample
func Hello() string { return "Hello" }
type MyStruct struct { Str string }
func (s MyStruct) MyMethod() string { return s.Str }
public abstract class Sample {
// ...
private Sample() {} // uninstantiable
public static final class MyStruct extends Seq.Proxy {
public final native String getStr();
public final native void setStr(String v);
public native String MyMethod();
// ...
}
public static native String Hello();
}
Java
Go
Struct
Field
Method
Package Function
23. Slide URL: https://goo.gl/OG55gT
Type restrictions
● Signed integer and floating point type
● String and boolean type
● Byte slice type
● Any functions
○ parameter and result types must be supported types
○ results are 0, 1 or 2 (2nd result must be an error
type)
● Any struct type
○ all fields and methods must be supported types
● Any interface
○ all methods must be supported types
23
24. Slide URL: https://goo.gl/OG55gT
Calling Platform API from Go
● In-app Billing
○ Purchase a items in the game
● SNS connection
○ Facebook, Twitter, ...
● Advertisements
● Analytics
○ Google Analytics, Firebase, Facebook
Analytics,...
24
These APIs are provided
as Java SDK for Android
25. Slide URL: https://goo.gl/OG55gT
Traditional gomobile bind
● Bindings to Go from Java/Obj-C
● Platform APIs can be accessed BUT...
○ Indirect way
○ Needs wrappers
○ Not convenient
25
A way to access directly
Platform APIs from Go is needed!
26. Slide URL: https://goo.gl/OG55gT
Reverse Bindings
● Access Platform APIs from Go
● Generate bindings automatically
○ Reverse direction of traditional one
○ use gomobile bind
● Prposed by #16876 and #17102
(Android) (iOS)
26
28. Slide URL: https://goo.gl/OG55gT
An Example of Reverse Bindings
28
package pkg
import "Java/java/lang"
import "Java/pkg"
type Obj struct {
lang.Object
}
func (h *Obj) ToString(this *pkg.Obj) string {
return "hoge"
}
● Parse import statements
○ Java/* or ObjC/*
● Generate bindings automatically
corresponds java.lang
package in Java
inherit java.lang.Object
Hold a Java instance
29. Slide URL: https://goo.gl/OG55gT
How Generate Reverse Bindings?
● Parse import statements
○ Begin with Java/
● Extract class infomation by javap
○ Exported fields and methods
○ Dependent classes
○ Implementing interfaces
● Generate bindings of all dependented
classes and interfaces
29
$ javap java.lang.String
Compiled from "String.java"
public final class java.lang.String implements java.io.Serializable,
java.lang.Comparable<java.lang.String>, java.lang.CharSequence {
public static final java.util.Comparator<java.lang.String>
CASE_INSENSITIVE_ORDER;
public java.lang.String();
....
30. Slide URL: https://goo.gl/OG55gT
Using Platform APIs from Go
● Example of Reverse Binding in x/mobile
30
$ cd $GOPATH/src/golang.org/x/mobile
$ cd example/reverse/android
$ gradle wrapper
$ ./gradlew build
$ cd build/outputs/apk
$ adb install -r android-debug.apk
Android Studio
also can build
31. Slide URL: https://goo.gl/OG55gT
Use Platform APIs from Go
● Use Activity and write in life cycle of
Android
31
type MainActivity struct {
app.AppCompatActivity
binding databinding.ActivityMainBinding
}
func (a *MainActivity) OnCreate(
this gopkg.MainActivity, b os.Bundle) {
...
}
func (a *MainActivity) OnDestroy(
this gopkg.MainActivity) {
...
}
reverse.go
32. Slide URL: https://goo.gl/OG55gT
Use Platform APIs from Go
● Use data binding of Android
32
func (a *MainActivity) OnCreate(
this gopkg.MainActivity, b os.Bundle) {
this.Super().OnCreate(b)
db := DataBindingUtil.SetContentView(
this, rlayout.Activity_main)
a.binding = ActivityMainBinding.Cast(db)
a.binding.SetAct(this)
}
func (a *MainActivity) GetLabel() string {
return "Hello, GopherCon India!"
}
reverse.go
33. Slide URL: https://goo.gl/OG55gT
Use Platform APIs from Go
● Use data binding of Android
33
...
<data>
<variable name="act"
type="reverse.MainActivity"/>
</data>
<RelativeLayout ...
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{act.label}"/>
</RelativeLayout>
</layout>
activity_main.xml
34. Slide URL: https://goo.gl/OG55gT
Summaries
● The Basics of Go Mobile
○ Cross-compile / cgo for Android
○ What is Go Mobile?
○ SDK Apps and Native Apps
● Developing Android Apps in pure Go
○ gomobile bind
○ What is Reverse Bindings?
○ Use Platform APIs from Go
34
36. Slide URL: https://goo.gl/OG55gT
Binding between Go and Java
36
Package Abstruct Class
Struct Inner Class
Struct Field
Getter/Setter
(Native)
Method Method
(Native)
Package Function Static Method
Go Java
● gomobile bind generates bindings