A good SDK should have the characteristics of ease of use, stability, lightweight and flexibility. As an early entrant of the domestic third-party push market, Gepush has been committed to providing developers with efficient and stable push SDK.
After ten years of deep cultivation and innovation, individual push has consolidated its position in the industry. By The end of June 2019, the total number of SDK installed by Getui has exceeded 44 billion, the number of daily live independent devices has reached 430 million, and a series of star apps such as People’s Daily, Xinhua News Agency, Weibo, Hornet’s Nest and Kuwo Music have been successfully served. Behind the brilliant data is a powerful technical support.
In this article, we specially interviewed Jing Yu, a senior developer of Android, to talk about the key technology points of building a large SDK, taking the SDK of Push as an example.
The author of a push Android senior developer Jingyu
What is the connection between SDK development and APP development?
APP and SDK are closely related. APP is the main carrier of SDK, and SDK is an important tool for APP development. From the perspective of developers, SDK development and APP development belong to the top-level application development of Android, and there is no essential difference between them. Both aim to provide products for customers to use; But from a business point of view, APP is a product of TO C, and its users are the masses. However, SDK is the product of TO B, and the users are the majority of developers. The two have different operation modes.
What are the key points of SDK development?
The SDK has no UI interaction, and users will not be aware of the existence of the SDK when using the APP. However, as an important part of APP, the performance of SDK directly affects the performance of APP, and also indirectly affects the experience and feeling of users when using APP. To sum up the development experience of push SDK, we believe that the most important thing to pay attention to in SDK development is its stability.
As a third-party SDK, stability is the first factor. We need to ensure that the pushed SDK can run normally in different environments (APP, terminal devices, etc.). Compatibility with complex environments is key to stability. Reducing the use of non-SDK interfaces also helps improve stability.
In addition to stability, the following issues are important to building a good SDK.
03 SDK version adaptation and vendor compatibility?
The SDK supports Android and iOS. The following articles use Android as an example.
So far, Android has gone through several iterations since the first version was released in 2007, and Android Q is the latest version. The Android SDK supports Android 2.3 and above and runs on almost all existing Versions of Android on the market.
** 1) Version adaptation ** APP is mainly run on mobile phones, if the APP is to run on smart devices such as Pad and TV, it basically needs to be adapted separately, that is, the APP will debug the corresponding version according to its use environment. However, the operating environment of SDK is relatively complex, and we have no idea what kind of environment the SDK we develop will run in, which may be mobile phone, Pad, TV, vehicle device, or even refrigerator and other smart home devices. Android versions of these devices range from 2.3 to 10.0. We need to be as backward compatible as possible when developing the SDK. To this end, the Push SDK remains compatible with Android 2.3.
** A mature SDK is bound to ensure the normal operation of devices from different manufacturers, especially when the SDK involves the four major components of Android, the compatibility of manufacturers needs to be paid special attention to. Note whether it limits the broadcast use of fixed actions and the startup of fixed class names service. However, if the SDK development involves references to Android Framewrok, some features may be disabled. For example, the underlying implementation of AndFix relies on the architecture of the Art/Dalvik VIRTUAL machine, but most manufacturers will customize the virtual machine and modify the underlying ArtMethod structure. In this case, AndFix will not work on the device that has modified the virtual machine.
So try to avoid references to the Android Framework during SDK development. When using the four components of Android, twitter will require developers to provide customized Service, which only needs to inherit the default Service of twitter, so as to ensure the normal operation of SDK on different manufacturers.
What do you think of the widespread support for mixed development in SDKS?
Large front-end development is an inevitable trend, and new products are now prioritizing hybrid development to ensure that a single set of code can run on multiple terminals. Therefore, a mature SDK is necessary to accommodate different language frameworks. Currently, the SDK supports not only Android and iOS, but also hybrid development, such as Unity3D Cocos2DX React-Native Flutter Cordova Apicloud, etc. See push lab for details
Will the Android SDK use open source projects?
Can’t use. There are several considerations:
- Using open source projects increases package size;
- There is no guarantee that open source projects will support complex terminal environments; – The client’s APP may have used open source projects, which will lead to compilation failure;
06 How to adapt to overseas market environment?
Google Play is one of the long-term plans of Internet companies. Since the release of Android SDK Google Play version, it has actively adapted to the complex overseas environment, providing strong support and guarantee for the stable delivery of overseas App messages. In order to have a better user experience, the PUSH SDK has also arranged computer rooms in many places abroad to ensure the arrival rate of push. In addition, the push SDK also needs to adapt various rules of Google Play, as well as take into account the adaptation of different models in different countries. This requires us to use phones produced by Google for debugging and testing as much as possible in the development process.
07 How does SDK reduce mobile phone power and flow consumption?
In order to provide a better user experience, we will try to reduce the battery and traffic consumption caused by the SDK as much as possible. To do this, we don’t use high-power tools like Bluetooth. In addition, we will use multi-link merging technology to save traffic.
In order to accurately understand the power consumption, flow reduction, we will also do a comprehensive test. Before each release, we will adopt strict test standards and use specific APP to measure the electricity pressure. In order to eliminate the interference of external factors as much as possible and ensure the accuracy of the test, we often use an APP integrated with a push SDK to measure. Common ways to measure apps are Batterystats & Bugreport and Battery Historian. For more details, see how powerprofile.java and power_profile.xml work.
08 How Do I Automatically Detect SDK Exceptions?
After nearly 10 years of optimization and upgrade, the abnormal situation of SDK pushed by Android has been controlled at a very, very low level. However, due to the serious fragmentation of Android market, various unexpected emergencies will inevitably occur when SDK runs in such a fragmented environment. For this reason, we specially developed SDK self-checking system. It’s like a lite version of Bugly. The internal product and SDK complement each other, and can independently detect the abnormal situation of SDK, and actively report the abnormal situation when found. Secondly, at the code level, we also made some prevention and control measures to prevent the SDK from being used normally due to abnormalities. In addition, we also set up a technical support team to serve the vast number of developers, regularly visit customers to help solve the problems encountered by customers.
Is there anything else you should pay attention to when developing the SDK?
We also need to pay attention to security during SDK development. Security not only represents the security of network data interaction and local data storage, but also involves SDK reinforcement, confusion and third-party security software audit. For example, the Android SDK provides interfacing of four components, and special care is taken within the SDK to avoid deserialization attacks on these components. In order to make developers feel more assured to use our SDK, our company has established a strict internal security management mechanism to ensure the security of SDK.
What advice do YOU have for SDK developers?
In fact, SDK development has never been interrupted since the birth of Android APP. SDK developers work in much the same way as APP developers, but developing the SDK focuses more on understanding the Java language and the underlying Android. If you want to be engaged in Android SDK development, it is recommended to study the relevant knowledge of Java, in-depth understanding of the Android Framework layer.
It is not difficult to develop an SDK, but how to make the SDK run stably in a complex environment. This requires a clear understanding of the ARCHITECTURE of the SDK and some serious thinking about the issues mentioned above.
Over the years, Individual Push SDK has always taken serving developers as its own responsibility, and continues to provide users with high-quality experience. In order to further enhance the ability to keep alive of the push the background, a push published 2.13.3.0 version, and has carried on the adaptation to the Android Q, please to push the document center to download http://docs.getui.com/download.html, immediate experience.