Hike Messenger 借助 Android 架构组件提高了速度和简洁性
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。

Hike 创立于 2012 年,其打造的产品旨在简化互联网服务流程,以使印度用户能够轻松上网。Hike 将聊天、通讯、Feed 和集成功能与第三方交通和付费应用融于一体。
他们在不同的时间点火速开发了这些功能,从而导致该公司面临所谓的“巨大的技术和架构负担”。这样的负担成了稳定性、可维护性和性能方面的瓶颈,因此该公司希望快速简化其代码。
策略
Hike 采用了 Android 架构组件,这些组件已成为“Hike 应对所有这些挑战的万能方法。”Hike 首席技术官 Vishwanath Ramarao 说道。他们开始使用 ViewModel(可保证数据不受屏幕旋转等配置更改的影响)、LiveData(一种可观察的数据存储器类)和 Room(一种持久性库)。
“我们开发的是一款新型响应式应用,而 Room 和 LiveData 可与我们的前瞻性设计原则完美契合。”Ramarao 补充道。
Hike 还在评估 Paging 库,采用该库更便于应用视需要从数据源逐渐加载信息,而不会使设备重载或在执行大量数据库查询时等待很长时间。
“我们对架构组件有了基本的了解,并且希望进行深入探索。”Ramarao 说,“但通过原本对 Android 生态系统最佳做法的探索,我们找到了缓解技术和架构负担的重要工具。最终,它变成了我们在架构和开发做法方面跟上潮流的利器”。
成果
借助 Android 架构组件,Hike 显著减少了其应用中的总代码行数,同时还使这些代码更易于读取和维护。此外,Android 架构组件还帮助他们将用户评分中不涉及崩溃问题的比例提高到了 99% 以上,这在过去是难以实现的。
开始使用
Android 架构组件作为 Android Jetpack 的一部分向所有开发者开放。开始使用 Android 架构组件。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2018-05-03。
[null,null,["最后更新时间 (UTC):2018-05-03。"],[],[],null,["# Hike Messenger gains speed and simplicity with Android Architecture Components\n\nLaunched in 2012, Hike is building products with the aim of simplifying the\ninternet to bring India online. Hike combines chat, messaging, feeds,\nand integrations with third-party transportation and payment apps.\nIt developed these features very rapidly and at different points in\ntime, resulting in what the company called \"significant technical and\narchitectural debt.\" Because this debt was becoming a bottleneck to\nstability, maintainability and performance, the company wanted to simplify\nits code quickly.\n\nWhat they did\n-------------\n\nHike turned to [Android Architecture Components](/jetpack/arch), which\nbecame \"our Swiss army knife to tackle all of these challenges\" says\nCTO Vishwanath Ramarao. It began using\n[ViewModel](/topic/libraries/architecture/viewmodel), which allows data to\nsurvive configuration changes (such as screen rotations);\n[LiveData](/topic/libraries/architecture/livedata), an\nobservable data-holder class; and the\n[Room](/topic/libraries/architecture/room) persistence library.\n\"We're a modern, reactive app, and Room and LiveData fit really\nwell with our forward-design principles\" Ramarao adds.\n\nHike is also evaluating the [Paging Library](/topic/libraries/paging),\nwhich makes it easier for an app gradually to load information as needed from a\ndata source, without overloading the device or waiting too long for a big\ndatabase query.\n\u003e \"We were aware of Architecture Components in general and wanted to learn more\"\n\u003e Ramarao says. \"But what started as an exploration of the Android-ecosystem\n\u003e best practices became an important tool to tackle our technical and\n\u003e architectural debt. It ultimately became a way of modernizing our\n\u003e architecture and development practice\".\n\nResults\n-------\n\nThanks to Architecture Components, Hike significantly reduced the total\nlines of code in their app, while also making that code more readable\nand maintainable. Android Architecture Components also helped them to\nraise their crash-free user ratings to well beyond 99 percent,\nsomething they'd struggled to accomplish in the past.\n\nGet started\n-----------\n\nAndroid Architecture Components is open to all developers as part of\n[Android Jetpack](/jetpack). [Get\nstarted with Android Architecture Components](/jetpack/arch)."]]