This commit is contained in:
ZhanGSKen 2025-03-07 11:15:22 +08:00
parent bca31f9079
commit bc252041d3
13 changed files with 132 additions and 140 deletions

View File

@ -44,7 +44,7 @@ android {
}
dependencies {
api project(':libappbase')
implementation project(':libappbase')
implementation fileTree(dir: 'libs', include: ['*.jar'])
//

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Thu Feb 27 02:34:13 GMT 2025
#Fri Mar 07 03:14:48 GMT 2025
stageCount=3
libraryProject=libappbase
baseVersion=2.0
publishVersion=2.0.2
buildCount=4
buildCount=5
baseBetaVersion=2.0.3

View File

@ -6,22 +6,23 @@ package cc.winboll.studio.appbase;
* @Describe APPbase 应用类
*/
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.SOSCSBroadcastReceiver;
import android.content.IntentFilter;
import cc.winboll.studio.libappbase.sos.SOSCenterServiceReceiver;
import cc.winboll.studio.libappbase.sos.SOS;
public class App extends GlobalApplication {
public static final String TAG = "App";
SOSCSBroadcastReceiver mSOSCSBroadcastReceiver;
SOSCenterServiceReceiver mSOSCenterServiceReceiver;
@Override
public void onCreate() {
super.onCreate();
GlobalApplication.setIsDebuging(this, BuildConfig.DEBUG);
mSOSCSBroadcastReceiver = new SOSCSBroadcastReceiver();
mSOSCenterServiceReceiver = new SOSCenterServiceReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(SOSCSBroadcastReceiver.ACTION_SOS);
registerReceiver(mSOSCSBroadcastReceiver, intentFilter);
intentFilter.addAction(SOS.ACTION_SOS);
registerReceiver(mSOSCenterServiceReceiver, intentFilter);
}
}

View File

@ -12,12 +12,10 @@ import cc.winboll.studio.appbase.services.MainService;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.WinBoll;
import cc.winboll.studio.libappbase.SimpleOperateSignalCenterService;
import cc.winboll.studio.libappbase.bean.APPNewsBean;
import cc.winboll.studio.libappbase.services.TestService;
import cc.winboll.studio.libappbase.widgets.StatusWidget;
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libappbase.sos.SOS;
public class MainActivity extends AppCompatActivity {
@ -69,44 +67,44 @@ public class MainActivity extends AppCompatActivity {
}
public void onTestStopWithoutSettingEnable(View view) {
LogUtils.d(TAG, "onTestStopWithoutSettingEnable");
stopService(new Intent(this, SimpleOperateSignalCenterService.class));
// LogUtils.d(TAG, "onTestStopWithoutSettingEnable");
// stopService(new Intent(this, SimpleOperateSignalCenterService.class));
}
public void onTestStartWithString(View view) {
LogUtils.d(TAG, "onTestStartWithString");
// 目标服务的包名和类名
String packageName = this.getPackageName();
String serviceClassName = SimpleOperateSignalCenterService.class.getName();
// 构建Intent
Intent intentService = new Intent();
intentService.setComponent(new ComponentName(packageName, serviceClassName));
startService(intentService);
// String packageName = this.getPackageName();
// String serviceClassName = SimpleOperateSignalCenterService.class.getName();
//
// // 构建Intent
// Intent intentService = new Intent();
// intentService.setComponent(new ComponentName(packageName, serviceClassName));
//
// startService(intentService);
}
public void onSOS(View view) {
Intent intent = new Intent(this, TestService.class);
stopService(intent);
WinBoll.sosService(this, new APPNewsBean(getPackageName(), TestService.class.getName()));
// Intent intent = new Intent(this, TestService.class);
// stopService(intent);
// SOS.se(this, new APPNewsBean(getPackageName(), TestService.class.getName()));
}
public void onStartTestService(View view) {
Intent intent = new Intent(this, TestService.class);
intent.setAction(WinBoll.ACTION_SERVICE_ENABLE);
startService(intent);
// Intent intent = new Intent(this, TestService.class);
// intent.setAction(WinBoll.ACTION_SERVICE_ENABLE);
// startService(intent);
}
public void onStopTestService(View view) {
Intent intent = new Intent(this, TestService.class);
intent.setAction(WinBoll.ACTION_SERVICE_DISABLE);
startService(intent);
Intent intentStop = new Intent(this, TestService.class);
stopService(intentStop);
// Intent intent = new Intent(this, TestService.class);
// intent.setAction(WinBoll.ACTION_SERVICE_DISABLE);
// startService(intent);
//
// Intent intentStop = new Intent(this, TestService.class);
// stopService(intentStop);
}
public void onStopTestServiceNoSettings(View view) {

View File

@ -16,13 +16,15 @@ import cc.winboll.studio.appbase.services.MainService;
import cc.winboll.studio.appbase.widgets.WinBollNewsWidget;
import cc.winboll.studio.libappbase.AppUtils;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.WinBoll;
import cc.winboll.studio.libappbase.bean.APPNewsBean;
import com.hjq.toast.ToastUtils;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.Date;
import cc.winboll.studio.libappbase.sos.WinBoll;
import cc.winboll.studio.libappbase.sos.APPModel;
import cc.winboll.studio.libappbase.sos.SOS;
import cc.winboll.studio.libappbase.sos.SOSObject;
public class MainReceiver extends BroadcastReceiver {
@ -52,12 +54,12 @@ public class MainReceiver extends BroadcastReceiver {
LogUtils.d(TAG, String.format("szAPPSOSBean %s", szAPPSOSBean));
if (szAPPSOSBean != null && !szAPPSOSBean.equals("")) {
try {
APPNewsBean bean = APPNewsBean.parseStringToBean(szAPPSOSBean, APPNewsBean.class);
APPModel bean = APPModel.parseStringToBean(szAPPSOSBean, APPModel.class);
if (bean != null) {
String szNewsPackageName = bean.getNewsPackageName();
LogUtils.d(TAG, String.format("szNewsPackageName %s", szNewsPackageName));
String szNewsClassName = bean.getNewsClassName();
LogUtils.d(TAG, String.format("szNewsClassName %s", szNewsClassName));
String szAppPackageName = bean.getAppPackageName();
LogUtils.d(TAG, String.format("szAppPackageName %s", szAppPackageName));
String szAppMainServiveName = bean.getAppMainServiveName();
LogUtils.d(TAG, String.format("szNewsClassName %s", szAppMainServiveName));
mwrService.get().bindSOSConnection(bean);
}
} catch (IOException e) {
@ -65,50 +67,42 @@ public class MainReceiver extends BroadcastReceiver {
}
}
}
} else if (intent.getAction().equals(WinBoll.ACTION_SOS)) {
} else if (intent.getAction().equals(SOS.ACTION_SOS)) {
LogUtils.d(TAG, "ACTION_SOS");
LogUtils.d(TAG, String.format("context.getPackageName() %s", context.getPackageName()));
LogUtils.d(TAG, String.format("intent.getAction() %s", intent.getAction()));
String SOS = intent.getStringExtra("SOS");
LogUtils.d(TAG, String.format("SOS %s", SOS));
if (SOS != null && SOS.equals("Service")) {
String szAPPNewsBean = intent.getStringExtra("APPSOSBean");
LogUtils.d(TAG, String.format("szAPPNewsBean %s", szAPPNewsBean));
if (szAPPNewsBean != null && !szAPPNewsBean.equals("")) {
try {
APPNewsBean bean = APPNewsBean.parseStringToBean(szAPPNewsBean, APPNewsBean.class);
if (bean != null) {
String szNewsPackageName = bean.getNewsPackageName();
LogUtils.d(TAG, String.format("szNewsPackageName %s", szNewsPackageName));
String szNewsClassName = bean.getNewsClassName();
LogUtils.d(TAG, String.format("szNewsClassName %s", szNewsClassName));
String sos = intent.getStringExtra(SOS.EXTRA_OBJECT);
LogUtils.d(TAG, String.format("SOS %s", sos));
if (sos != null && sos.equals("")) {
SOSObject bean = SOS.parseSOSObject(sos);
if (bean != null) {
String szObjectPackageName = bean.getObjectPackageName();
LogUtils.d(TAG, String.format("szObjectPackageName %s", szObjectPackageName));
String szObjectServiveName = bean.getObjectServiveName();
LogUtils.d(TAG, String.format("szObjectServiveName %s", szObjectServiveName));
Intent intentService = new Intent();
intentService.setComponent(new ComponentName(szNewsPackageName, szNewsClassName));
context.startService(intentService);
Intent intentService = new Intent();
intentService.setComponent(new ComponentName(szObjectPackageName, szObjectServiveName));
context.startService(intentService);
String appName = AppUtils.getAppNameByPackageName(context, szNewsPackageName);
LogUtils.d(TAG, String.format("appName %s", appName));
WinBollNewsBean appWinBollNewsBean = new WinBollNewsBean(appName);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String currentTime = sdf.format(new Date());
StringBuilder sbLine = new StringBuilder();
sbLine.append("[");
sbLine.append(currentTime);
sbLine.append("] Power to ");
sbLine.append(appName);
appWinBollNewsBean.setMessage(sbLine.toString());
String appName = AppUtils.getAppNameByPackageName(context, szObjectPackageName);
LogUtils.d(TAG, String.format("appName %s", appName));
WinBollNewsBean appWinBollNewsBean = new WinBollNewsBean(appName);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String currentTime = sdf.format(new Date());
StringBuilder sbLine = new StringBuilder();
sbLine.append("[");
sbLine.append(currentTime);
sbLine.append("] Power to ");
sbLine.append(appName);
appWinBollNewsBean.setMessage(sbLine.toString());
WinBollNewsWidget.addWinBollNewsBean(context, appWinBollNewsBean);
WinBollNewsWidget.addWinBollNewsBean(context, appWinBollNewsBean);
Intent intentWidget = new Intent(context, WinBollNewsWidget.class);
intentWidget.setAction(WinBollNewsWidget.ACTION_RELOAD_REPORT);
context.sendBroadcast(intentWidget);
}
} catch (IOException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
Intent intentWidget = new Intent(context, WinBollNewsWidget.class);
intentWidget.setAction(WinBollNewsWidget.ACTION_RELOAD_REPORT);
context.sendBroadcast(intentWidget);
}
}
} else {
ToastUtils.show(szAction);
@ -120,10 +114,8 @@ public class MainReceiver extends BroadcastReceiver {
public void registerAction(MainService service) {
IntentFilter filter=new IntentFilter();
filter.addAction(ACTION_BOOT_COMPLETED);
filter.addAction(WinBoll.ACTION_SOS);
filter.addAction(SOS.ACTION_SOS);
filter.addAction(WinBoll.ACTION_BIND);
filter.addAction(WinBoll.ACTION_SERVICE_ENABLE);
filter.addAction(WinBoll.ACTION_SERVICE_DISABLE);
//filter.addAction(Intent.ACTION_BATTERY_CHANGED);
service.registerReceiver(this, filter);
}

View File

@ -25,8 +25,8 @@ import cc.winboll.studio.appbase.services.AssistantService;
import cc.winboll.studio.appbase.threads.MainServiceThread;
import cc.winboll.studio.appbase.widgets.WinBollNewsWidget;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.bean.APPNewsBean;
import java.util.ArrayList;
import cc.winboll.studio.libappbase.sos.APPModel;
public class MainService extends Service {
@ -192,7 +192,7 @@ public class MainService extends Service {
}
}
public void bindSOSConnection(APPNewsBean bean) {
public void bindSOSConnection(APPModel bean) {
LogUtils.d(TAG, "bindSOSConnection(...)");
// 清理旧的绑定链接
for (int i = mSOSConnectionList.size() - 1; i > -1; i--) {
@ -207,13 +207,13 @@ public class MainService extends Service {
// 绑定服务
SOSConnection sosConnection = new SOSConnection();
Intent intentService = new Intent();
intentService.setComponent(new ComponentName(bean.getNewsPackageName(), bean.getNewsClassName()));
intentService.setComponent(new ComponentName(bean.getAppPackageName(), bean.getAppMainServiveName()));
bindService(intentService, sosConnection, Context.BIND_IMPORTANT);
mSOSConnectionList.add(sosConnection);
Intent intentWidget = new Intent(this, WinBollNewsWidget.class);
intentWidget.setAction(WinBollNewsWidget.ACTION_WAKEUP_SERVICE);
APPNewsBean appSOSBean = new APPNewsBean(bean.getNewsPackageName(), bean.getNewsClassName());
APPModel appSOSBean = new APPModel(bean.getAppPackageName(), bean.getAppMainServiveName());
intentWidget.putExtra("APPSOSBean", appSOSBean.toString());
sendBroadcast(intentWidget);
}
@ -222,10 +222,10 @@ public class MainService extends Service {
ComponentName mComponentName;
boolean isBindToAPPSOSBean(APPNewsBean bean) {
boolean isBindToAPPSOSBean(APPModel bean) {
return mComponentName != null
&& mComponentName.getClassName().equals(bean.getNewsClassName())
&& mComponentName.getPackageName().equals(bean.getNewsPackageName());
&& mComponentName.getClassName().equals(bean.getAppMainServiveName())
&& mComponentName.getPackageName().equals(bean.getAppPackageName());
}
@Override

View File

@ -15,11 +15,11 @@ import cc.winboll.studio.appbase.R;
import cc.winboll.studio.appbase.beans.WinBollNewsBean;
import cc.winboll.studio.libappbase.AppUtils;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.bean.APPNewsBean;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import cc.winboll.studio.libappbase.sos.APPModel;
public class WinBollNewsWidget extends AppWidgetProvider {
@ -59,11 +59,11 @@ public class WinBollNewsWidget extends AppWidgetProvider {
LogUtils.d(TAG, String.format("szWinBollNewsBean %s", szWinBollNewsBean));
if (szWinBollNewsBean != null && !szWinBollNewsBean.equals("")) {
try {
APPNewsBean bean = APPNewsBean.parseStringToBean(szWinBollNewsBean, APPNewsBean.class);
APPModel bean = APPModel.parseStringToBean(szWinBollNewsBean, APPModel.class);
if (bean != null) {
String szNewsPackageName = bean.getNewsPackageName();
String szNewsPackageName = bean.getAppPackageName();
LogUtils.d(TAG, String.format("szNewsPackageName %s", szNewsPackageName));
String szNewsClassName = bean.getNewsClassName();
String szNewsClassName = bean.getAppMainServiveName();
LogUtils.d(TAG, String.format("szNewsClassName %s", szNewsClassName));

View File

@ -1,6 +1,12 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// Nexus Maven
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
@ -10,12 +16,6 @@ buildscript {
mavenCentral()
google()
mavenLocal()
// Nexus Maven
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
@ -26,6 +26,12 @@ buildscript {
allprojects {
repositories {
// Nexus Maven
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
maven {
url "https://mirrors.tencent.com/repository/maven/tencent_public/"
}
@ -42,12 +48,6 @@ allprojects {
mavenCentral()
google()
mavenLocal()
// Nexus Maven
// "WinBoll Release"
maven { url "https://nexus.winboll.cc/repository/maven-public/" }
// "WinBoll Snapshot"
maven { url "https://nexus.winboll.cc/repository/maven-snapshots/" }
}
ext {
//

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Thu Feb 27 02:21:32 GMT 2025
#Fri Mar 07 03:14:48 GMT 2025
stageCount=3
libraryProject=libappbase
baseVersion=2.0
publishVersion=2.0.2
buildCount=4
buildCount=5
baseBetaVersion=2.0.3

View File

@ -13,6 +13,7 @@ import android.os.IBinder;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.bean.TestServiceBean;
import cc.winboll.studio.libappbase.sos.WinBoll;
import cc.winboll.studio.libappbase.sos.APPModel;
public class TestService extends Service {
@ -129,7 +130,7 @@ public class TestService extends Service {
isStarted = true;
super.run();
LogUtils.d(TAG, "run() start");
WinBoll.bindToAPPBase(mContext, new APPNewsBean(mContext.getPackageName(), TestService.class.getName()));
WinBoll.bindToAPPBase(mContext, TestService.class.getName());
while (!isExit()) {
LogUtils.d(TAG, "run()");

View File

@ -34,13 +34,13 @@ public class SOS {
static void sos(Context context, String szToPackage, String sosService) {
LogUtils.d(TAG, "sos(...)");
Intent intent = new Intent(ACTION_SOS);
intent.putExtra(EXTRA_OBJECT, genSOSObjectString(context.getPackageName(), sosService));
intent.putExtra(EXTRA_OBJECT, genSOSObject(context.getPackageName(), sosService));
intent.setPackage(szToPackage);
LogUtils.d(TAG, String.format("ACTION_SOS :\nTo Package : %sSOS Service : %s\n", szToPackage, sosService));
context.sendBroadcast(intent);
}
static SOSObject stringToSOSObject(String szSOSObject) {
public static SOSObject parseSOSObject(String szSOSObject) {
try {
return SOSObject.parseStringToBean(szSOSObject, SOSObject.class);
} catch (IOException e) {
@ -49,11 +49,11 @@ public class SOS {
return null;
}
static String sosObjectToString(SOSObject object) {
public static String sosObjectToString(SOSObject object) {
return object.toString();
}
static String genSOSObjectString(String objectPackageName, String objectServiveName) {
public static String genSOSObject(String objectPackageName, String objectServiveName) {
return (new SOSObject(objectPackageName, objectServiveName)).toString();
}
}

View File

@ -1,9 +1,5 @@
package cc.winboll.studio.libappbase.sos;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/02/27 14:00:21
@ -17,8 +13,11 @@ import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import cc.winboll.studio.libappbase.bean.SimpleOperateSignalCenterServiceBean;
import java.io.FileDescriptor;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import cc.winboll.studio.libappbase.LogUtils;
public class SOSCenterService extends Service {
@ -26,7 +25,7 @@ public class SOSCenterService extends Service {
private final IBinder binder =(IBinder)new SOSBinder();
SimpleOperateSignalCenterServiceBean mSimpleOperateSignalCenterServiceBean;
SOSCenterServiceModel mSOSCenterServiceModel;
static MainThread _MainThread;
public static synchronized MainThread getMainThreadInstance() {
if (_MainThread == null) {
@ -85,8 +84,8 @@ public class SOSCenterService extends Service {
}
public static final String TAG = "SOSBinder";
SimpleOperateSignalCenterService getService() {
return SimpleOperateSignalCenterService.this;
SOSCenterService getService() {
return SOSCenterService.this;
}
}
@ -94,10 +93,10 @@ public class SOSCenterService extends Service {
public void onCreate() {
super.onCreate();
LogUtils.d(TAG, "onCreate");
mSimpleOperateSignalCenterServiceBean = SimpleOperateSignalCenterServiceBean.loadBean(this, SimpleOperateSignalCenterServiceBean.class);
if(mSimpleOperateSignalCenterServiceBean == null) {
mSimpleOperateSignalCenterServiceBean = new SimpleOperateSignalCenterServiceBean();
SimpleOperateSignalCenterServiceBean.saveBean(this, mSimpleOperateSignalCenterServiceBean);
mSOSCenterServiceModel = SOSCenterServiceModel.loadBean(this, SOSCenterServiceModel.class);
if(mSOSCenterServiceModel == null) {
mSOSCenterServiceModel = new SOSCenterServiceModel();
SOSCenterServiceModel.saveBean(this, mSOSCenterServiceModel);
}
runMainThread();
}
@ -108,12 +107,12 @@ public class SOSCenterService extends Service {
runMainThread();
return mSimpleOperateSignalCenterServiceBean.isEnable() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
return mSOSCenterServiceModel.isEnable() ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
}
void runMainThread() {
mSimpleOperateSignalCenterServiceBean = SimpleOperateSignalCenterServiceBean.loadBean(this, SimpleOperateSignalCenterServiceBean.class);
if (mSimpleOperateSignalCenterServiceBean.isEnable()
mSOSCenterServiceModel = mSOSCenterServiceModel.loadBean(this, SOSCenterServiceModel.class);
if (mSOSCenterServiceModel.isEnable()
&& _MainThread == null) {
getMainThreadInstance().start();
}
@ -123,9 +122,9 @@ public class SOSCenterService extends Service {
public void onDestroy() {
super.onDestroy();
LogUtils.d(TAG, "onDestroy");
mSimpleOperateSignalCenterServiceBean = SimpleOperateSignalCenterServiceBean.loadBean(this, SimpleOperateSignalCenterServiceBean.class);
if (mSimpleOperateSignalCenterServiceBean.isEnable()) {
LogUtils.d(TAG, "mSimpleOperateSignalCenterServiceBean.isEnable()");
mSOSCenterServiceModel = SOSCenterServiceModel.loadBean(this, SOSCenterServiceModel.class);
if (mSOSCenterServiceModel.isEnable()) {
LogUtils.d(TAG, "mSOSCenterServiceModel.isEnable()");
// ISOSAPP iSOSAPP = (ISOSAPP)getApplication();
// iSOSAPP.helpISOSService(getISOSServiceIntentWhichAskForHelp());
}
@ -137,22 +136,22 @@ public class SOSCenterService extends Service {
public static void stopISOSService(Context context) {
LogUtils.d(TAG, "stopISOSService");
SimpleOperateSignalCenterServiceBean bean = new SimpleOperateSignalCenterServiceBean();
SOSCenterServiceModel bean = new SOSCenterServiceModel();
bean.setIsEnable(false);
SimpleOperateSignalCenterServiceBean.saveBean(context, bean);
context.stopService(new Intent(context, SimpleOperateSignalCenterService.class));
SOSCenterServiceModel.saveBean(context, bean);
context.stopService(new Intent(context, SOSCenterServiceModel.class));
}
public static void startISOSService(Context context) {
LogUtils.d(TAG, "startISOSService");
SimpleOperateSignalCenterServiceBean bean = new SimpleOperateSignalCenterServiceBean();
SOSCenterServiceModel bean = new SOSCenterServiceModel();
bean.setIsEnable(true);
SimpleOperateSignalCenterServiceBean.saveBean(context, bean);
context.startService(new Intent(context, SimpleOperateSignalCenterService.class));
SOSCenterServiceModel.saveBean(context, bean);
context.startService(new Intent(context, SOSCenterServiceModel.class));
}
public String getMessage() {
return "Hello from SimpleOperateSignalCenterService";
return "Hello from SOSCenterServiceModel";
}
static class MainThread extends Thread {

View File

@ -1,24 +1,25 @@
package cc.winboll.studio.libappbase.sos;
/**
* @Author ZhanGSKen@AliYun.Com
* @Date 2025/02/27 14:04:35
* @Describe SOSCenterServiceReceiver
*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import cc.winboll.studio.libappbase.LogUtils;
public class SOSCenterServiceReceiver extends BroadcastReceiver {
public static final String TAG = "SOSCenterServiceReceiver";
public static final String ACTION_SOS = SOSCenterServiceReceiver.class.getName() + ".ACTION_SOS";
public static final String
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(ACTION_SOS)) {
// 处理接收到的广播消息
LogUtils.d(TAG, String.format("Action %s \n%s\n%s", action));
} else {