# keep-live **Repository Path**: guanyingcao/keep-live ## Basic Information - **Project Name**: keep-live - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-05-24 - **Last Updated**: 2024-05-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 使用方式: #### Kotlin:在application的onCreate()方法中使用 ```kotlin //初始化保活服务 KeepLive.init(Intent(this, YourActivity::class.java).also { }) //每次服务创建是否检测start状态 KeepLive.isCheckStart = false //定义前台通知的样式 val foregroundNotification = ForegroundNotification( "保活Lib" + "正在运行中", "点击打开【保活Lib】", R.mipmap.ic_launcher ) //启动保活服务 KeepLive.startWork(this, foregroundNotification) ``` #### Java: ```java KeepLive.INSTANCE.init(new Intent(this, MainActivity.class)); KeepLive.INSTANCE.setCheckStart(false); KeepLive.INSTANCE.setUseSilenceMusice(true); ForegroundNotification foregroundNotification = new ForegroundNotification("测试", "描述", R.mipmap.ic_launcher, NotificationManager.IMPORTANCE_MAX); KeepLive.INSTANCE.startWork(this, foregroundNotification); ``` #### 示例,计步器。在MainActivity中