How to open another app with intent

278 views
Skip to first unread message

Nobody (PeteMcTee)

unread,
Nov 1, 2024, 4:43:34 PM11/1/24
to mementodatabase
Hello,
I'm looking for a simple action script to open another app on my phone. And I'm assuming I'm going to need to know the other apps package name, how can I find that?

Thanks in advance,
Pete

Er Mo

unread,
Nov 2, 2024, 1:59:58 PM11/2/24
to mementodatabase
Hallo
Memento kann Daten den Betriebssystem übergeben und dieses Öffnet die Datei . Das geht mit Android

Hello
Memento can pass data to the operating system and this opens the file. This works with Android

Ernst

Bill Crews

unread,
Nov 2, 2024, 2:10:03 PM11/2/24
to Er Mo, mementodatabase
I wish I'd done more of this, but I know the answer is somewhere in the link below, assuming Android is acceptable. In addition, you could maybe use this to initiate another Android app, like Zapier or Tasker, and script that app to fire up the image viewing app...


--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mementodatabase/ee3b47b6-2fe9-427e-a90a-22a2020749e2n%40googlegroups.com.
Message has been deleted

Brandon M.

unread,
Nov 4, 2024, 8:52:07 PM11/4/24
to mementodatabase
Hello Pete,

Intent's are tricky, as it's just a wrapper for the Android service. You will have to dive into the Intent dev docs to learn more.

Here's how you can open Spotify:
try {
    var i = intent("android.intent.action.VIEW");
    i.data("spotify:"); // This URI opens Spotify without specifying a specific track or playlist
    i.send();
} catch (error) {
    message("Unable to open Spotify. Error: " + error.message);
}

Here's how you can send an email with proper formatting for adding things like tables, more than just sending basic text to the email client.
// Set the email recipient
var emailRecipient = "exa...@domain.com";

// Set the email subject
var emailSubject = "Order Request";

// Set the email body
var emailBody = "Hello,\n\nWe would like to place an order. Please see the details below.\n\nBest regards,\nYour Name";

// Format the mailto link
var mailtoData = "mailto:" + emailRecipient + "?subject=" + encodeURIComponent(emailSubject) + "&body=" + encodeURIComponent(emailBody);

try {
    var i = intent("android.intent.action.SENDTO");
    i.data(mailtoData);
    i.send();
} catch (error) {
    message("Unable to send email. Error: " + error.message);
}

If you need to find the package name, I recommend the app Package Name Viewer on the play store.

Best Regards,
Brandon

Nobody (PeteMcTee)

unread,
Nov 5, 2024, 12:45:06 PM11/5/24
to mementodatabase
I'm unsure how to implement - Maybe I'm misunderstanding the use / need for package name. How would I implement my package in your example? 
Citizens
com.citizensbank.androidapp
com.citizensbank.androidappmvp.views.LaunchActivity


Brandon M.

unread,
Nov 8, 2024, 10:54:28 AM11/8/24
to mementodatabase
Hello Pete,

Since file URI's are restricted in Android, Intents might not be directly what you are looking for. I have not been able to find any mention of a built in file manager with Memento. The reason you can open apps like Spotify and Discord with URI view intents is because those apps have a manager that can interpret those intents. Your banking app is unlikely to have a manifest that specifies it can be viewed via intents.

What this means is your best bet at making something like this work is exploring the options available in Tasker. It appears it should be rather trivial to pass the command to Tasker, and let the file manager present in Tasker handle the intent operation. I can't assist you with this, I have not used Tasker for any projects and am unaware of all the steps required to make it work. However, it appears that Memento uses Tasker to handle anything beyond basic intents with interacting with the device.

Excerpt from web:
---------------------------------------
Tasker Configuration:

1. Create a Tasker Task:
Name your task, e.g., "Open Image from Memento".
Add an Action → App → Send Intent.
Action: android.intent.action.VIEW
Data: file://%file_path (This variable will be passed from Memento)
Mime Type: image/*
Target: Choose Activity.

Save the task.

2. Make the Tasker Task Accept a File Path:
Ensure that your task uses %file_path as a variable in the Data field.
Memento Database Script:
Update the Memento Database JavaScript to send the file path as an extra to Tasker:

// Specify the file path to be passed to Tasker
var filePath = "myFilePathGoesHere.jpg";

// Create an intent to trigger Tasker
var taskerIntent = intent("net.dinglisch.android.tasker.ACTION_TASK");
taskerIntent.extra("task_name", "Open Image from Memento"); // Name of your Tasker task
taskerIntent.extra("file_path", filePath); // Pass the file path as an extra
taskerIntent.send();



David Gilmore

unread,
Nov 8, 2024, 12:16:10 PM11/8/24
to mementodatabase
Tasker can do what you want, assuming the target app has the necessary hooks.

The Memento Tasker plug in is somewhat limited. You can create or modify library entries, and react when a library entry is created, deleted, or modified.

There are ways to pass commands to Tasker, but it is a bit convoluted. I do it by creating a file with permissions so that both Memento and Tasker can read/write to that file. When sending a command to Tasker, Memento will write a control string to the file, and Tasker, which monitors that file, will read and act. Did I mention it is somewhat convoluted?

Reply all
Reply to author
Forward
0 new messages