iHeartRadio สร้างโค้ดเบสที่สะอาดและมีประสิทธิภาพมากขึ้นด้วยคอมโพเนนต์สถาปัตยกรรมของ Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ

iHeartRadio ซึ่งมีสำนักงานใหญ่อยู่ในนิวยอร์กซิตี้ให้บริการ
เพลงแบบไม่จำกัดและสถานีวิทยุหลายพันสถานีในแอปเดียว โดยการดำเนินงานของบริษัท
ครอบคลุมถึงการออกอากาศทางวิทยุ ออนไลน์ อุปกรณ์เคลื่อนที่ ดิจิทัล และโซเชียลมีเดีย
คอนเสิร์ตและกิจกรรมแบบสด การเผยแพร่ต่อ บริการวิจัยเพลง และ
การเป็นตัวแทนสื่ออิสระ
ผู้ฟังทั่วโลกดาวน์โหลดแอปนี้ไปแล้วกว่าพันล้านครั้ง
นับตั้งแต่เปิดตัวในปี 2008 อย่างไรก็ตาม ในช่วงปลายปี 2017 ฐานโค้ดเริ่มเก่า
และพบว่าการจัดการโค้ดและการผสานรวมฟีเจอร์ใหม่ๆ เป็นเรื่องยาก
สิ่งที่พวกเขาทำ
iHeartRadio เลือกใช้
คอมโพเนนต์สถาปัตยกรรมของ Android เมื่อ
เริ่มอัปเกรดโค้ด ไลบรารีความคงทนของ Room ที่ตรงไปตรงมาและนำไปใช้งานได้ง่าย
ดึงดูดใจวิศวกรของ iHeartRadio ด้วย
ความสามารถในการจัดการสิ่งต่างๆ เช่น การค้นหาแบบอะซิงโครนัสและการรองรับ
RxJava ซึ่ง iHeartRadio ใช้กันอย่างแพร่หลายในโค้ด
นอกจากนี้ ยังใช้คอมโพเนนต์ที่รับรู้ถึงวงจร
ซึ่งจะดำเนินการเพื่อตอบสนองต่อการเปลี่ยนแปลงสถานะวงจรของคอมโพเนนต์อื่น วิศวกรของ iHeartRadio
พบว่าคอมโพเนนต์เหล่านี้มีประโยชน์อย่างมากในการลดการอ้างอิง
ที่แทรกลงในกิจกรรมและ Fragment นอกจากนี้ บริษัทยังได้สร้างต้นแบบโดยใช้ ViewModel
ซึ่งช่วยให้ข้อมูลยังคงอยู่ได้แม้จะมีการเปลี่ยนแปลงการกำหนดค่า เช่น การหมุนหน้าจอ
ผลลัพธ์
iHeartRadio พบว่าการย้ายข้อมูลไปยัง
Architecture Components
และใช้ไลบรารีเพื่อทดสอบว่าการผสานรวมทำงานได้ดีเพียงใดนั้นเป็นเรื่องง่าย
Room และคอมโพเนนต์อื่นๆ ต้องใช้โค้ดบอยเลอร์เพลตเพียงเล็กน้อย ซึ่งหมายความว่าโค้ดของแอป
สั้นลงอย่างมาก คอมโพเนนต์สถาปัตยกรรม
ยังช่วยลดปัญหาหน่วยความจำรั่วได้อีกด้วย นอกจากนี้ ข้อดีอีกอย่างคือ
นักพัฒนาซอฟต์แวร์ใหม่ที่เข้าร่วมทีมสามารถเริ่มใช้งานและเริ่มเขียนโค้ดได้อย่างรวดเร็ว
โดยรวมแล้ว การใช้คอมโพเนนต์สถาปัตยกรรมช่วยให้ iHeartRadio สร้างโค้ดเบสที่สะอาดและมีประสิทธิภาพมากขึ้น ซึ่งช่วยป้องกันข้อผิดพลาดได้
ซึ่งเป็นข่าวดีสำหรับทุกแอป โดยเฉพาะแอปที่นำเสนอ
เสียงดิจิทัลแบบครบวงจรแก่ผู้ชมทั่วโลก
เริ่มต้นใช้งาน
คอมโพเนนต์สถาปัตยกรรมของ Android เปิดให้นักพัฒนาแอปทุกคนใช้บริการได้ในส่วนของ Android Jetpack เริ่มต้นใช้งานคอมโพเนนต์สถาปัตยกรรมของ Android
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2018-05-03 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2018-05-03 UTC"],[],[],null,["# iHeartRadio creates a cleaner, leaner code base with Android Architecture Components\n\nNew York City-based [iHeartRadio](https://www.iheart.com/) provides\nunlimited music and thousands of radio stations, all in one app. The company's\noperations include radio broadcasting, online, mobile, digital and social media,\nlive concerts and events, syndication, music-research services, and\nindependent media representation.\n\nListeners around the world have downloaded the app over a billion times\nsince it launched in 2008. By late 2017, however, the codebase was aging,\nand managing the code and integrating new features proved to be difficult.\n\nWhat they did\n-------------\n\niHeartRadio chose\n[Android Architecture Components](/topic/libraries/architecture) as they\nbegan upgrading their code. The straightforward, easy-to-implement\n[Room](/topic/libraries/architecture/room) persistency library was\nattractive to their engineers for its\ncapabilities for handling such things as asynchronous queries and support for\nRxJava, which iHeartRadio uses extensively in their code.\n\nThey also adopted\n[lifecycle-aware components](/topic/libraries/architecture/lifecycle),\nwhich perform actions in response to a change in the\nlifecycle status of another component. The iHeartRadio\nengineers found these components very useful for shrinking dependencies\ninjected into activities and fragments. In addition, the company created\nprototypes using [ViewModel](/topic/libraries/architecture/viewmodel),\nwhich allows data to survive configuration changes, such as screen rotations.\n\nResults\n-------\n\niHeartRadio found it easy to migrate over to\n[Architecture Components](/jetpack/arch)\nand to use the libraries to test how well integration was working.\n[Room](/topic/libraries/architecture/room) and other components require\nthe use of very little boilerplate code, meaning that the app's code is\nnow significantly shorter. [Architecture Components](/jetpack/arch)\nalso resulted in fewer memory leaks. An additional benefit was that new\ndevelopers joining the team could quickly get ramped up and start coding.\n\nOverall, adopting [Architecture Components](/jetpack/arch) has helped\niHeartRadio to create a cleaner, leaner code base that helps them to prevent errors.\nThat's good news for any app, especially for one offering\nall-in-one digital audio to a worldwide audience.\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)."]]