/
FakeService.java
56 lines (46 loc) · 1.12 KB
/
FakeService.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package org.xkit.android.demo.service;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.text.format.Time;
import android.util.Log;
public class FakeService extends Service {
private static final String LOG_TAG = "FakeService";
private FakeBinder mBinder = new FakeBinder();
@Override
public IBinder onBind(Intent intent) {
Log.e(LOG_TAG, "start IBinder~~~");
return mBinder;
}
@Override
public void onCreate() {
Log.e(LOG_TAG, "start onCreate~~~");
super.onCreate();
}
@Override
public void onStart(Intent intent, int startId) {
Log.e(LOG_TAG, "start onStart~~~");
super.onStart(intent, startId);
}
@Override
public void onDestroy() {
Log.e(LOG_TAG, "start onDestroy~~~");
super.onDestroy();
}
@Override
public boolean onUnbind(Intent intent) {
Log.e(LOG_TAG, "start onUnbind~~~");
return super.onUnbind(intent);
}
public String getSystemTime() {
Time t = new Time();
t.setToNow();
return t.toString();
}
public class FakeBinder extends Binder {
FakeService getService() {
return FakeService.this;
}
}
}