rounds tips & tricks
Embed Size (px)
TRANSCRIPT
Slide 1
The Rounds ProjectGrowing from thousands to millions Tips and tricks from the battlefield
What is Rounds?
What is Rounds?
Fun, eyecandy, social, viral, useful Thank you Product Team!
Scalable, fast, reliable, predictable backend Thank you Server Team!
Great Client sideThats us! The Rounds Android TeamYohay, Berry, Shay, Vadim and growing...
The Key for a Great App
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
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).
Support 24 languages
For common iOS & Android translations
Support 7130 devices
QA? Code Reviews In house test most popular devices Applause for testing all over the world TestFairy for usability videos
Support 7130 devices
Release:Start with 20% rolloutCrashlytics for amazing crash analyticsIncrease after a few days
Responsive UI ?
Used new Thread() every time Oh no! Dont 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
Use a ThreadPool!
Changed every call ofnew Thread(someRunable).start();
ToRoundsExecutor.get().execute(someRunable);
And the resultWith a few hours workAmazing improvement in performance!
public class RoundsExecutor {
private static ExecutorService sPool = Executors.newCachedThreadPool();
public static ExecutorService get() {return sPool;}private RoundsExecutor(){ }}
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
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
Managing Data
ModelView
Controller
Managing Data
ModelPersist LocallyNotify when changedServersUI Widgets
Activity orFragment
Fetch from Server
Managing Data
ModelPersist LocallyNotify when changedServersUI Widgets
Activity orFragment
Fetch from ServerPersist in Server
Managing Data
ModelPersist LocallyNotify when changedServersUI Widgets
Activity orFragment
Fetch from ServerGCM / XMPP PushPersist in Server
Managing Data
ModelPersist LocallyNotify when changedServersUI Widgets
Activity orFragment
Fetch from ServerGCM / XMPP PushPersist in Server
Persisting Data
SharedPreferences for simple dataSQLLite for more complicated dataUniversalImageLoader for images
We wanted an IntentService that wouldreschedule tasks that failed schedule tasks for laterstay alive until we asked it to stop
github.com/berryve/rounds-android-goodies
FlexibleIntentService
Any component can broadcast events using LocalBroadcastManager
Any component can declare events it is interested in and how to handle thempublic interface RoundsBroadcastListener {public String [] getInterests();public void handleRoundsEvent(String action, Bundle extras);}
Event Pipeline
We developed our handler mHandler = new RoundsEventHandler(context, roundsBroadcastListener)
Base classes that implement the listenerAnd use our handlerRoundsActivityBase RoundsFragmentBase
Event Pipeline
Start listening at onResume()mHandler.registerReceivers();
Stop listening at onPause()mHandler.unregisterReceivers();
github.com/berryve/rounds-android-goodies
Event Pipeline
Surprise & Delight
yeti_eyes.xml
etc
How to make a Yeti Blink
How to make a Yeti Blink
create an animation-list xml resourcethat references frame by frame eye images
Variate duration values To mimic live object Random can be better!
On the ImageView you want to animate:yetiEyes.setBackgroundResource(R.drawable.yeti_eyes)
How to make a Yeti Blink
To start the animation on yetiEyes ImageView
AnimationDrawable eyesAnimation = (AnimationDrawable)yetiEyes.getBackground();
eyesAnimation.start();
Summary
Make great product that people want to useKeep basic design principles in mindUse tools & services for crash free appAdd Fun Surprises & DelightsCant get it perfect the first timeKeep learning and improve as you go
Thank [email protected] | [email protected]