「Kindle Fire HD 8」の対応ファイルとインテントフィルター

「電子書籍」とひとことにいっても, 実は, ファイル形式やリーダー端末やアプリなど利用方法をさまざま.

Fire HD を買ってみたのですがそんな調査と使い方を少し探ってみようと.

いうても, Android 5.1 だろよ, とな.

インテントフィルター

デフォルトでインストールされている 電子書籍リーダーとしての Kindle アプリ.

AndroidManifest を見てみると以下抜粋.


...
<activity
    android:theme="@2131624707"
    android:label="@2131230864"
    android:icon="@2130839461"
    android:name="com.amazon.kindle.TabletStartActivity"
    android:launchMode="singleInstance"
    android:configChanges="orientation|screenLayout|screenSize">
    <meta-data
        android:name="restriction_filter"
        android:resource="@2131296307"/>

    <intent-filter>
        <action
            android:name="android.intent.action.MAIN"/>
        <category
            android:name="android.intent.category.LAUNCHER"/>
        <category
            android:name="android.intent.category.DEFAULT"/>
    </intent-filter>

    <intent-filter>
        <action
            android:name="android.intent.action.VIEW"/>
        <category
            android:name="android.intent.category.DEFAULT"/>
        <category
            android:name="android.intent.category.BROWSABLE"/>
        <data
            android:scheme="kindle"/>
    </intent-filter>

    <intent-filter>
        <action
            android:name="android.intent.action.VIEW"/>
        <category
            android:name="android.intent.category.DEFAULT"/>
        <category
            android:name="android.intent.category.BROWSABLE"/>
        <data
            android:mimeType="application/x-mobipocket-ebook"
            android:scheme="file"/>
    </intent-filter>

    <intent-filter>
        <action
            android:name="android.intent.action.VIEW"/>
        <category
            android:name="android.intent.category.DEFAULT"/>
        <category
            android:name="android.intent.category.BROWSABLE"/>
        <data
         android:mimeType="application/x-mobi8-ebook"
         android:scheme="file"/>
   </intent-filter>

   <intent-filter>
      <action
         android:name="android.intent.action.VIEW"/>
      <category
         android:name="android.intent.category.DEFAULT"/>
      <category
         android:name="android.intent.category.BROWSABLE"/>
      <data
         android:mimeType="application/pdf"
         android:scheme="file"/>
   </intent-filter>

   <intent-filter>
      <action
         android:name="android.intent.action.VIEW"/>
      <category
         android:name="android.intent.category.DEFAULT"/>
      <category
         android:name="android.intent.category.BROWSABLE"/>
      <data
         android:mimeType="application/pdf"
         android:scheme="content"/>
   </intent-filter>

   <intent-filter>
      <action
         android:name="android.intent.action.VIEW"/>
      <category
         android:name="android.intent.category.DEFAULT"/>
      <category
         android:name="android.intent.category.BROWSABLE"/>
      <data
         android:scheme="file"
         android:host="*"
         android:pathPattern=".*pdf"/>
   </intent-filter>

</activity>
...

レガシーなスタイルの file スキーマからしか mobi ファイルは読みません.
pdfファイルに関しては content スキーマから読むことができます.

よって, 外部ファイルに対して kindle アプリをリーダーとして使うためには以下のファイル形式と配置が必要になります.

- pdf ファイル
- デバイスローカルに配置した mobi ファイル

epub 形式は直接は開けません.

意外と使えないようですがさらに調べていきます.

(→ つづく)


【Bluetooth】遠隔操作で写真が撮れる39円ボタン

こんなのあるんですね.



BTで端末とペアリングすれば

ボタンが2つだけの仮想キーボードとして稼働します.


override fun dispatchKeyEvent(event: KeyEvent?): Boolean {
  println("$event")
  return super.dispatchKeyEvent(event)
}


I/System.out: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_VOLUME_UP, scanCode=115, metaState=0, flags=0x8, repeatCount=0, eventTime=205335386, downTime=205335386, deviceId=9, source=0x101 }
I/System.out: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_VOLUME_UP, scanCode=115, metaState=0, flags=0x8, repeatCount=0, eventTime=205335591, downTime=205335386, deviceId=9, source=0x101 }

I/System.out: KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x8, repeatCount=0, eventTime=205340874, downTime=205340874, deviceId=9, source=0x101 }
I/System.out: KeyEvent { action=ACTION_UP, keyCode=KEYCODE_ENTER, scanCode=28, metaState=0, flags=0x8, repeatCount=0, eventTime=205341051, downTime=205340874, deviceId=9, source=0x101 }

よって, 音量UPボタンとエンターボタンの2つの操作を数メートル離れたとこから操作できます.

一方, カメラアプリでは, 音量ボタンでシャッターを切ることができます.

そういうことで自撮りなどに楽しく利用できます.

ちなみに電池は「CR2032 3V」が入ってました.


10個 CR2032 ボタン電池 3v リチウムコイン電池

👉 Amazon Dash Button ってどうなってたっけ? hatena-bookmark


開発者が見ておくべき /r/androiddev にみるAndroid環境の王道

それなりに王道の本筋ではないかと思えますがどう思います?

/r/androiddev survey time! : androiddev

以下, 箇条書きに.

端末は Google Nexus シリーズ.

Root化やROMカスタマイズはしない.

Linux はラップトップで Ubuntu (Unity).

Windows はデスクトップで10.

Mac はラップトップで 10.12 Sierra.

主携帯は Android, タブレットは持っていない.

開発OS は OSX Intl Core i7, SSD, メモリ16G.

アプリにタブレット向けデザインは作成しない.

minSdkVersion は 16 (4.1.x).

アーキテクチャは MVP.

DIライブラリは Dagger 2.

Rx ライブラリは RxAndroid + RxJava2.

代替のフレームワークは Cordova.

データのシリアライズは Gson.

データ永続化は Realm.

ネットワーク処理は Retrofit.

画像読込みは Picasso.

Viewバインドは ButterKnife.

思ったより RxJava2 の躍進が早いなあと思いました.