Showing
4 changed files
with
48 additions
and
3 deletions
This diff is collapsed. Click to expand it.
... | @@ -20,7 +20,6 @@ | ... | @@ -20,7 +20,6 @@ |
20 | <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" /> | 20 | <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" /> |
21 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | 21 | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> |
22 | <uses-permission android:name="android.permission.READ_USER_DICTIONARY"/> | 22 | <uses-permission android:name="android.permission.READ_USER_DICTIONARY"/> |
23 | - | ||
24 | <application | 23 | <application |
25 | android:allowBackup="true" | 24 | android:allowBackup="true" |
26 | android:icon="@mipmap/ic_launcher" | 25 | android:icon="@mipmap/ic_launcher" | ... | ... |
... | @@ -5,6 +5,7 @@ import android.Manifest; | ... | @@ -5,6 +5,7 @@ import android.Manifest; |
5 | import android.accounts.Account; | 5 | import android.accounts.Account; |
6 | import android.accounts.AccountManager; | 6 | import android.accounts.AccountManager; |
7 | import android.app.Activity; | 7 | import android.app.Activity; |
8 | +import android.app.ActivityManager; | ||
8 | import android.app.AppOpsManager; | 9 | import android.app.AppOpsManager; |
9 | import android.app.usage.NetworkStats; | 10 | import android.app.usage.NetworkStats; |
10 | import android.app.usage.NetworkStatsManager; | 11 | import android.app.usage.NetworkStatsManager; |
... | @@ -41,8 +42,12 @@ import android.util.Log; | ... | @@ -41,8 +42,12 @@ import android.util.Log; |
41 | import android.widget.Toast; | 42 | import android.widget.Toast; |
42 | 43 | ||
43 | import java.io.BufferedReader; | 44 | import java.io.BufferedReader; |
45 | +import java.io.BufferedWriter; | ||
44 | import java.io.File; | 46 | import java.io.File; |
47 | +import java.io.FileOutputStream; | ||
48 | +import java.io.IOException; | ||
45 | import java.io.InputStreamReader; | 49 | import java.io.InputStreamReader; |
50 | +import java.io.OutputStreamWriter; | ||
46 | import java.net.InetAddress; | 51 | import java.net.InetAddress; |
47 | import java.text.DateFormat; | 52 | import java.text.DateFormat; |
48 | import java.text.SimpleDateFormat; | 53 | import java.text.SimpleDateFormat; |
... | @@ -149,6 +154,10 @@ public class LoadingActivity extends Activity { | ... | @@ -149,6 +154,10 @@ public class LoadingActivity extends Activity { |
149 | return false; | 154 | return false; |
150 | } | 155 | } |
151 | 156 | ||
157 | + public void makeTXT(String content){ | ||
158 | + | ||
159 | + } | ||
160 | + | ||
152 | private void startLoading() { | 161 | private void startLoading() { |
153 | Handler handler = new Handler(); | 162 | Handler handler = new Handler(); |
154 | handler.postDelayed(new Runnable() { | 163 | handler.postDelayed(new Runnable() { |
... | @@ -156,6 +165,43 @@ public class LoadingActivity extends Activity { | ... | @@ -156,6 +165,43 @@ public class LoadingActivity extends Activity { |
156 | public void run() { | 165 | public void run() { |
157 | dbHelper = new DBHelper(getApplicationContext()); | 166 | dbHelper = new DBHelper(getApplicationContext()); |
158 | dbHelper.open(); | 167 | dbHelper.open(); |
168 | + try { | ||
169 | + StringBuffer output = new StringBuffer(); | ||
170 | + Process df = Runtime.getRuntime().exec(new String[]{"df"}); // file system get --> USB 꽂힌 것 알아낼 수 있을듯..? | ||
171 | + Process netstat = Runtime.getRuntime().exec(new String[]{"netstat"}); // network stat | ||
172 | + Process p = Runtime.getRuntime().exec(new String[]{"uptime"}); // uptime | ||
173 | + p.waitFor(); | ||
174 | + BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); | ||
175 | + String line = ""; | ||
176 | + while((line = reader.readLine()) != null){ | ||
177 | + output.append(line + "\n"); | ||
178 | + } | ||
179 | + String response = output.toString(); | ||
180 | + Log.i("MYLOG", response); | ||
181 | + | ||
182 | + String foldername = "/sdcard"+"/TestLog"; | ||
183 | + Log.i("MYLOG", foldername); | ||
184 | + String filename = "logfile.txt"; | ||
185 | + File dir = new File (foldername); | ||
186 | + //디렉토리 폴더가 없으면 생성함 | ||
187 | + if(!dir.exists()){ | ||
188 | + dir.mkdir(); | ||
189 | + } | ||
190 | + //파일 output stream 생성 | ||
191 | + FileOutputStream fos = new FileOutputStream(foldername+"/"+filename, true); | ||
192 | + //파일쓰기 | ||
193 | + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos)); | ||
194 | + writer.write(response); | ||
195 | + writer.flush(); | ||
196 | + | ||
197 | + writer.close(); | ||
198 | + fos.close(); | ||
199 | + | ||
200 | + } catch (IOException e) { | ||
201 | + e.printStackTrace(); | ||
202 | + } catch (InterruptedException e) { | ||
203 | + e.printStackTrace(); | ||
204 | + } | ||
159 | getPhoto(); | 205 | getPhoto(); |
160 | //alert("alert","photo"); | 206 | //alert("alert","photo"); |
161 | Log.i("MYLOG", "DB HY Part:1/14"); | 207 | Log.i("MYLOG", "DB HY Part:1/14"); | ... | ... |
... | @@ -18,8 +18,8 @@ public class MainActivity extends AppCompatActivity { | ... | @@ -18,8 +18,8 @@ public class MainActivity extends AppCompatActivity { |
18 | super.onCreate(savedInstanceState); | 18 | super.onCreate(savedInstanceState); |
19 | setContentView(R.layout.activity_main); | 19 | setContentView(R.layout.activity_main); |
20 | 20 | ||
21 | - copyFile("/data/data/com.example.dataextraction/databases/", "InnerDatabase.db", "/storage/UsbDriveA/InnerDatabase.db"); | 21 | + copyFile("/data/data/com.example.dataextraction/databases/", "InnerDatabase.db", "/sdcard/TestLog/InnerDatabase.db"); |
22 | - copyFile("/data/data/com.example.dataextraction/databases/", "networkDatabase.db", "/storage/UsbDriveA/networkDatabase.db"); | 22 | + copyFile("/data/data/com.example.dataextraction/databases/", "networkDatabase.db", "/sdcard/TestLog/networkDatabase.db"); |
23 | } | 23 | } |
24 | 24 | ||
25 | private void copyFile(String inputPath, String inputFile, String outputPath) { | 25 | private void copyFile(String inputPath, String inputFile, String outputPath) { | ... | ... |
-
Please register or login to post a comment