Android Studio エミュレータのネットワーク設定

最近は使えるのかな,とひさびさにエミュレータ...

はい,DNSエラー.

エミュレータ内にて.


generic_x86:/ $ ifconfig
lo        Link encap:UNSPEC
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope: Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:310 TX bytes:310

eth0      Link encap:UNSPEC    Driver virtio_net
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe12:3456/64 Scope: Link
          inet6 addr: fec0::5054:ff:fe12:3456/64 Scope: Site
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3506 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3523 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:270699 TX bytes:274244


generic_x86:/ $ getprop
...
[net.bt.name]: [Android]
[net.eth0.dns1]: [10.0.2.3]
[net.eth0.gw]: [10.0.2.2]
[net.gprs.local-ip]: [10.0.2.15]
[net.qtaguid_enabled]: [1]
[net.tcp.default_init_rwnd]: [60]
...

仮想ネットワークは正しく構築できているようですが.

Set Up Android Emulator Networking | Android Studio

結局これ,パソコン上のDNSに Google Public DNS アドレスを追記で繋がるようになります.

Firewall などはONのままでよいです.

DNSとして設定されたルータのローカルアドレスをうまくエミュレータ側で認識/変換できないのだろうと思われます.

ちなみに,接続成功時のパソコン内にて以下.

~$ cat /var/run/resolv.conf
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
search flets-east.jp iptvf.jp
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4

~ $ cat /etc/resolv.conf
#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
search flets-east.jp iptvf.jp
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4

Run Apps on the Android Emulator | Android Studio

エミュレータ内にて setprop -> restart network で接続できたとしても毎回いちいち面倒です.

戻ろう、Genymotion に。
→ Genymotion 無料版 を入れる 2018


WEBプッシュ通知ダイアログ をでないようにする

最近のインターネットはおせっかいなことばかり提案してきますよね!

ほんとこれ.

毎回これがでる度に、私はイラッとするんですよ。

突然表示される「Webプッシュ」は早急に滅んで欲しい - Hagex-day info

無視したいですよね!

 

対応方法

Chrome の場合ですが.

「設定」 から 「詳細設定」 をクリックして,

さらに 「コンテンツの設定」 をクリックしてからの,

さらに 「通知」 をクリックして,

そこのスイッチをOFFにする.

または, 以下リンクからダイレクトに.
(無理ならコピペ)

chrome://settings/content/notifications

これででなくなります.

通知ダイアログが出ないだけでなく

プッシュも 「ブロック」 しているのでしょう.

しかし, 設定OFFにするのもめんどくせーわっ!

設定の該当部分も見つけづらいわっ!

ふけーわ!

How to Disable Web Push Notifications in Google Chrome


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

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

(→ つづく)