16. Google
Play
Services
take advantage of the
latest, Google-
powered features
with automatic
platform updates
distributed as an APK
through the Google
Play store.
- Google+
- Google Account
- Google Action
- Google Sign
- Google Analytics
- Google Awareness
- Google Cast
- Google Cloud
- Google Drive
- Google Fit
- Google Location
- Google Maps
- Google Places
- Mobile Vision
- Google Nearby
- Google Panorama
- Google Play
- Android Pay
- Android Wear
...developer.android.com/topic/libraries/s
upport-library
18. Moshi
A modern JSON
library for Android
and Java.
MyObj item = new MyObj(...);
Moshi moshi =
new Moshi.Builder().build();
JsonAdapter<MyObj> adapter =
moshi.adapter(MyObj.class);
adapter.toJson(item);
adapter.fromJson(jsonStr);
github.com/square/moshi
19. OkHttp3
An HTTP & SPDY
client for Android and
Java applications
OkHttpClient client =
new OkHttpClient();
Request request =
new Request.Builder()
.url(url)
.build();
Response response =
client.newCall(request)
.execute();
return response.body().string();
square.github.io/okhttp
20. Retrofit
A type-safe HTTP
client for Android and
Java
public interface GitHub {
@GET("users/{user}/repos")
Call<List<Repo>> repos(
@Path("user") String user);
}
Retrofit retrofit =
new Retrofit.Builder()
.baseUrl("https://api.github.com")
.build();
GitHub service =
retrofit.create(GitHub.class);
Call<List<Repo>> repos =
service.repos("octocat");
square.github.io/retrofit
22. Room
Abstraction layer over
SQLite to allow fluent
database access
while harnessing the
full power of SQLite.
@Entity
public class User {
@PrimaryKey
private int uid;
@ColumnInfo(name = "first_name")
private String firstName;
}
@Dao
public interface UserDao {
@Insert
Void insertAll(User… users);
@Query("SELECT * FROM user
WHERE uid IN (:userIds)")
List<User> loadAllByIds(
int[] userIds);
}
developer.android.com/training/data-
storage/room/index.html
23. Object
Box
The easy object-
oriented database for
small devices
BoxStore boxStore =
MyObjectBox.builder()
.androidContext(...)
.build();
Box<Person> box =
boxStore.boxFor(Person.class);
Person person =
new Person("Joe", "Green");
// Create
long id = box.put(person);
// Read
Person person = box.get(id);
// Update
person.setLastName("Black");
box.put(person);
// Delete
box.remove(person);
github.com/objectbox/objectbox-java
25. Realm
A mobile database
that runs directly
inside phones, tablets
or wearables
github.com/realm/realm-java
class Dog extends RealmObject {
private String name;
}
Realm realm =
Realm.getDefaultInstance();
Dog dog = new Dog();
dog.setName("Rex");
realm.beginTransaction();
realm.copyToRealm(dog);
realm.commitTransaction();
Dog dog =
realm.where(Dog.class)
.equalTo("name", "Rex")
.findFirst();
42. Parceler
Android Parcelables
made easy through
code generation.
@Parcel
public class Example {
String name;
int age;
/* Constructors, getters, etc. */
}
Bundle bundle = new Bundle();
bundle.putParcelable(
"key",
Parcels.wrap(example));
Example example = Parcels.unwrap(
this.getIntent()
.getParcelableExtra("key"));
github.com/johncarl81/parceler
43. Icepick
Android library that
eliminates the
boilerplate of saving
and restoring
instance state.
// This will be automatically saved and
restored
@State String username;
@Override public void onCreate(Bundle state) {
...
Icepick.restoreInstanceState(this, state);
}
@Override public void
onSaveInstanceState(Bundle outState) {
...
Icepick.saveInstanceState(this, outState);
}
github.com/frankiesardo/icepick
44. Timber
A logger with a small,
extensible API which
provides utility on top
of Android's normal
Log class.
github.com/JakeWharton/timber
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.DEBUG)
Timber.plant(
new DebugTree());
else
Timber.plant(
new NotLoggingTree());
}
Timber.v("some verbose logs here");
45. Joda time
Joda-Time is the
widely used
replacement for the
Java date and time
classes.
DateTime datetime = ... ;
datetime.getMonthOfYear();
datetime.getDayOfMonth();
LocalDate fromDate = ... ;
LocalDate newYear =
fromDate.plusYears(1)
.withDayOfYear(1);
Days.daysBetween(fromDate, newYear);
dateOfBirth.monthOfYear()
.getAsText(Locale.ENGLISH);
github.com/JodaOrg/joda-time
46. ThreeTen
ABP
An adaptation of the
JSR-310 backport for
Android.
LocalDateTime ldt =
LocalDateTime.now();
int ld = ldt.getDayOfMonth();
int lm = ldt.getMonthValue();
int ly = ldt.getYear();
ldt.withYear(2000);
ldt.plusHours(2);
ldt = LocalDateTime
.of(2005, 3, 26, 12, 0, 0, 0);
ldt.plusDays(1);
ldt.plus(24,ChronoUnit.HOURS);
github.com/JakeWharton/ThreeTenAB
P
48. Event Bus
Event bus for Android
that simplifies
communication
between Activities,
Fragments, Threads,
etc.
greenrobot.org/eventbus/
public class Event {
public final String message;
...
}
EventBus.getDefault()
.register(this);
@Subscribe
public void onEvent(Event event) {
// Handle event
}
EventBus.getDefault()
.post(new Event(...));
52. Firebase
Job
Dispatcher
A library for
scheduling
background jobs in
your Android app. It
provides a
JobScheduler-
compatible API.
github.com/firebase/firebase-
jobdispatcher-android
Job myJob =
dispatcher.newJobBuilder()
.setService(MyJobService.class)
.setTag("my-unique-tag")
.setRecurring(false)
.setLifetime(UNTIL_NEXT_BOOT)
.setReplaceCurrent(false)
.setConstraints(
ON_UNMETERED_NETWORK,
DEVICE_CHARGING
)
.setExtras(extrasBundle)
.build();
dispatcher.mustSchedule(myJob);
53. Dagger2
A fast dependency
injector for Android
and Java
github.com/google/dagger/
class CoffeeMaker {
@Inject Heater heater;
}
@Module
class DripCoffeeModule {
@Provides Heater
provideHeater() {
return new ElectricHeater();
}
}
ObjectGraph.create(
new DripCoffeeModule());
54. RxJava
&
RxAndroid
A library for
composing
asynchronous and
event-based
programs using
observable
sequences
github.com/ReactiveX/RxJava
github.com/ReactiveX/RxAndroid
Observable.just(items)
.subscribeOn(
Schedulers.newThread())
.observeOn(
AndroidSchedulers
.mainThread())
.subscribe(/* an Observer */);
58. Memory
Profiler
Helps you identify
memory leaks and
memory churn that
can lead to stutter,
freezes, and even
app crashes.
https://developer.android.com/studio/pr
ofile/memory-profiler.html
59. CPU
Profiler
Inspect your app’s
CPU usage and
thread activity in
real-time, and
record method
traces.
developer.android.com/studio/profile/cp
u-profiler.html
60. Network
Profiler
displays real time
network activity on
a timeline, showing
data sent and
received, as well as
the current number
of connections.
developer.android.com/studio/profile/n
etwork-profiler.html
69. Android
library
statistics
Insights on what Ad
Networks, Social
SDKs and
developer tools are
present in Android
apps and what their
market shares are.
www.appbrain.com/stats/librarie