「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 形式は直接は開けません.

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

(→ つづく)


「Google Play Protect」を実際に確認するまでの道のり

Google、新セキュリティサービス「Google Playプロテクト」の提供開始 - iPhone Mania

Android標準の包括的なセキュリティーサービス「Google Play プロテクト」が提供開始!特に操作することなく、自動でウイルスなどをスキャンして削除などの対策をしてくれる - S-MAX

- 2017年7月19日より提供開始
- Google Play サービス 11 以降が必要
- ストア以外のアプリも対象として24時間自動的にスキャンする

今まではどれを使ったらいいのか, 有料版を購入すべきかなど悩んでいた「ウィルススキャンアプリ」ももう不要となるのでしょうか.

まずは, Play サービスのバージョンを確認しておきます.

ややこしいのがスキャン結果の確認方法がいくつかあったりします.

端末の Google Play ストア アプリ を開きます。
メニュー アイコン Menu icon > Play プロテクト アイコン をタップします。

Android – Google Play プロテクト

この位置には「play プロテクトアイコン」がみつかりませんでした.

なので別の方法で.

設定の「Google」→「セキュリティ」内に「Google Play Protect」(日本語環境なら「Google Play プロテクト」)という項目ができます(機種によっては「アプリの確認」などと名称が違うとのこと)。

Android 7.x(開発コード名:Nougat)以降のGalaxyシリーズでは「設定」→「Google」→「セキュリティ」から

Android標準の包括的なセキュリティーサービス「Google Play プロテクト」が提供開始!特に操作することなく、自動でウイルスなどをスキャンして削除などの対策をしてくれる

設定アイコン選択後から適当に進もうとすると迷います.

やっとありました.

アプリを100個くらいいれていましたが現状は問題ないようでした.

追記 2017-09-12: Playストアで表示されるようになっている!

現在 バージョン 8.1.73 で左メニューから簡単に利用できるようになってます.

一度, インストールしている全アプリを更新してみたらいいかもしれませんっ.

→ Android 8.0 Oreo「Picture in Picture」を実際に確認する


ターミナルで Github Contributions Calendar を見る

Github でどんだけ貢献しているか見る草.

Viewing contributions on your profile - User Documentation

みなさんもきっとこれをコマンドラインを使ってターミナルなどで見たくないと思います.

そこで, ふと, 思い出したフレーズ.

ここまで見てきたように、Rxを入れたからといってすべてのクリックイベントをObservableにすべきかというとそうではなく、状況に応じてListenerとObserverとPub-subを使い分けるのが良いです。ここに書いたパターンがすべてではありません。どういう場面で何を使うべきかはユースケースに依存するので、Jakeが言うようにたくさんコードを書くしかないとのことです。

Rxのビューバインディングのパターン - Qiita

どんだけ書いているか見てみましょう.

JakeWharton (Jake Wharton)

複数のプロジェクトで結構書いてます.

PHPで.


<?php

define('USER_NAME',         'JakeWharton');
define('URL_CONTRIBUTIONS', 'https://github.com/users/%s/contributions');
define('REGEX_PARSE',       '|data-count="(.*)" data-date="(.*)"/>|U');

date_default_timezone_set('Asia/Tokyo');

$svg = file_get_contents(sprintf(URL_CONTRIBUTIONS, USER_NAME));
preg_match_all(REGEX_PARSE, $svg, $matches);

if (count($matches[1]) !== count($matches[2])) {
    echo 'not match two size!!';
    exit;
}

$data = array_combine($matches[2], $matches[1]);

//var_dump($data);

foreach ($data as $date => $count) {
    echo sprintf('%s % 2s %s',
                 date('Y-m-d D', strtotime($date)),
                 $count,
                 str_repeat('*', $count));
    echo "\n";
}

グリッドなグラフでみたほうが全然見やすいですね.