SystemService で常に実行されている。M Preview の Doze モードを実装するためのもの。
以下のイベントを監視する。
- Screen on/off
- Charging status
- Significant motion detect
| pip install mitmproxy |
| // This code snippet demonstrates how to serialize/deserialize a struct | |
| // who has one or more date fields to/from JSON. | |
| // | |
| // Though, this example implements both encoding.TextMarshaler and json.JSONMarshaler, | |
| // either is necessary to format/parse time.Time in JSON format. | |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" |
| #include "stdio.h" | |
| int unique_1(char* str) { | |
| int count[256] = {0}; | |
| int i = 0; | |
| while(1) { | |
| char c = str[i]; | |
| if (c == '\0') return 1; | |
| if (count[c] > 0) { | |
| return -1; |
| verifyCmd() { | |
| for cmd in ${@}; do | |
| if [ -z "$(which $cmd)" ]; then | |
| echo "$cmd not found in PATH: $PATH" | |
| return 1 | |
| fi | |
| done | |
| } | |
| : ${GOOGLE_BUCKET_ID?"Need to set GOOGLE_BUCKET_ID"} |
| apply plugin: 'com.android.application' | |
| android { | |
| compileSdkVersion 21 | |
| buildToolsVersion "21.1.1" | |
| defaultConfig { | |
| applicationId "com.hkurokawa.myapplication" | |
| minSdkVersion 14 | |
| targetSdkVersion 21 |
| /** | |
| * <p> | |
| * This loader caches the result so that it can be taken later - for example, after configuration | |
| * was changed and activity is re-created. | |
| * </p> | |
| * Created by hiroshi on 2014/12/03. | |
| */ | |
| public abstract class CachedAsyncTaskLoader<T> extends AsyncTaskLoader<T> { | |
| private T mCached; | |
| private Throwable mError; |
| package com.hkurokawa.myapplication; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| public class MainActivity extends AppCompatActivity { | |
| ViewGroup content; |
| package com.hkurokawa.myapplication; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| public class MainActivity extends AppCompatActivity { | |
| ViewGroup content; |
| package com.hkurokawa.sampleapplication; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import android.view.Menu; | |
| import android.view.MenuItem; | |
| import android.view.View; | |
| import android.widget.ArrayAdapter; | |
| import android.widget.ListView; |