SlideShare a Scribd company logo
1 of 47
Download to read offline
Real World
Android Akka
Taisuke Oe
Who Am I?
Taisuke Oe
GitHub: / Twitter:
My Work
Technical Advisor in Septeni Original, Inc.
Organizing
taisukeoe @OE_uia
BONX Android App
ScalaMatsuri
The largest international Scala Conference in Asia.
550-600 participants.
Voting session for CFP.
Travel support for highly voted speakers.
Bi-directional professional translation services.
🍣🍻
Around March next year?
This talk Is About:
VoIP client
VoIP stands for Voice Over Internet Protocol
Agenda
VoIP demo
Real world example
Why Android Akka?
How come does Scala work in Android?
Pros & Cons.
VoIP Demo
taisukeoe/VoIPAkka
Real World Example
What Is BONX ?
Group talk system during outdoor activities
Snowboarding
Skiing
Fishing
Cycling
...
BONX Architecture
Apps
VoIP client
Android : Scala
iOS : Objective C / Swift
Servers
API server : Ruby on Rails
Voice server : golang
Earpiece
Special bluetooth headset
Why Android Akka?
Stateful Asynchronous Stream
Processing System
VoIP is.
Upstream
Recorder -> some DSP -> Encoder -> Socket
Downstream
Socket -> Decoder -> some DSP -> Player
DSP stands for Digital Signal Processing
Every component has its own state, which is typically thread UNsafe.
BONX Must Be Resilient.
In outdoor activities, we must handle a tons of errors:
Poor network
Out of range, and recover from it
Hardware I/O errors
Bluetooth disconnection
If a component has a problem, it has to be recovered.
Even Worse
Errors might be discovered in a downstream of root-cause.
Root cause has to be xed.
Errors have to be propagated in reverse.
Broken modules might produce broken audio data.
Broken audio data might spoil user's experience.
It has to be disposed from its queue.
Summary: Two Requirements of
BONX
Stateful Concurrent Programming
Resiliency
That's Where Akka Comes In!
Akka is a toolkit for concurrent programing, resiliency
... and distributed systems (out of scope).
for (Stateful) Concurrent Programming
Message driven actor model
An actor encapsulates its state unless it exposes explicitly.
Actor with a State Example
class PlayActor() extends Actor {
private val track: AudioTrack = createNewAudioTrack //state. Thread UN-safe
override def preStart(): Unit = track.play()
override def receive: Receive = {
//An actor retrieves and process a message from its mailbox one-at-a-time.
case AudioPacketMessage(content:ByteString) =>
track.write(content.toArray[Byte], 0, content.length)
}
override def postStop(): Unit = {
track.stop()
track.flush()
track.release()
}
}
Akka Makes A System Resilient
Because Akka handles exceptions very well.
Actor hierarchy
Restart, Stop or Resume a child actor based on supervisorStrategy
Note: Restart via supervisingStrategy keeps messages in it.
Monitoring (Death watch)
A watcher actor get a Terminated(actorRef) message once a watchee actor
stops.
Note: subsequent recreation of the actor disposes all messages in it.
Sample Exception Handling by an Actor
class ExceptionHandlingActor() extends Actor{
private var childActor:ActorRef = createChildActor
override def supervisorStrategy: SupervisorStrategy = OneForOneStrategy(){
//Want to reset all mailboxes
case _:BrokenAudioDataException => Stop
//At default, child actors will be restarted with keeping their mailbox.
case t => super.supervisorStrategy.decider.applyOrElse(t, (_:Any) => Escalate)
}
def receive = {
//Stopped childActor will be recreated.
case Terminated(ref) => if(childActor == ref) {
context.unwatch(childActor)
childActor = createChildActor
}
}
private def createChildActor = {
val c = context.child(ChildActor.props)
context watch c
c
}
}
Recaps: How Akka Works Great?
Stateful Concurrent Programming
Actor state encapsulation / Processing a message one-at-a-time without an
explicit lock.
Resiliency
Actor hierarchy or monitoring handles errors as you like.
Akka solves VoIP problems (almost)!
Why Do I Say "Almost" ?
Some problems cannot be captured by exceptions.
An audio driver might get silenced sometimes and doesn't respond to
anything.
There is no silver bullet.
Ask a message and check if Ack will be returned within Timeout .
If the Ask gets timeout, stop and re-create a new actor.
Please rst consider if you can capture it as an expcetion.
This heuristic approach is not often recommended.
How Does Scala Work in Android?
Build Toolchain
scalac compiles Scala source codes into Java bytecodes
dex in Android SDK translates Java bytecode into Dalvik Executable bytecodes
is awesome.
It is almost functionally compatible with android standard build system.
It works great with other sbt-plugins.
scala-android/sbt-android
Android Device Specs Are Good Enough
In this couple of years, agship Android devices have:
4 to 10 cores CPU
3 to 4 GB memories
Up to around 512MB memory per VM can be used with largeHeap=true
con guration.
Q. Should You Use Scala in Android?
This decision is up to you.
Every technology has trade-o s.
Pros & Cons
Pros
Powerful language features, standard library and ecosystem.
Concurrent programming
Collection API
Algebraic Data Type & Pattern Matching
Traits
Productive
0.5 ~ 1.2 ppl for DevOps and Tuning of BONX Android App for two years.
Smaller context-switch cost between client codes and server codes.
Another Android Scala Usecase?
Stateless (except Views) concurrent programming
view modi cation must run on UIThread in Android.
Scala Offers Better APIs for Concurent
Programming
Scala standard Future works well.
Use your own ExecutionContext for onComplete, andThen or else.
UIExecutionContext pattern for UIThread callbacks.
UIExecutionContext Pattern
class UIExecutionContext(activity:Activity, reporter: Throwable => Unit)
extends ExecutionContext{
def execute(runnable: Runnable): Unit = activity.runOnUiThread(runnable)
def reportFailure(t: Throwable): Unit = reporter(t)
}
Future{
//some heavy calculation
}.onComplete{
case Success(result) => //reflect your result on views
case Failure(exp) => //show error message
}(uiExecutionContext) //Explicitly!
Other Android Scala Projects in Real World
Septeni Original
Comic app hits 6 million DLs!
47 Degrees
also has an Akka modules.
GANMA!
47deg/macroid
47deg/nine-cards-v2
47deg/scala-days-android
pocorall/scaloid
Cons
Method 64k limit per a dex le.
Scala standard library jar is too big to be a orded as it is.
Proguard or MultiDex must be used.
No Java8 support yet
Android SDK toolchain still targets Java6+ environment.
Akka version has to be 2.3.16, which is marked End-of-Life.
You have to be careful for wasting memories.
No o cial support by Google nor Lightbend (unlike Kotlin)
Proguard
Proguard removes unused classes, elds and methods.
Unused means not programatically refereced.
Proguard does NOT understand re ections.
Akka uses re ection much via Props or .conf le.
If Proguard is not con gured properly, then NoClassDefFoundError or
NoSuchMethodError are occured at runtime.
This is the most painful con guration to use Android Scala.
Do You Need to Con gure Proguard from Scratch?
No, absolutely.
provides a default setting for Scala standard library
jar.
This covers akka.actor and akka.io at least.
scala-android/sbt-android
proguard-con g.txt for akka-actor v2.3.16
For New Libraries
How to Con gure Proguard for-Ease.
It's Good Enough As a Starting Point.
As long as the library is smallish.
For example, you can add one liner to your proguard-con g.txt like:
-keep class akka.** { *; }
You'll want to revisit proguard-con g later on,
when your dex exceeds 64k methods.
MultiDex would also be an option.
when you release your app.
How to Con gure Proguard Properly.
Find and add classes which are used via re ection.
grep -r "classOf" . would be the easiest.
Check and add all classes which FQCN are listed in .conf le.
Add classes which occured NoClassDefFoundError or NoSuchMethodError at
runtime.
Proguard-Con g Will Look Like:
# Akka configuration
# Akka 2.3.16
## for akka.actor
### Classes used in reference.conf
#### akka.actor.provider
-keep class akka.actor.LocalActorRefProvider { *; }
#### akka.actor.guardian-supervisor-strategy
-keep class akka.actor.DefaultSupervisorStrategy { *; }
#### akka.actor.mailbox
-keep class akka.dispatch.UnboundedMailbox { *; }
-keep class akka.dispatch.BoundedMailbox { *; }
-keep class akka.dispatch.UnboundedDequeBasedMailbox { *; }
-keep class akka.dispatch.BoundedDequeBasedMailbox { *; }
#### akka.actor.mailbox.requirements
-keep class akka.dispatch.BoundedDequeBasedMessageQueueSemantics { *; }
-keep class akka.dispatch.UnboundedMessageQueueSemantics { *; }
-keep class akka.dispatch.UnboundedDequeBasedMessageQueueSemantics { *; }
-keep class akka.dispatch.DequeBasedMessageQueueSemantics { *; }
-keep class akka.dispatch.MultipleConsumerSemantics { *; }
#### akka.scheduler.implementation
-keep class akka.actor.LightArrayRevolverScheduler { *; }
Number of Methods and APK Size Comparison
In akka.actor and akka.io 2.3.16 (and Scala 2.11.11)
Proguard setting # of methods in
dex
APK
size
Keep-all-the-classes of Akka 35033 1132KB
15784 590KBKeep Akka classes only referenced by re ection
or conf
Disclaimer: This result is based on , and it may vary depending on how
many classes you use.
my sample
Will Android Support Java8?
Google has announced that Android current dex toolchain will support Java8.
Java 8 Language Features Support Update - Android Developers Blog
It's still uncertain if Android-Java8 support will work with Scala.
After Android Java8 Support Works
We might be able to enjoy:
Scala 2.12 or above
Smaller Scala standard lib jar.
Dotty(Scala 3.0) will introduce callgraph analysis from project,
that eliminates dead code. (no Proguard!)
Akka Streams (2.4 or above)
Great abstraction for ow graph, and handy back pressure management.
Akka Typed (2.5)
You can track Akka 2.5 release notes for exciting news about it.
Backo Supervisor (2.4 or above)
You can backport Backo Supervisor and ThreadLocalRandom for now.
Dotty-Linker
Memory Management
Android GC is Concurrent Mark & Sweep.
Watch out memory allocation & object creation.
WrappedArray#map or other higher functions box every primitive type
element.
works great.
Use ring bu ers for hotspots.
ByteString works well for concatenation or slicing.
Mutable objects within limited scope are your friend.
xuwei_k/nobox
Why not Kotlin?
🎉🎉🎉 for Android/Google o cial support!
Kotlin is great for Android, in terms of:
Smallish standard library jar.
Great IDE integration.
I still feel a big advantage in Scala lang functionality & ecosystem.
like Akka :)
Conclusion
Actor model works well in Android in stateful concurrent programming context.
Akka resiliency works great in error-prone situation, like an outdoor activities.
BONX Android app fully leverages Akka for its VoIP system.

More Related Content

What's hot

#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...Toshiaki Maki
 
Project bcool standards document
Project bcool standards documentProject bcool standards document
Project bcool standards documentRavi Tadwalkar
 
Autotools
Autotools Autotools
Autotools easychen
 
Groovy on Grails by Ziya Askerov
Groovy on Grails by Ziya AskerovGroovy on Grails by Ziya Askerov
Groovy on Grails by Ziya AskerovVuqar Suleymanov
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's Howmrdon
 
Profiling distributed Java applications
Profiling distributed Java applicationsProfiling distributed Java applications
Profiling distributed Java applicationsConstantine Slisenka
 
Java Stack Traces
Java Stack TracesJava Stack Traces
Java Stack Tracesdbanttari
 
Meet the Eclipse SmartHome powered Mars Rover
Meet the Eclipse SmartHome powered Mars RoverMeet the Eclipse SmartHome powered Mars Rover
Meet the Eclipse SmartHome powered Mars RoverMichael Vorburger
 
Performance Pack
Performance PackPerformance Pack
Performance Packday
 
Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3day
 
Flavors of Concurrency in Java
Flavors of Concurrency in JavaFlavors of Concurrency in Java
Flavors of Concurrency in JavaJavaDayUA
 
Lua on Steroids - EclipseCon NA 2012
Lua on Steroids - EclipseCon NA 2012Lua on Steroids - EclipseCon NA 2012
Lua on Steroids - EclipseCon NA 2012Benjamin Cabé
 
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of PythonControlling multiple VMs with the power of Python
Controlling multiple VMs with the power of PythonYurii Vasylenko
 
Introduction of CategoLJ2 #jjug_ccc
Introduction of CategoLJ2 #jjug_cccIntroduction of CategoLJ2 #jjug_ccc
Introduction of CategoLJ2 #jjug_cccToshiaki Maki
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725miguel dominguez
 

What's hot (20)

Just enough app server
Just enough app serverJust enough app server
Just enough app server
 
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
#jjug_ccc #ccc_gh5 What's new in Spring Framework 4.3 / Boot 1.4 + Pivotal's ...
 
Project bcool standards document
Project bcool standards documentProject bcool standards document
Project bcool standards document
 
Autotools
Autotools Autotools
Autotools
 
Groovy on Grails by Ziya Askerov
Groovy on Grails by Ziya AskerovGroovy on Grails by Ziya Askerov
Groovy on Grails by Ziya Askerov
 
C# tutorial
C# tutorialC# tutorial
C# tutorial
 
k8s-on-azure
 k8s-on-azure k8s-on-azure
k8s-on-azure
 
The Web on OSGi: Here's How
The Web on OSGi: Here's HowThe Web on OSGi: Here's How
The Web on OSGi: Here's How
 
Profiling distributed Java applications
Profiling distributed Java applicationsProfiling distributed Java applications
Profiling distributed Java applications
 
Java Stack Traces
Java Stack TracesJava Stack Traces
Java Stack Traces
 
Meet the Eclipse SmartHome powered Mars Rover
Meet the Eclipse SmartHome powered Mars RoverMeet the Eclipse SmartHome powered Mars Rover
Meet the Eclipse SmartHome powered Mars Rover
 
Performance Pack
Performance PackPerformance Pack
Performance Pack
 
Nashorn
NashornNashorn
Nashorn
 
Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3Scripting Yor Java Application with BSF3
Scripting Yor Java Application with BSF3
 
Flavors of Concurrency in Java
Flavors of Concurrency in JavaFlavors of Concurrency in Java
Flavors of Concurrency in Java
 
Lua on Steroids - EclipseCon NA 2012
Lua on Steroids - EclipseCon NA 2012Lua on Steroids - EclipseCon NA 2012
Lua on Steroids - EclipseCon NA 2012
 
Controlling multiple VMs with the power of Python
Controlling multiple VMs with the power of PythonControlling multiple VMs with the power of Python
Controlling multiple VMs with the power of Python
 
Introduction of CategoLJ2 #jjug_ccc
Introduction of CategoLJ2 #jjug_cccIntroduction of CategoLJ2 #jjug_ccc
Introduction of CategoLJ2 #jjug_ccc
 
GO-CFを試してみる
GO-CFを試してみるGO-CFを試してみる
GO-CFを試してみる
 
Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725Infrastructureascode slideshare-160331143725
Infrastructureascode slideshare-160331143725
 

Similar to Real World Android Akka

Introduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android ApplicationIntroduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android ApplicationKelwin Yang
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
 
ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」Satoshi Goto
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
Bring the Spark To Your Eyes
Bring the Spark To Your EyesBring the Spark To Your Eyes
Bring the Spark To Your EyesDemi Ben-Ari
 
React Native in Production
React Native in ProductionReact Native in Production
React Native in ProductionSeokjun Kim
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVAHome
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsErik Osterman
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
 
Scala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.jsScala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.jsKnoldus Inc.
 
JAVA introduction and basic understanding.pptx
JAVA  introduction and basic understanding.pptxJAVA  introduction and basic understanding.pptx
JAVA introduction and basic understanding.pptxprstsomnath22
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Christos Manios
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginersdivaskrgupta007
 

Similar to Real World Android Akka (20)

Scala at Netflix
Scala at NetflixScala at Netflix
Scala at Netflix
 
Introduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android ApplicationIntroduction to Dynamic Analysis of Android Application
Introduction to Dynamic Analysis of Android Application
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」ドワンゴでのScala活用事例「ニコニコandroid」
ドワンゴでのScala活用事例「ニコニコandroid」
 
Android develop guideline
Android develop guidelineAndroid develop guideline
Android develop guideline
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
Bring the Spark To Your Eyes
Bring the Spark To Your EyesBring the Spark To Your Eyes
Bring the Spark To Your Eyes
 
React Native in Production
React Native in ProductionReact Native in Production
React Native in Production
 
Java Basic PART I
Java Basic PART IJava Basic PART I
Java Basic PART I
 
Object Oriented Programming-JAVA
Object Oriented Programming-JAVAObject Oriented Programming-JAVA
Object Oriented Programming-JAVA
 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
 
Java se7 features
Java se7 featuresJava se7 features
Java se7 features
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
Play framework
Play frameworkPlay framework
Play framework
 
Scala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.jsScala's evolving ecosystem- Introduction to Scala.js
Scala's evolving ecosystem- Introduction to Scala.js
 
JAVA introduction and basic understanding.pptx
JAVA  introduction and basic understanding.pptxJAVA  introduction and basic understanding.pptx
JAVA introduction and basic understanding.pptx
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
 

More from Taisuke Oe

プレScalaMatsuri2019「スピーカー入門」
プレScalaMatsuri2019「スピーカー入門」プレScalaMatsuri2019「スピーカー入門」
プレScalaMatsuri2019「スピーカー入門」Taisuke Oe
 
How to start functional programming (in Scala): Day1
How to start functional programming (in Scala): Day1How to start functional programming (in Scala): Day1
How to start functional programming (in Scala): Day1Taisuke Oe
 
Monix Taskが便利だという話
Monix Taskが便利だという話Monix Taskが便利だという話
Monix Taskが便利だという話Taisuke Oe
 
How to get along with implicits
How to get along with implicits How to get along with implicits
How to get along with implicits Taisuke Oe
 
What Dotty fixes @ Scala関西サミット
What Dotty fixes @ Scala関西サミットWhat Dotty fixes @ Scala関西サミット
What Dotty fixes @ Scala関西サミットTaisuke Oe
 
Real World Android Akka - 日本語版
Real World Android Akka - 日本語版Real World Android Akka - 日本語版
Real World Android Akka - 日本語版Taisuke Oe
 
AuxパターンをDottyで解決する
AuxパターンをDottyで解決するAuxパターンをDottyで解決する
AuxパターンをDottyで解決するTaisuke Oe
 
Real world android akka
Real world android akkaReal world android akka
Real world android akkaTaisuke Oe
 
多相な関数の定義から学ぶ、型クラスデザインパターン
多相な関数の定義から学ぶ、型クラスデザインパターン多相な関数の定義から学ぶ、型クラスデザインパターン
多相な関数の定義から学ぶ、型クラスデザインパターンTaisuke Oe
 
Android BLEのつらみを予防するTips
Android BLEのつらみを予防するTipsAndroid BLEのつらみを予防するTips
Android BLEのつらみを予防するTipsTaisuke Oe
 
BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~
BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~
BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~Taisuke Oe
 

More from Taisuke Oe (11)

プレScalaMatsuri2019「スピーカー入門」
プレScalaMatsuri2019「スピーカー入門」プレScalaMatsuri2019「スピーカー入門」
プレScalaMatsuri2019「スピーカー入門」
 
How to start functional programming (in Scala): Day1
How to start functional programming (in Scala): Day1How to start functional programming (in Scala): Day1
How to start functional programming (in Scala): Day1
 
Monix Taskが便利だという話
Monix Taskが便利だという話Monix Taskが便利だという話
Monix Taskが便利だという話
 
How to get along with implicits
How to get along with implicits How to get along with implicits
How to get along with implicits
 
What Dotty fixes @ Scala関西サミット
What Dotty fixes @ Scala関西サミットWhat Dotty fixes @ Scala関西サミット
What Dotty fixes @ Scala関西サミット
 
Real World Android Akka - 日本語版
Real World Android Akka - 日本語版Real World Android Akka - 日本語版
Real World Android Akka - 日本語版
 
AuxパターンをDottyで解決する
AuxパターンをDottyで解決するAuxパターンをDottyで解決する
AuxパターンをDottyで解決する
 
Real world android akka
Real world android akkaReal world android akka
Real world android akka
 
多相な関数の定義から学ぶ、型クラスデザインパターン
多相な関数の定義から学ぶ、型クラスデザインパターン多相な関数の定義から学ぶ、型クラスデザインパターン
多相な関数の定義から学ぶ、型クラスデザインパターン
 
Android BLEのつらみを予防するTips
Android BLEのつらみを予防するTipsAndroid BLEのつらみを予防するTips
Android BLEのつらみを予防するTips
 
BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~
BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~
BONXを支える技術:Bluetooth編 ~Bluetoothを120%使い倒す方法~
 

Recently uploaded

ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 

Recently uploaded (20)

ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 

Real World Android Akka

  • 2. Who Am I? Taisuke Oe GitHub: / Twitter: My Work Technical Advisor in Septeni Original, Inc. Organizing taisukeoe @OE_uia BONX Android App ScalaMatsuri
  • 3. The largest international Scala Conference in Asia. 550-600 participants. Voting session for CFP. Travel support for highly voted speakers. Bi-directional professional translation services. 🍣🍻 Around March next year?
  • 4. This talk Is About: VoIP client VoIP stands for Voice Over Internet Protocol
  • 5. Agenda VoIP demo Real world example Why Android Akka? How come does Scala work in Android? Pros & Cons.
  • 8.
  • 9.
  • 10. What Is BONX ? Group talk system during outdoor activities Snowboarding Skiing Fishing Cycling ...
  • 11. BONX Architecture Apps VoIP client Android : Scala iOS : Objective C / Swift Servers API server : Ruby on Rails Voice server : golang Earpiece Special bluetooth headset
  • 13. Stateful Asynchronous Stream Processing System VoIP is. Upstream Recorder -> some DSP -> Encoder -> Socket Downstream Socket -> Decoder -> some DSP -> Player DSP stands for Digital Signal Processing Every component has its own state, which is typically thread UNsafe.
  • 14. BONX Must Be Resilient. In outdoor activities, we must handle a tons of errors: Poor network Out of range, and recover from it Hardware I/O errors Bluetooth disconnection If a component has a problem, it has to be recovered.
  • 15. Even Worse Errors might be discovered in a downstream of root-cause. Root cause has to be xed. Errors have to be propagated in reverse. Broken modules might produce broken audio data. Broken audio data might spoil user's experience. It has to be disposed from its queue.
  • 16. Summary: Two Requirements of BONX Stateful Concurrent Programming Resiliency
  • 17. That's Where Akka Comes In! Akka is a toolkit for concurrent programing, resiliency ... and distributed systems (out of scope).
  • 18. for (Stateful) Concurrent Programming Message driven actor model An actor encapsulates its state unless it exposes explicitly.
  • 19. Actor with a State Example class PlayActor() extends Actor { private val track: AudioTrack = createNewAudioTrack //state. Thread UN-safe override def preStart(): Unit = track.play() override def receive: Receive = { //An actor retrieves and process a message from its mailbox one-at-a-time. case AudioPacketMessage(content:ByteString) => track.write(content.toArray[Byte], 0, content.length) } override def postStop(): Unit = { track.stop() track.flush() track.release() } }
  • 20. Akka Makes A System Resilient Because Akka handles exceptions very well. Actor hierarchy Restart, Stop or Resume a child actor based on supervisorStrategy Note: Restart via supervisingStrategy keeps messages in it. Monitoring (Death watch) A watcher actor get a Terminated(actorRef) message once a watchee actor stops. Note: subsequent recreation of the actor disposes all messages in it.
  • 21. Sample Exception Handling by an Actor class ExceptionHandlingActor() extends Actor{ private var childActor:ActorRef = createChildActor override def supervisorStrategy: SupervisorStrategy = OneForOneStrategy(){ //Want to reset all mailboxes case _:BrokenAudioDataException => Stop //At default, child actors will be restarted with keeping their mailbox. case t => super.supervisorStrategy.decider.applyOrElse(t, (_:Any) => Escalate) } def receive = { //Stopped childActor will be recreated. case Terminated(ref) => if(childActor == ref) { context.unwatch(childActor) childActor = createChildActor } } private def createChildActor = { val c = context.child(ChildActor.props) context watch c c } }
  • 22. Recaps: How Akka Works Great? Stateful Concurrent Programming Actor state encapsulation / Processing a message one-at-a-time without an explicit lock. Resiliency Actor hierarchy or monitoring handles errors as you like. Akka solves VoIP problems (almost)!
  • 23. Why Do I Say "Almost" ? Some problems cannot be captured by exceptions. An audio driver might get silenced sometimes and doesn't respond to anything. There is no silver bullet. Ask a message and check if Ack will be returned within Timeout . If the Ask gets timeout, stop and re-create a new actor. Please rst consider if you can capture it as an expcetion. This heuristic approach is not often recommended.
  • 24. How Does Scala Work in Android?
  • 25. Build Toolchain scalac compiles Scala source codes into Java bytecodes dex in Android SDK translates Java bytecode into Dalvik Executable bytecodes is awesome. It is almost functionally compatible with android standard build system. It works great with other sbt-plugins. scala-android/sbt-android
  • 26. Android Device Specs Are Good Enough In this couple of years, agship Android devices have: 4 to 10 cores CPU 3 to 4 GB memories Up to around 512MB memory per VM can be used with largeHeap=true con guration.
  • 27. Q. Should You Use Scala in Android? This decision is up to you. Every technology has trade-o s.
  • 29. Pros Powerful language features, standard library and ecosystem. Concurrent programming Collection API Algebraic Data Type & Pattern Matching Traits Productive 0.5 ~ 1.2 ppl for DevOps and Tuning of BONX Android App for two years. Smaller context-switch cost between client codes and server codes.
  • 30. Another Android Scala Usecase? Stateless (except Views) concurrent programming view modi cation must run on UIThread in Android.
  • 31. Scala Offers Better APIs for Concurent Programming Scala standard Future works well. Use your own ExecutionContext for onComplete, andThen or else. UIExecutionContext pattern for UIThread callbacks.
  • 32. UIExecutionContext Pattern class UIExecutionContext(activity:Activity, reporter: Throwable => Unit) extends ExecutionContext{ def execute(runnable: Runnable): Unit = activity.runOnUiThread(runnable) def reportFailure(t: Throwable): Unit = reporter(t) } Future{ //some heavy calculation }.onComplete{ case Success(result) => //reflect your result on views case Failure(exp) => //show error message }(uiExecutionContext) //Explicitly!
  • 33. Other Android Scala Projects in Real World Septeni Original Comic app hits 6 million DLs! 47 Degrees also has an Akka modules. GANMA! 47deg/macroid 47deg/nine-cards-v2 47deg/scala-days-android pocorall/scaloid
  • 34. Cons Method 64k limit per a dex le. Scala standard library jar is too big to be a orded as it is. Proguard or MultiDex must be used. No Java8 support yet Android SDK toolchain still targets Java6+ environment. Akka version has to be 2.3.16, which is marked End-of-Life. You have to be careful for wasting memories. No o cial support by Google nor Lightbend (unlike Kotlin)
  • 35. Proguard Proguard removes unused classes, elds and methods. Unused means not programatically refereced. Proguard does NOT understand re ections. Akka uses re ection much via Props or .conf le. If Proguard is not con gured properly, then NoClassDefFoundError or NoSuchMethodError are occured at runtime. This is the most painful con guration to use Android Scala.
  • 36. Do You Need to Con gure Proguard from Scratch? No, absolutely. provides a default setting for Scala standard library jar. This covers akka.actor and akka.io at least. scala-android/sbt-android proguard-con g.txt for akka-actor v2.3.16
  • 37. For New Libraries How to Con gure Proguard for-Ease.
  • 38.
  • 39. It's Good Enough As a Starting Point. As long as the library is smallish. For example, you can add one liner to your proguard-con g.txt like: -keep class akka.** { *; } You'll want to revisit proguard-con g later on, when your dex exceeds 64k methods. MultiDex would also be an option. when you release your app.
  • 40. How to Con gure Proguard Properly. Find and add classes which are used via re ection. grep -r "classOf" . would be the easiest. Check and add all classes which FQCN are listed in .conf le. Add classes which occured NoClassDefFoundError or NoSuchMethodError at runtime.
  • 41. Proguard-Con g Will Look Like: # Akka configuration # Akka 2.3.16 ## for akka.actor ### Classes used in reference.conf #### akka.actor.provider -keep class akka.actor.LocalActorRefProvider { *; } #### akka.actor.guardian-supervisor-strategy -keep class akka.actor.DefaultSupervisorStrategy { *; } #### akka.actor.mailbox -keep class akka.dispatch.UnboundedMailbox { *; } -keep class akka.dispatch.BoundedMailbox { *; } -keep class akka.dispatch.UnboundedDequeBasedMailbox { *; } -keep class akka.dispatch.BoundedDequeBasedMailbox { *; } #### akka.actor.mailbox.requirements -keep class akka.dispatch.BoundedDequeBasedMessageQueueSemantics { *; } -keep class akka.dispatch.UnboundedMessageQueueSemantics { *; } -keep class akka.dispatch.UnboundedDequeBasedMessageQueueSemantics { *; } -keep class akka.dispatch.DequeBasedMessageQueueSemantics { *; } -keep class akka.dispatch.MultipleConsumerSemantics { *; } #### akka.scheduler.implementation -keep class akka.actor.LightArrayRevolverScheduler { *; }
  • 42. Number of Methods and APK Size Comparison In akka.actor and akka.io 2.3.16 (and Scala 2.11.11) Proguard setting # of methods in dex APK size Keep-all-the-classes of Akka 35033 1132KB 15784 590KBKeep Akka classes only referenced by re ection or conf Disclaimer: This result is based on , and it may vary depending on how many classes you use. my sample
  • 43. Will Android Support Java8? Google has announced that Android current dex toolchain will support Java8. Java 8 Language Features Support Update - Android Developers Blog It's still uncertain if Android-Java8 support will work with Scala.
  • 44. After Android Java8 Support Works We might be able to enjoy: Scala 2.12 or above Smaller Scala standard lib jar. Dotty(Scala 3.0) will introduce callgraph analysis from project, that eliminates dead code. (no Proguard!) Akka Streams (2.4 or above) Great abstraction for ow graph, and handy back pressure management. Akka Typed (2.5) You can track Akka 2.5 release notes for exciting news about it. Backo Supervisor (2.4 or above) You can backport Backo Supervisor and ThreadLocalRandom for now. Dotty-Linker
  • 45. Memory Management Android GC is Concurrent Mark & Sweep. Watch out memory allocation & object creation. WrappedArray#map or other higher functions box every primitive type element. works great. Use ring bu ers for hotspots. ByteString works well for concatenation or slicing. Mutable objects within limited scope are your friend. xuwei_k/nobox
  • 46. Why not Kotlin? 🎉🎉🎉 for Android/Google o cial support! Kotlin is great for Android, in terms of: Smallish standard library jar. Great IDE integration. I still feel a big advantage in Scala lang functionality & ecosystem. like Akka :)
  • 47. Conclusion Actor model works well in Android in stateful concurrent programming context. Akka resiliency works great in error-prone situation, like an outdoor activities. BONX Android app fully leverages Akka for its VoIP system.