91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 4KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-11
  • 語(yǔ)言: Java
  • 標(biāo)簽: Android??后臺(tái)錄像??

資源簡(jiǎn)介

Android 后臺(tái)Service 實(shí)現(xiàn)錄像,無(wú)頁(yè)面

資源截圖

代碼片段和文件信息

package?com.uiot.smarthome.server;/**


import?android.app.Notification;
import?android.app.Service;
import?android.content.Context;
import?android.content.Intent;
import?android.graphics.PixelFormat;
import?android.hardware.Camera;
import?android.media.CamcorderProfile;
import?android.media.MediaRecorder;
import?android.os.Environment;
import?android.os.IBinder;
import?android.support.annotation.Nullable;
import?android.text.format.DateFormat;
import?android.view.Gravity;
import?android.view.SurfaceHolder;
import?android.view.SurfaceView;
import?android.view.WindowManager;

import?java.util.Date;

/**
?*?@描述?(測(cè)試程序可實(shí)現(xiàn)后臺(tái)錄像)

?*?@date?2016/8/15?0015?8:28?
?*/
public?class?BackgroundVideoRecorder?extends?Service?implements?SurfaceHolder.Callback?{

????private?WindowManager?windowManager;
????private?SurfaceView?surfaceView;
????private?Camera?camera?=?null;
????private?MediaRecorder?mediaRecorder?=?null;

????@Override
????public?void?onCreate()?{

????????//?Start?foreground?service?to?avoid?unexpected?kill
????????Notification?notification?=?new?Notification.Builder(this)
????????????????.setContenttitle(“Background?Video?Recorder“)
????????????????.setContentText(““)
????????????????.setSmallIcon(R.drawable.button_selector)
????????????????.build();
????????startForeground(1234?notification);

????????//?Create?new?SurfaceView?set?its?size?to?1x1?move?it?to?the?top?left?corner?and?set?this?service?as?a?callback
????????windowManager?=?(WindowManager)?this.getSystemService(Context.WINDOW_SERVICE);
????????surfaceView?=?new?SurfaceView(this);
????????WindowManager.LayoutParams?layoutParams?=?new?WindowManager.LayoutParams(
????????????????1?1
????????????????WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY
????????????????WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
????????????????PixelFormat.TRANSLUCENT
????????);

//全屏顯示在最上圖層上
//????????final?WindowManager.LayoutParams?layoutParams?=?new?WindowManager.LayoutParams(
//????????????????WindowManager.LayoutParams.WRAP_CONTENT
//????????????????WindowManager.LayoutParams.W

評(píng)論

共有 條評(píng)論