4. •Fun, eyecandy, social, viral, useful
Thank you Product Team!
•Scalable, fast, reliable, predictable backend
Thank you Server Team!
•Great Client side
That’s us! The Rounds Android Team
Yohay, Berry, Shay, Vadim and growing...
The Key for a Great App
5. •Supporting as many devices,
OS versions and languages as possible
•Robust, Crash-free app
•Responsive UI, using latest guidelines
•Surprise & Delight the user
Great Client Side
6. Android 4.03 and above
Only about 8% of users use
Froyo, Gingerbread & below
so...
we only support 4.03 and above
(release quicker, use newer features).
10. Responsive UI ?
•Used new Thread() every time
Oh no! Don’t do that!!
•Used synchronized on UI thread
Argh! Blocked it and got nasty ANRs!
•Fetched again the same info from server
Users had to wait…
11. Use a ThreadPool!
•Changed every call of
new Thread(someRunable).start();
•To
RoundsExecutor.get().execute(someRunable);
•And the result
With a few hours work
Amazing improvement in performance!
12. public class RoundsExecutor {
private static ExecutorService sPool =
Executors.newCachedThreadPool();
public static ExecutorService get() {
return sPool;
}
private RoundsExecutor(){ }
}
13. •synchronized, do you really need it?
avoid it completely on UI thread
if yes…
code review anyway
•pay attention where you are running.
if it is a callback then…
who is calling?
Parallel Threads Beware
14. IntentService
•Creates a single background thread
•Will process only one task at a time
•Send the service an intent with what to do
Use LocalBroadcastManager
to broadcast event with result
Use a BroadcastReceiver
to handle result on UI thread
21. We wanted an IntentService that would
•reschedule tasks that failed
•schedule tasks for later
•stay alive until we asked it to stop
github.com/rounds/rounds-android-goodies
FlexibleIntentService
22. •Any component can broadcast events
using LocalBroadcastManager
•Any component can declare events
it is interested in and how to handle them
public interface RoundsBroadcastListener {
public String [] getInterests();
public void handleRoundsEvent(String
action, Bundle extras);
}
Event Pipeline
23. We developed our handler
mHandler =
new RoundsEventHandler(context,
roundsBroadcastListener)
Base classes that implement the listener
And use our handler
RoundsActivityBase
RoundsFragmentBase
Event Pipeline
24. Start listening at onResume()
mHandler.registerReceivers();
Stop listening at onPause()
mHandler.unregisterReceivers();
github.com/rounds/rounds-android-goodies
Event Pipeline
27. How to make a Yeti Blink
•Create an animation-list xml resource
that lists frame by frame images
•To mimic a live object use
Random duration values
•On the ImageView you want to animate:
yetiEyes.setBackgroundResource(
R.drawable.yeti_eyes)
28. How to make a Yeti Blink
Animate yetiEyes ImageView with
AnimationDrawable yetiEyesAnimation =
(AnimationDrawable) yetiEyes.getBackground();
yetiEyesAnimation.start();
29.
30. Summary
•Make great product that people want to use
•Keep basic design principles in mind
•Use tools & services for crash free app
•Add Fun Surprises & Delights
•Can’t get it perfect the first time
•Keep learning and improve as you go