Commit d2c7416d authored by wanglei's avatar wanglei

...

parent a8524ab6
Pipeline #1366 canceled with stages
# swiftcleanerphonehelper # swiftcleanerphonehelper
## 1.FCM (firebase 推送服务) ## 1.FCM (firebase 推送服务)
# 2.常驻通知栏
需要权限
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
在applicant里面启动
\ No newline at end of file
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.READ_NOTIFICATIONS" /> <uses-permission android:name="android.permission.READ_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<queries> <queries>
<intent> <intent>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
...@@ -108,8 +110,6 @@ ...@@ -108,8 +110,6 @@
android:value="2.4" /> android:value="2.4" />
<!-- 广告的appId每次打包正式需要改 --> <!-- 广告的appId每次打包正式需要改 -->
<meta-data <meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID" android:name="com.google.android.gms.ads.APPLICATION_ID"
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
//import com.tool.zxdemo.admob.com.zxdemo.admob.AdmobHelper //import com.tool.zxdemo.admob.com.zxdemo.admob.AdmobHelper
//import com.tool.zxdemo.databinding.ActivityMainBinding //import com.tool.zxdemo.databinding.ActivityMainBinding
//import com.tool.zxdemo.http.com.zxdemo.http.ZxHttp //import com.tool.zxdemo.http.com.zxdemo.http.ZxHttp
//import com.tool.zxdemo.service.PermanentNotifyService //import com.tool.zxdemo.service.com.zxdemo.service.PermanentNotifyService
//import com.tool.zxdemo.service.PermanentNotifyService.Companion.startOmgNotification //import com.tool.zxdemo.service.com.zxdemo.service.PermanentNotifyService.Companion.startOmgNotification
//import com.tool.zxdemo.utils.com.zxdemo.utils.GlobalTimer //import com.tool.zxdemo.utils.com.zxdemo.utils.GlobalTimer
//import com.tool.zxdemo.utils.com.zxdemo.utils.SpUtils //import com.tool.zxdemo.utils.com.zxdemo.utils.SpUtils
//import java.util.Random //import java.util.Random
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
// if (isChecked) { // if (isChecked) {
// startOmgNotification() // startOmgNotification()
// } else { // } else {
// val serviceIntent = Intent(this, PermanentNotifyService::class.java) // val serviceIntent = Intent(this, com.zxdemo.service.PermanentNotifyService::class.java)
// stopService(serviceIntent) // stopService(serviceIntent)
// } // }
// com.zxdemo.utils.SpUtils.getInstance().putBoolean("sNotify", isChecked) // com.zxdemo.utils.SpUtils.getInstance().putBoolean("sNotify", isChecked)
......
package com.tool.zxdemo package com.zxdemo
import android.app.Activity import android.app.Activity
import android.app.Application import android.app.Application
...@@ -15,6 +15,7 @@ import com.reyun.solar.engine.SolarEngineManager ...@@ -15,6 +15,7 @@ import com.reyun.solar.engine.SolarEngineManager
import com.zxdemo.receiver.AppInstallReceiver import com.zxdemo.receiver.AppInstallReceiver
import com.zxdemo.receiver.BatteryStatusReceiver import com.zxdemo.receiver.BatteryStatusReceiver
import com.zxdemo.receiver.UnlockReceiver import com.zxdemo.receiver.UnlockReceiver
import com.zxdemo.service.PermanentNotifyService.Companion.startOmgNotification
import com.zxdemo.utils.ActivityCollector import com.zxdemo.utils.ActivityCollector
import com.zxdemo.utils.DeviceUtils import com.zxdemo.utils.DeviceUtils
import com.zxdemo.utils.FcmUtils import com.zxdemo.utils.FcmUtils
...@@ -52,6 +53,9 @@ class ZxApplication : Application() { ...@@ -52,6 +53,9 @@ class ZxApplication : Application() {
isScreenOn = powerManager.isInteractive isScreenOn = powerManager.isInteractive
InstallRefeerUtils.init() InstallRefeerUtils.init()
startOmgNotification()
} }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
......
...@@ -14,7 +14,7 @@ import com.google.android.gms.ads.rewarded.RewardedAd ...@@ -14,7 +14,7 @@ import com.google.android.gms.ads.rewarded.RewardedAd
import com.google.firebase.analytics.FirebaseAnalytics import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase import com.google.firebase.ktx.Firebase
import com.tool.zxdemo.ZxApplication import com.zxdemo.ZxApplication
import com.zxdemo.http.ZxHttp import com.zxdemo.http.ZxHttp
import org.json.JSONObject import org.json.JSONObject
......
package com.zxdemo.http package com.zxdemo.http
import android.util.Log import android.util.Log
import com.swiftcleaner.chovey.BuildConfig import com.swiftcleaner.chovey.BuildConfig
import com.tool.zxdemo.ZxApplication import com.zxdemo.ZxApplication
import com.zxdemo.utils.AESUtils import com.zxdemo.utils.AESUtils
import com.zxdemo.utils.DeviceUtils import com.zxdemo.utils.DeviceUtils
import com.zxdemo.utils.HttpUtils import com.zxdemo.utils.HttpUtils
...@@ -34,8 +34,8 @@ object ZxHttp { ...@@ -34,8 +34,8 @@ object ZxHttp {
urlstr.append("&aid=${DeviceUtils.getUID()}") urlstr.append("&aid=${DeviceUtils.getUID()}")
urlstr.append("&mode=2") urlstr.append("&mode=2")
// var url="https://api.swiftdevinc.xyz/ccspk?pkg=${ZxApplication.packname}&referrer=$referrer" // var url="https://api.swiftdevinc.xyz/ccspk?pkg=${com.zxdemo.ZxApplication.packname}&referrer=$referrer"
// var url = "https://feedapihk.zhangxinhulian.com/ccspk?pkg=${ZxApplication.packname}&mode=2" // var url = "https://feedapihk.zhangxinhulian.com/ccspk?pkg=${com.zxdemo.ZxApplication.packname}&mode=2"
HttpUtils.get( HttpUtils.get(
urlstr.toString(), urlstr.toString(),
object : object :
...@@ -74,7 +74,7 @@ object ZxHttp { ...@@ -74,7 +74,7 @@ object ZxHttp {
fun getBlacklist(requestBack: (Int) -> Unit) { fun getBlacklist(requestBack: (Int) -> Unit) {
var jsonParms = DeviceUtils.getConfigParms() var jsonParms = DeviceUtils.getConfigParms()
// val url = "https://api.swiftdevinc.xyz?pkg=${ZxApplication.packname}" // val url = "https://api.swiftdevinc.xyz?pkg=${com.zxdemo.ZxApplication.packname}"
val url = "$INTERFACE_DOMAIN/jsoncl?pkg=${ZxApplication.packname}" val url = "$INTERFACE_DOMAIN/jsoncl?pkg=${ZxApplication.packname}"
var json = JSONObject() var json = JSONObject()
json.put("bp", jsonParms) json.put("bp", jsonParms)
...@@ -116,7 +116,7 @@ object ZxHttp { ...@@ -116,7 +116,7 @@ object ZxHttp {
fun getHttpReportInterface(action: String, value: String, ext: JSONObject?) { fun getHttpReportInterface(action: String, value: String, ext: JSONObject?) {
var bp = DeviceUtils.getConfigParms() var bp = DeviceUtils.getConfigParms()
// val url = "https://rp.swiftdevinc.xyz/jsonsp?pkg=${ZxApplication.packname}" // val url = "https://rp.swiftdevinc.xyz/jsonsp?pkg=${com.zxdemo.ZxApplication.packname}"
val url = "$REPORT_DOMAIN/jsonsp?pkg=${ZxApplication.packname}" val url = "$REPORT_DOMAIN/jsonsp?pkg=${ZxApplication.packname}"
var json = JSONObject() var json = JSONObject()
json.put("bp", bp) json.put("bp", bp)
......
...@@ -17,10 +17,10 @@ import androidx.core.app.NotificationManagerCompat ...@@ -17,10 +17,10 @@ import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.swiftcleaner.chovey.R import com.swiftcleaner.chovey.R
import com.swiftcleaner.chovey.view.MainActivity import com.swiftcleaner.chovey.view.MainActivity
import com.tool.zxdemo.ZxApplication
import com.tool.zxdemo.ZxApplication.Companion.isAppInForeground import com.tool.zxdemo.ZxApplication.Companion.isAppInForeground
import com.tool.zxdemo.ZxApplication.Companion.isDeviceLocked import com.tool.zxdemo.ZxApplication.Companion.isDeviceLocked
import com.tool.zxdemo.ZxApplication.Companion.isScreenOn import com.tool.zxdemo.ZxApplication.Companion.isScreenOn
import com.zxdemo.ZxApplication
import com.zxdemo.http.ZxHttp import com.zxdemo.http.ZxHttp
import com.zxdemo.utils.SpUtils import com.zxdemo.utils.SpUtils
import java.util.Random import java.util.Random
......
...@@ -6,8 +6,8 @@ import android.content.IntentFilter ...@@ -6,8 +6,8 @@ import android.content.IntentFilter
import android.os.Build import android.os.Build
import android.util.Log import android.util.Log
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import com.tool.zxdemo.ZxApplication
import com.tool.zxdemo.notity.NotificationUtils import com.tool.zxdemo.notity.NotificationUtils
import com.zxdemo.ZxApplication
import com.zxdemo.utils.SpUtils import com.zxdemo.utils.SpUtils
import java.time.LocalDateTime import java.time.LocalDateTime
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
......
...@@ -2,8 +2,8 @@ package com.zxdemo.service ...@@ -2,8 +2,8 @@ package com.zxdemo.service
import android.util.Log import android.util.Log
import com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage import com.google.firebase.messaging.RemoteMessage
import com.tool.zxdemo.ZxApplication
import com.tool.zxdemo.notity.NotificationUtils import com.tool.zxdemo.notity.NotificationUtils
import com.zxdemo.ZxApplication
import com.zxdemo.http.ZxHttp import com.zxdemo.http.ZxHttp
class FcmService : FirebaseMessagingService() { class FcmService : FirebaseMessagingService() {
......
package com.tool.zxdemo.service package com.zxdemo.service
import android.annotation.SuppressLint
import android.app.Notification import android.app.Notification
import android.app.NotificationChannel import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
...@@ -8,7 +9,6 @@ import android.app.Service ...@@ -8,7 +9,6 @@ import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.ServiceInfo import android.content.pm.ServiceInfo
import android.graphics.BitmapFactory
import android.os.Build import android.os.Build
import android.os.IBinder import android.os.IBinder
import android.widget.RemoteViews import android.widget.RemoteViews
...@@ -37,6 +37,7 @@ class PermanentNotifyService : Service() { ...@@ -37,6 +37,7 @@ class PermanentNotifyService : Service() {
} }
@SuppressLint("ForegroundServiceType")
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (!isRunning) { if (!isRunning) {
......
...@@ -4,7 +4,7 @@ import android.provider.Settings ...@@ -4,7 +4,7 @@ import android.provider.Settings
import android.util.Log import android.util.Log
import android.webkit.WebSettings import android.webkit.WebSettings
import com.google.android.gms.ads.identifier.AdvertisingIdClient import com.google.android.gms.ads.identifier.AdvertisingIdClient
import com.tool.zxdemo.ZxApplication import com.zxdemo.ZxApplication
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
......
package com.zxdemo.utils package com.zxdemo.utils
import android.util.Log import android.util.Log
import com.tool.zxdemo.ZxApplication
import com.tool.zxdemo.ZxApplication.Companion.isAppInForeground import com.tool.zxdemo.ZxApplication.Companion.isAppInForeground
import com.tool.zxdemo.ZxApplication.Companion.isDeviceLocked import com.tool.zxdemo.ZxApplication.Companion.isDeviceLocked
import com.tool.zxdemo.ZxApplication.Companion.isScreenOn import com.tool.zxdemo.ZxApplication.Companion.isScreenOn
import com.tool.zxdemo.notity.NotificationUtils import com.tool.zxdemo.notity.NotificationUtils
import com.zxdemo.ZxApplication
import java.util.Timer import java.util.Timer
import java.util.TimerTask import java.util.TimerTask
......
...@@ -3,7 +3,7 @@ import android.text.TextUtils ...@@ -3,7 +3,7 @@ import android.text.TextUtils
import android.util.Log import android.util.Log
import com.android.installreferrer.api.InstallReferrerClient import com.android.installreferrer.api.InstallReferrerClient
import com.android.installreferrer.api.InstallReferrerStateListener import com.android.installreferrer.api.InstallReferrerStateListener
import com.tool.zxdemo.ZxApplication import com.zxdemo.ZxApplication
import com.zxdemo.http.ZxHttp import com.zxdemo.http.ZxHttp
import org.json.JSONObject import org.json.JSONObject
......
package com.zxdemo.utils package com.zxdemo.utils
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import com.tool.zxdemo.ZxApplication import com.zxdemo.ZxApplication
import com.zxdemo.http.ZxHttp import com.zxdemo.http.ZxHttp
import org.json.JSONObject import org.json.JSONObject
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment