As an SDK developer, you have to worry about much more than just shipping new features. You have to be able to ship these features with the least amount of resources possible. Your SDK is just a part of your user’s app, and it has to play along with many other SDKs that are also integrated into the app. If your SDK starts to affect the app negatively or consume a disproportionate amount of resources, your users will look to replace it with any of the other similar parts available to them. In this post, we will take a look at what you need to do to make sure your SDK doesn’t affect your host app.
The size of an app is often inversely proportional to app downloads. The bigger the size of an app, the less likely users are going to download it, especially if the app is expected to handle non-demanding tasks. This makes the size of your SDK a huge deciding factor for developers when they are choosing the SDKs they will be using in their app.
You have to be highly conscious of the size of your SDK. Use the minimum number of dependencies possible and always choose compressed or optimized formats to minimize the size of your SDK.
App launch time is one of the most important metrics tracked by mobile app developers to measure their app performance. Apps that take too long to launch are frustrating for users and risk being uninstalled and this is not a risk most mobile developers are ready to take.
Any SDK that noticeably increases launch time risks being replaced by a more performance-conscious competitor. Make sure you don’t have any long-running operations in the main thread to initialize your SDK to avoid significantly bumping up launch time.
A snappy launch is useless if all other app activities are slow. As much as mobile developers care about their app launch time, they also want to make sure their app provides a seamless experience.
If your SDK has a considerable effect on the performance of the app’s main activities, it will swiftly be cut from your user’s stack. Make sure you always run your operations in the background unless it’s a UI activity.
Whether you are carrying them out in the background or the UI, operations use processor power and drain the battery. While it might seem to you that you are not going overboard, consider that the average Android app uses 18 SDKs.
With all these SDKs running their operations in tandem with the app’s main operations, it adds up quickly and translates to sizeable resource consumption. And now, it is easier than ever for developers to find out exactly what makes their app power-hungry.
You have to be mindful of your resource consumption and keep it to a minimum. Network calls, for instance, can cause a significant drain to the battery if not properly managed and kept to a minimum. Also, tools like encryption are great but you have to choose your encryption method wisely and be sure to use it only when it is actually needed.
Always keep in mind that your SDK is secondary to the app that is using it. If your SDK holds up a lot of memory, it can seriously affect the performance of your user’s app.
This goes beyond avoiding memory leaks —which are a fatal sin for mobile SDKs— and should be about being as efficient as possible with your memory usage. You should always hold as little memory as possible for as little time as you need.
Don’t interfere with your user’s app
This sounds obvious, but it can be easy to accidentally change the app’s behavior if you don’t put that into careful consideration for your SDK design. If your SDK has any UI elements, you must make sure that their placement and design do not interfere with the user experience.
UI aside, you must also be mindful of things like the back stack and how your SDK’s activities should behave in it. You should also make sure that all your resources have a prefix in their names to avoid conflicting with the app and make them easier to identify for your users.
Don’t crash your user’s app
While technically this belongs to the previous point, crashing your user’s app is the deadliest of sins for an SDK and merits it’s own point. Crashes are extremely disruptive to the user experience and your users are spending too much effort to manage their own code’s quality to worry about yours.
Your error-handling game must be on point and your SDK must be ready to handle any error no matter how unexpected. But it doesn’t stop with error-handling and you should practice other defensive programming techniques like input validation.
Wrapping it up
Your SDK must complement its host app and should never stand in the way of its performance or user experience. By keeping all these things in mind while developing your SDK, you will make sure that you have a negligible effect on your user’s app. And if the time comes when your users decide to get rid of some SDKs to improve their performance, you will be safe.