2019年8月9日金曜日

minSdkVersion 28

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.kankanla.pi28"
        minSdkVersion 28
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

compileSdkVersion 29

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.kankanla.pi292"
        minSdkVersion 29
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

2019年8月5日月曜日

DialogFragment 生命周期

DialogFragment  生命周期

 I/###  DialogF: onCreate 1
 I/###  DialogF: onGetLayoutInflater 2
 I/###  DialogF: onCreateDialog 3
 I/###  DialogF: onCreateView 4
 I/###  DialogF: onStart 5
 I/###  DialogF: onResume 6


 I/###  DialogF: onCancel 7
 I/###  DialogF: onPause 8
 I/###  DialogF: onStop 9
 I/###  DialogF: onDestroyView 10
 I/###  DialogF: onDestroy 11
 I/###  DialogF: onDetach 12



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");