From 90479c06a25f432b57b5590e58ea0dc4c7578b01 Mon Sep 17 00:00:00 2001 From: agnostic-apollo <31106828+agnostic-apollo@users.noreply.github.com> Date: Mon, 12 Apr 2021 14:13:53 +0500 Subject: [PATCH] Updated RUN_COMMAND Intent (markdown) --- RUN_COMMAND-Intent.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/RUN_COMMAND-Intent.md b/RUN_COMMAND-Intent.md index 8c24201..e095cc5 100644 --- a/RUN_COMMAND-Intent.md +++ b/RUN_COMMAND-Intent.md @@ -182,9 +182,13 @@ pluginResultsServiceIntent.putExtra(PluginResultsService.EXTRA_EXECUTION_ID, exe PendingIntent pendingIntent = PendingIntent.getService(MainActivity.this, executionId, pluginResultsServiceIntent, PendingIntent.FLAG_ONE_SHOT); intent.putExtra(RUN_COMMAND_SERVICE.EXTRA_PENDING_INTENT, pendingIntent); -// Send command intent for execution -Log.d(LOG_TAG, "Sending execution command with id " + executionId); -startService(intent); +try { + // Send command intent for execution + Log.d(LOG_TAG, "Sending execution command with id " + executionId); + startService(intent); +} catch (Exception e) { + Log.e(LOG_TAG, "Failed to start execution command with id " + executionId + ": " + e.getMessage()); +} ``` Define the `PluginResultsService` class which extends from `IntentService`. @@ -239,10 +243,15 @@ public class PluginResultsService extends IntentService { } ``` -Declare `PluginResultsService` entry in `AndroidManifest.xml` +Declare `com.termux.permission.RUN_COMMAND` permission and `PluginResultsService` service entry in `AndroidManifest.xml` ```xml - + + + + ``` ##