File tree 4 files changed +61
-0
lines changed
java/com/hd/screen/capture/service
4 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 23
23
</activity >
24
24
<activity android : name =" .CaptureConfigActivity" >
25
25
</activity >
26
+ <activity android : name =" .service.ServiceCaptureActivity" />
27
+
28
+ <service android : name =" .service.ScreenCaptureService" />
26
29
</application >
27
30
28
31
</manifest >
Original file line number Diff line number Diff line change
1
+ package com .hd .screen .capture .service ;
2
+
3
+ import android .app .Service ;
4
+ import android .content .Intent ;
5
+ import android .os .Handler ;
6
+ import android .os .IBinder ;
7
+ import android .support .annotation .Nullable ;
8
+
9
+
10
+ /**
11
+ * Created by hd on 2018/7/21 .
12
+ * 演示通过service 来实现调用录制
13
+ */
14
+ public class ScreenCaptureService extends Service {
15
+
16
+ @ Override
17
+ public void onCreate () {
18
+ super .onCreate ();
19
+
20
+ new Handler ().postDelayed (() -> {
21
+ Intent i = new Intent (this ,ServiceCaptureActivity .class );
22
+ i .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
23
+ startActivity (i );
24
+ }, 3000 );
25
+ }
26
+
27
+ @ Nullable
28
+ @ Override
29
+ public IBinder onBind (Intent intent ) {
30
+ return null ;
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ package com .hd .screen .capture .service ;
2
+
3
+ import android .graphics .drawable .ColorDrawable ;
4
+ import android .os .Bundle ;
5
+ import android .support .annotation .Nullable ;
6
+ import android .support .v7 .app .AppCompatActivity ;
7
+ import android .view .Window ;
8
+
9
+
10
+ /**
11
+ * Created by hd on 2018/7/21 .
12
+ * {@link com.hd.screen.capture.MainActivity}
13
+ */
14
+ public class ServiceCaptureActivity extends AppCompatActivity {
15
+
16
+ @ Override
17
+ protected void onCreate (@ Nullable Bundle savedInstanceState ) {
18
+ super .onCreate (savedInstanceState );
19
+ //设置透明
20
+ requestWindowFeature (Window .FEATURE_NO_TITLE );
21
+ getWindow ().setBackgroundDrawable (new ColorDrawable (android .graphics .Color .TRANSPARENT ));
22
+ getWindow ().setDimAmount (0f );
23
+ }
24
+
25
+ // ... start or stop
26
+ }
You can’t perform that action at this time.
0 commit comments