Android Paging Library と Retrofit

例えば、このパターン、Network only。

ここでは、PositionalDataSource を拡張するが、他のタイプのDataSource拡張でも同じ。

compositeDisposable のように viewModelScope をはるばる持ってきたにもかかわらず、


class RemoteDataSource(
  private val coroutineScope: CoroutineScope,
  private val service: RemoteService,
  private val s: String
) : PositionalDataSource<Item>() {

  @ExperimentalCoroutinesApi
  override fun loadInitial(params: LoadInitialParams, callback: LoadInitialCallback<Item>) {
    Timber.d("RemoteDataSource#loadInitial: ${Thread.currentThread().name}")
    ...

loadInitial() 内は、メインスレッドではなく、別スレッドで実行されている。


Timber.d("RemoteDataSource#loadInitial: ${Thread.currentThread().name}")


D/RemoteDataSource: RemoteDataSource#loadInitial: arch_disk_io_0
D/RemoteDataSource: RemoteDataSource#loadInitial: arch_disk_io_1
D/RemoteDataSource: RemoteDataSource#loadInitial: arch_disk_io_3

これらは、Android Architecture Component が作成した独自スレッド。

よって、同期なRetrofitの実行処理で良い、となる。

If I use enqueue with Retrofit 2.3 it will doesn't work but if i do a .execute() the LiveData is correctly triggered

Retrofit 2.3で、enqueue() を使用しても機能しませんが、execute() を実行するとLiveDataが正しくトリガーされます。

Android Paging Library LiveData> is triggered before the end of the api call

公式リファレンスにも記述はあるという。

To display data from a backend server, use the synchronous version of the Retrofit API to load information into your own custom DataSource object.

バックエンドサーバーからのデータを表示するには、同期バージョンのRetrofit APIを使用して、独自のカスタムDataSourceオブジェクトに情報をロードします。

Network only - Paging library overview

しかし、DiffUtilを使ったリフレッシュなアニメーションが実行されない。

「手間がかかる」でなく「沼にハマる」ことが最近は多くなった。

APIの仕様がおせっかいすぎやしないか。

しきいを下げようとして、余計に混乱させるばかり。

👉 あなたは Android Architecture Component をどう思いますか? 
👉 Fragment と Toolbar の歴史の話 - Qiita 


スマホ持ってる人10人いたらどのプラットフォーム/バージョンか?【国内】

日本国内の場合。

7人が iPhone
3人がAndroid

👉 Mobile Operating System Market Share Japan | StatCounter Global Stats 

5人 iOS12 2018年9月17日リリース
1人 iOS11 2017年9月20日
1人 iOS10 2016年9月8日
1人 Android 9 2018年8月6日
1人 Android 8 2017年8月21日
1人 Android 7 2016年8月22日

👉 Mobile & Tablet iOS Version Market Share Japan | StatCounter Global Stats 
👉 Mobile & Tablet Android Version Market Share Japan | StatCounter Global Stats 

こうしてみると明らかにAndroidはバージョンアップに失敗してるよな。

👉 iPhoneシェア率が異常!世界と逆をいく日本のスマホ市場【2019年3月】 


Android Q beta4 のOTAが来ない理由

リリースアナウンスからもう5日間くらい経ってるのに!

Today we’re releasing Beta 4 with the final Android Q APIs and official SDK -- the time is now to get your apps ready for the final release later in the summer!

You can get Beta 4 today on Pixel devices by enrolling here. If you're already enrolled and received the Beta 3 on your Pixel device, you'll automatically get the update to Beta 4. Partners participating in the Android Q Beta program will also be updating their devices to Beta 4 over the coming weeks.

👉 Android Developers Blog: Android Q Beta 4 and Final APIs! 

来ない。

どうやら、問題発生のためGoogleが配布を一旦停止してる模様。

Update 2 (6/6/19 @ 9:25 AM ET): Google has halted the Android Q Beta 4 OTA update due to bootlooping issues.

Update 2: OTA Halted
Numerous Pixel owners reported that their devices were bootlooping after installing the Android Q Beta 4 OTA update. It appeared to mostly affect Pixel 2 XL owners, but a few Pixel 3 owners also had the problem. A factory reset fixed things, but this is obviously a problem. Google has officially halted the OTA on all Pixel phones as they investigate the situation.

We’re aware of an issue with Android Q Beta 4 related to installing updates. We’ve temporarily paused Beta 4 OTA updates to all Pixel devices as we investigate the issue. We apologize for any inconvenience, and will provide an update once the issue is resolved.

👉 [Update: OTA halted] Android Q Beta 4 is here for the Google Pixel, API 29 publishing now available 

Update:
We're aware of an issue with Android Q Beta 4 related to installing updates. We've temporarily paused Beta 4 OTA updates to all Pixel devices as we investigate the issue. We apologize for any inconvenience, and will provide an update once the issue is resolved.

Note: this post was edited to reflect that Beta 4 updates have now been paused on all devices.

👉 Android Q Beta 4 now available! : android_beta 

ブート周りは不具合は、これまでもよくありました。

再開されるのは、いつなのか。

更新されたらレビューしたいと思います。

👉 Android Q Release Watcher 
👉 Android Q beta 4 update temporarily halted due to installation woes