2019年7月11日木曜日

Understand the Activity Lifecycle 生命周期




生命周期

package com.kankanla.m20190711m_recorder;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    private final String T = "###  MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.i(T, "1 onCreate");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onStart() {
        Log.i(T, "2 onStart");
        super.onStart();
    }

    @Override
    protected void onResume() {
        Log.i(T, "3 onResume");
        super.onResume();
    }

    @Override
    protected void onPostResume() {
        Log.i(T, "4 onPostResume");
        super.onPostResume();
    }

    @Override
    protected void onPause() {
        Log.i(T, "5 onPause");
        super.onPause();
    }

    @Override
    protected void onStop() {
        Log.i(T, "6 onStop");
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        Log.i(T, "7 onDestroy");
        super.onDestroy();
    }

    @Override
    protected void onRestart() {
        Log.i(T, "8 onRestart");
        super.onRestart();
    }
}





2019年7月7日日曜日

自動バックアップ

自動バックアップ
SharedPreferencesが再インストール時にリセットされない

bmgr
https://stuff.mit.edu/afs/sipb/project/android/docs/tools/help/bmgr.html

Auto Backup for Android codelab
https://codelabs.developers.google.com/codelabs/android-backup-codelab/#0

Data backup overview
https://developer.android.com/guide/topics/data/backup

<manifest
    <application
         android:allowBackup="true"

adb shell bmgr enabled
adb shell bmgr enable <true|false>
adb shell bmgr list transports
adb shell bmgr backupnow <PACKAGE>
adb shell bmgr backup <PACKAGE>
adb shell bmgr run

adb shell bmgr restore <TOKEN> <PACKAGE>










2019年7月5日金曜日

adb shell dumpsys jobscheduler

adb shell dumpsys jobscheduler


Active jobs:
  Slot #0: inactive since -9m38s404ms, stopped because: app called jobFinished
  Slot #1: inactive since -11m39s487ms, stopped because: cancel() called by app, callingUid=10049 uid=10049 jobId=43
  Slot #2: inactive since -11m39s594ms, stopped because: cancel() called by app, callingUid=10049 uid=10049 jobId=183
  Slot #3: inactive since -3h35m29s108ms, stopped because: last work dequeued
  Slot #4: inactive since -3h45m4s586ms, stopped because: last work dequeued
  Slot #5: inactive since -3h45m4s848ms, stopped because: app called jobFinished
  Slot #6: inactive
  Slot #7: inactive
  Slot #8: inactive
  Slot #9: inactive
  Slot #10: inactive
  Slot #11: inactive
  Slot #12: inactive
  Slot #13: inactive
  Slot #14: inactive
  Slot #15: inactive

mReadyToRock=true
mReportedActive=false
mMaxActiveJobs=6

PersistStats: FirstLoad: 78/11/9 LastSave: 67/6/4




2019年6月9日日曜日

AdRequest.addTestDevice


AdRequest.Builder builder = new AdRequest.Builder();
builder.addTestDevice("7026FA2EC1DC7E60FBEA02C64D33BD8B");
builder.addTestDevice("53185CF5BFA5B2121DF7FA86E7064C22");
builder.addTestDevice("78957C13BCC9AA1AC5D8462F2DEC083A");
builder.addTestDevice("C9517774AEB25C5D4B40D8175F152E03");

2019年6月6日木曜日

ADBコマンド導入の方法

ADBコマンド導入の方法

https://developer.android.com/studio/releases/platform-tools.html

platform-tools_r29.0.0-windows.zip
adb.exe
fastboot.exe

https://dl.google.com/android/repository/usb_driver_r11-windows.zip


http://adakoda.github.io/android-screen-monitor/
Android Screen Monitor




2019年6月4日火曜日

raspberrypi3 Apache2 PHP7 Sqlite3 curl vsftpd

raspberrypi3 Apache2 PHP7 Sqlite3 curl vsftpd

sudo apt-get install apache2
sudo apt-get install php
sudo apt-get install sqlite3
sudo apt-get install php-sqlite
sudo apt-get install php-curl
sudo apt-get install vsftpd

raspberrypi3 の省エネ設定
sudo tvservice --off
sudo ifconfig wlan0 down


2020/11/05
電圧の状態を調べる方法
 $ vcgencmd get_throttled

throttled 値 状態
0x0 正常
0x50000 過去に低電圧状態になったが、現在は正常
0x50005 現在低電圧状態にある。
0x80000 過去に熱によりクロックダウンした。
0x80008 現在熱によりクロックダウンしている。

コア電圧を確認
$ vcgencmd measure_volts
volt=1.2000V

CPUの温度
$ vcgencmd measure_temp
temp=42.9'C

CPUの動作周波数
$ vcgencmd measure_clock arm
frequency(45)=600000000

ファームウェアのバージョン
$ vcgencmd version
Aug 15 2019 12:06:42
Copyright (c) 2012 Broadcom
version 0e6daa5106dd4164474616408e0dc24f997ffcf3 (clean) (release) (start)

メモリの割り当て
$ vcgencmd get_mem arm
arm=948M
$ vcgencmd get_mem gpu
gpu=76M

https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md

end

2019年5月22日水曜日

在自定义的SurfaceView 上打开 DialogFragment

在自定义的SurfaceView 上打开 DialogFragment

myDialogFragment.show(((AppCompatActivity) getContext()).getSupportFragmentManager(), "text");



    @Override
    public boolean onTouchEvent(MotionEvent event) {
        boolean show = true;
        if (show) {
            AboutDialog aboutDialog = new AboutDialog(getContext());
            aboutDialog.show();
            Toast.makeText(getContext(), "xxxxxxxxxx", Toast.LENGTH_SHORT).show();
        } else {
            MyDialogFragment myDialogFragment = new MyDialogFragment();
            myDialogFragment.item("99");
            myDialogFragment.show(((AppCompatActivity) getContext()).getSupportFragmentManager(), "text");
        }
        return true;
    }