From 58f24953f387a9f7d902ddcca68d70504cc954a0 Mon Sep 17 00:00:00 2001 From: jens Date: Sun, 1 Jan 2023 20:13:34 +0100 Subject: [PATCH] startByService() --- app/src/main/java/com/jens/automation2/Actions.java | 2 ++ .../automation2/ActivityManageActionStartActivity.java | 7 ++++++- .../res/layout/activity_manage_action_start_activity.xml | 6 ++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/jens/automation2/Actions.java b/app/src/main/java/com/jens/automation2/Actions.java index 82e19f7d..55ba16b5 100644 --- a/app/src/main/java/com/jens/automation2/Actions.java +++ b/app/src/main/java/com/jens/automation2/Actions.java @@ -1093,6 +1093,8 @@ public class Actions if (params[2].equals(ActivityManageActionStartActivity.startByActivityString)) automationServerRef.startActivity(externalActivityIntent); + if (params[2].equals(ActivityManageActionStartActivity.startByServiceString)) + automationServerRef.startService(externalActivityIntent); else automationServerRef.sendBroadcast(externalActivityIntent); } diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java b/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java index 3499a5a8..625d381e 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionStartActivity.java @@ -53,11 +53,12 @@ public class ActivityManageActionStartActivity extends Activity Spinner spinnerParameterType; boolean edit = false; ProgressDialog progressDialog = null; - RadioButton rbStartAppSelectByActivity, rbStartAppSelectByAction, rbStartAppByActivity, rbStartAppByBroadcast; + RadioButton rbStartAppSelectByActivity, rbStartAppSelectByAction, rbStartAppByActivity, rbStartAppByBroadcast, rbStartAppByService; final String urlShowExamples = "https://server47.de/automation/examples_startProgram.html"; final static String startByActivityString = "0"; final static String startByBroadcastString = "1"; + final static String startByServiceString = "2"; final static int requestCodeForRequestQueryAllPackagesPermission = 4711; @@ -81,6 +82,7 @@ public class ActivityManageActionStartActivity extends Activity showStartProgramExamples = (Button)findViewById(R.id.showStartProgramExamples); rbStartAppByActivity = (RadioButton)findViewById(R.id.rbStartAppByActivity); rbStartAppByBroadcast = (RadioButton)findViewById(R.id.rbStartAppByBroadcast); + rbStartAppByService = (RadioButton)findViewById(R.id.rbStartAppByService); intentTypeSpinnerAdapter = new ArrayAdapter(this, R.layout.text_view_for_poi_listview_mediumtextsize, ActivityManageActionStartActivity.supportedIntentTypes); spinnerParameterType.setAdapter(intentTypeSpinnerAdapter); @@ -234,6 +236,8 @@ public class ActivityManageActionStartActivity extends Activity if (rbStartAppByActivity.isChecked()) parameter2 += ";" + startByActivityString; + else if(rbStartAppByService.isChecked()) + parameter2 += ";" + startByServiceString; else parameter2 += ";" + startByBroadcastString; @@ -595,6 +599,7 @@ public class ActivityManageActionStartActivity extends Activity rbStartAppByActivity.setChecked(params[2].equals(startByActivityString)); rbStartAppByBroadcast.setChecked(params[2].equals(startByBroadcastString)); + rbStartAppByService.setChecked(params[2].equals(startByServiceString)); int startIndex = -1; diff --git a/app/src/main/res/layout/activity_manage_action_start_activity.xml b/app/src/main/res/layout/activity_manage_action_start_activity.xml index d3e958f5..d89bc77a 100644 --- a/app/src/main/res/layout/activity_manage_action_start_activity.xml +++ b/app/src/main/res/layout/activity_manage_action_start_activity.xml @@ -129,6 +129,12 @@ android:layout_height="wrap_content" android:text="@string/startAppBySendBroadcast" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 121e131c..1955c03c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -873,4 +873,5 @@ MMS Attachment choose file + by startService() \ No newline at end of file