Facebook 提供 Android 效能分級的函式庫

一樣是在 OSNews 上看到的,Facebook 提供了一套 Library,可以將 Android 裝置依照年份分類:「Facebook's simple trick for serving many different Android devices」,原始報導是「Facebook's simple trick for serving so many different Android devices」。

可以在 GitHub 上的「Device Year Class」看到如何使用的範例程式碼:

int year = YearClass.get(getApplicationContext());
if (year >= 2013) {
    // Do advanced animation
} else if (year > 2010) {
    // Do simple animation
} else {
    // Phone too slow, don't do any animations
}

寫起來感覺沒什麼節操,但很實用 XDDD

Leave a Reply

Your email address will not be published. Required fields are marked *