Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
How to build Sdk? Best practices
-
Upload
vitali-pekelis -
Category
Environment
-
view
92 -
download
3
Transcript of How to build Sdk? Best practices
![Page 1: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/1.jpg)
SDK best practices
Rebecca Hamelsdorf13/9/2017
![Page 2: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/2.jpg)
Hi!!
![Page 3: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/3.jpg)
What is SDK
![Page 4: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/4.jpg)
What is SDK?
![Page 5: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/5.jpg)
what is SDK?
• SDK is a software development kit
• It’s a programing package that helps developers
to builds application for a specific platform.
• Typically it includes one or more API
![Page 6: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/6.jpg)
Why?
![Page 7: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/7.jpg)
Why do we need to develop an SDK?
Business need
![Page 8: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/8.jpg)
Why do we need to develop an SDK?
But not for business reasons..
![Page 9: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/9.jpg)
Why do we need to develop an SDK?
Business need
Internal use
![Page 10: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/10.jpg)
Internal use..
Code reuse
Abstraction/black box
![Page 11: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/11.jpg)
Why do we care about code reuse
● Saves time & money
![Page 12: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/12.jpg)
Why do we care about code reuse
● Saves time & money
● Easier to maintain and change
![Page 13: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/13.jpg)
Why do we care about code reuse
● Saves time & money
● Easier to maintain and change
● Solving bugs in a single place instead of bugs
all over the place
![Page 14: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/14.jpg)
Developing SDK check list
1. Define the service for your SDK users
2. Plan your public API
3. Plan your internal code architecture
4. Code:)
5. Sample app + docs
6. Packaging
7. Ship!
![Page 15: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/15.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 16: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/16.jpg)
Developing SDK check list
1. Define the service for your SDK users
2. Plan your public API
3. Plan your internal code architecture
4. Code:)
5. Sample app + docs
6. Packaging
7. Ship!
![Page 17: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/17.jpg)
Plan your public API…
Public API is the contract between the app developer and
SDK developer.
you’re officially an API designer!
![Page 18: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/18.jpg)
Plan your public API…
Put in your mind that the developer that integrate your sdk is
not sitting next to you..
![Page 19: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/19.jpg)
Plan your public API…
Keep it:
Easy to learn- design for “stupid” developers
![Page 20: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/20.jpg)
Plan your public API…
Keep it:
Easy to learn
Easy to use (even without docs!!), easy to integrate.
![Page 21: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/21.jpg)
Someone did it really easy..
![Page 22: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/22.jpg)
Plan your public API…
Keep it:
Easy to learn
Easy to use (even without docs!!), easy to integrate.
Hard to misused!
![Page 23: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/23.jpg)
Plan your public API…
Keep it:
Easy to learn
Easy to use (even without docs!!), easy to integrate.
Hard to misused!
Custom exceptions
![Page 24: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/24.jpg)
Custom Exception
class ServerURLException extends RuntimeException {
public ServerURLException(String message) {
super(message);
}
}
![Page 25: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/25.jpg)
Custom Exception
class ServerURLException extends RuntimeException {
public ServerURLException(String message) {
super(message);
}
}
static void isUrlValid(String serverURL) {
if( isNullOrEmpty(serverURL) || !isValidUrl(serverURL))
{
throw new ServerURLException(“Server URL is invalid or empty");
}
}
![Page 26: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/26.jpg)
Plan your public API…
Keep it:
Easy to learn
Easy to use (even without docs!!), easy to integrate.
Hard to misused!
Custom exceptions
No confusing constructors - use builder pattern, static
factory pattern etc.
![Page 27: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/27.jpg)
Builder pattern
public class User {
private final String firstName; //required
private final String lastName; //required
private final int age; //optional
private final String phone; //optional
private final String address; //optional
...
}
![Page 28: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/28.jpg)
Builder pattern
public User(String firstName, String lastName) {this(firstName, lastName, 0);}
public User(String firstName, String lastName, int age) {this(firstName, lastName, age, "");}
public User(String firstName, String lastName, int age, String phone) {
this(firstName, lastName, age, phone, "");}
public User(String firstName, String lastName, int age, String phone, String address) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.phone = phone;
this.address = address;
}
![Page 29: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/29.jpg)
Builder pattern
public class User {
private final String firstName; // required
private final String lastName; // required
private final int age; // optional
private final String phone; // optional
private final String address; // optional
private User(UserBuilder builder) {
this.firstName = builder.firstName;
this.lastName = builder.lastName;
this.age = builder.age;
this.phone = builder.phone;
this.address = builder.address;
}
public String getFirstName() {
return firstName;}
public String getLastName() {
return lastName;}
public int getAge() {
return age;}
public String getPhone() {
return phone; }
public String getAddress() {
return address; }
![Page 30: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/30.jpg)
Builder pattern
public class User {
private final String firstName; // required
private final String lastName; // required
private final int age; // optional
private final String phone; // optional
private final String address; // optional
private User(UserBuilder builder) {
this.firstName = builder.firstName;
this.lastName = builder.lastName;
this.age = builder.age;
this.phone = builder.phone;
this.address = builder.address;
}
public String getFirstName() {
return firstName;}
public String getLastName() {
return lastName;}
public int getAge() {
return age;}
public String getPhone() {
return phone; }
public String getAddress() {
return address; }
![Page 31: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/31.jpg)
Builder pattern
public static class UserBuilder {
private final String firstName;
private final String lastName;
private int age;
private String phone;
private String address;
public UserBuilder(String firstName,
String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public UserBuilder age(int age) {
this.age = age;
return this;}
public UserBuilder phone(String phone) {
this.phone = phone;
return this;}
public UserBuilder address(String address) {
this.address = address;
return this; }
public User build() {
return new User(this);
}}}
![Page 32: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/32.jpg)
Builder pattern
User.UserBuilder("Jhon", "Doe")
.age(30)
.phone("1234567")
.address("Fake address 1234")
.build();
![Page 33: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/33.jpg)
Plan your public API…
● Keep it:
Easy to learn
Easy to use (even without docs!!), easy to integrate.
Hard to misused!
Custom exceptions
No confusing constructors - use builder pattern, static
factory pattern etc.
Use enums, public static variables when you can.
![Page 34: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/34.jpg)
Plan your public API…
● We don’t choose the min sdk!
we want maximum compatibility
![Page 35: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/35.jpg)
Plan your public API…
● We don’t choose the min sdk!
we want maximum compatibility
● Try to use minimum permissions - it’s hard for the developer
to explain to THEIR users the need for permissions.
![Page 36: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/36.jpg)
Merged Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.academy.myapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
![Page 37: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/37.jpg)
Merged Manifest
https://developer.android.com/studio/build/manifest-merge.html
![Page 38: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/38.jpg)
Plan your public API…
● We don’t choose the min sdk!
we want maximum compatibility
● Try to use minimum permissions - it’s hard for the developer
to explain to THEIR users the need for permissions.
● Think carefully - we REALLY don’t want to change it very
often (if at all!) *adding is OK
![Page 39: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/39.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 40: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/40.jpg)
Developing SDK check list
1. Define the service for your SDK users
2. Plan your public API
3. Plan your internal code architecture
4. Code:)
5. Sample app + docs
6. Packaging
7. Ship!
![Page 41: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/41.jpg)
Plan your internal code architecture
● Exception handling - the more the merrier :)
![Page 42: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/42.jpg)
Plan your internal code architecture
● Exception handling - the more the merrier :)
● Use the minimum needed third-party libraries
a. we want to keep our SDK light
b. we avoid depending on others
![Page 43: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/43.jpg)
Plan your internal code architecture
● Exception handling - the more the merrier :)
● Use the minimum needed third-party libraries
a. we want to keep our SDK light
b. we avoid depending on others
● Handle missing permission cases, you are not promised
to have them
![Page 44: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/44.jpg)
Plan your internal code architecture
● Be very mindful to data consumption and battery usage!
![Page 45: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/45.jpg)
Plan your internal code architecture
● Be very mindful to data consumption and battery usage!
● Remember your support phase during development:
○ Deprecate - don’t kill!
○ Write logs but don’t spam, use 2 log levels (debug/production)
![Page 46: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/46.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 47: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/47.jpg)
Developing SDK check list
1. Define the service for your SDK users
2. Plan your public API
3. Plan your internal code architecture
4. Code:)
5. Sample app + docs
6. Packaging
7. Ship!
![Page 48: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/48.jpg)
Code..
● Remember resource are public by default - hide what
you need hidden.
![Page 49: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/49.jpg)
public.xml
<resources><public name="mylib_app_name" type="string"/><public name="mylib_public_string" type="string"/>
</resources>
![Page 50: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/50.jpg)
Code..
● Add unique prefix to resources - the developers may
have their own resources that can conflict with yours!
![Page 51: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/51.jpg)
Code..
● Add unique prefix to resources - the developers may
have their own resources that can conflict with yours!
● Test it on different Kind of apps..
![Page 52: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/52.jpg)
Code..
● Add unique prefix to resources - the developers may
have their own resources that can conflict with yours!
● Test it on different Kind of apps..
● you must take the life cycle of the app in consideration!
![Page 53: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/53.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 54: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/54.jpg)
Developing SDK check list
1. Define the service for your SDK users
2. Plan your public API
3. Plan your internal code architecture
4. Code:)
5. Sample app + docs
6. Packaging
7. Ship!
![Page 55: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/55.jpg)
Sample app +docs
Provide 2 kinds of docs:
Simple integration instructions + sample app
Api Overview
![Page 56: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/56.jpg)
Sample app +docs
● Provide 2 kinds of docs:
Simple integration instructions + sample app
Api Overview
• Remember Proguard docs
![Page 57: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/57.jpg)
proguard.config
-keep class javax.** { *; } -keep class org.** { *; } -keep class twitter4j.** { *; }
![Page 58: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/58.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 59: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/59.jpg)
Developing SDK check list
1. Define the service for your SDK users
2. Plan your public API
3. Plan your internal code architecture
4. Code:)
5. Sample app + docs
6. Packaging
7. Ship!
![Page 60: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/60.jpg)
Packaging
Once we had a jar..
![Page 61: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/61.jpg)
What can we do?
We have AAR!
![Page 62: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/62.jpg)
What does aar contain?
The file extension for an AAR file is .aar, actually the file itself is
a zip file containing the following mandatory entries:
/AndroidManifest.xml
/classes.jar
/res/
/R.txt
/public.txt
There are also optional entries :
/assets/
/libs/name.jar
/proguard.txt
/lint.jar
![Page 63: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/63.jpg)
Migrate from AAR to JAR ..
The file extension for an AAR file is .aar, actually the file itself is
a zip file containing the following mandatory entries:
/AndroidManifest.xml
/classes.jar
/res/
/R.txt
/public.txt
![Page 64: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/64.jpg)
step by step..
https://developer.android.com/studio/projects/android-library.html
![Page 65: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/65.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 66: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/66.jpg)
Developing SDK check list
❏ Define the service for your SDK users
❏ Plan your public API
❏ Plan your internal code architecture
❏ Code:)
❏ Sample app + docs
❏ Packaging
❏ Ship!
![Page 67: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/67.jpg)
Battery Historian
• Battery Historian is a tool to analyze battery consumers
and events(DOZE mode).
![Page 68: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/68.jpg)
Battery Historian
• Battery Historian is a tool to analyze battery consumers
and events(DOZE mode).
• It uses Android "bugreport" files
![Page 69: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/69.jpg)
Battery Historian
• Battery Historian is a tool to analyze battery consumers
and events(DOZE mode).
• It uses Android "bugreport" files
• Supports Lollipop (API level 21) and later.
![Page 70: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/70.jpg)
Battery Historian
• Battery Historian is a tool to analyze battery consumers
and events(DOZE mode).
• It uses Android "bugreport" files
• Supports Lollipop (API level 21) and later.
• Shows you where and how processes are drawing current
from the battery.
![Page 71: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/71.jpg)
![Page 72: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/72.jpg)
Battery Historian
• https://developer.android.com/studio/profile/battery-historian.html
• https://github.com/google/battery-historian
![Page 73: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/73.jpg)
Stetho
• Stetho is a very powerful tool for debugging.
• It enables developers have access to the Chrome
Developer Tools feature
http://facebook.github.io/stetho/
![Page 74: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/74.jpg)
Stetho
![Page 75: How to build Sdk? Best practices](https://reader034.fdocuments.us/reader034/viewer/2022051318/5aabd1b77f8b9aaf528b51ad/html5/thumbnails/75.jpg)
Questions?