We have moved to a new Sailfish OS Forum. Please start new discussions there.
4

how do I trigger an Android Intent from outside Alien-Dalvik?

asked 2014-04-12 02:45:25 +0200

dsilveira gravatar image

updated 2015-02-18 05:23:26 +0200

foss4ever gravatar image

Can someone give me some pointers on how to go about doing this?

I tried the solution from the selected answer from this: http://stackoverflow.com/questions/4567904/how-to-start-an-application-using-android-adb-tools

but it didn't work, it kept saying: /opt/alien/system/bin/am: line 6: exec: app_process: not found

Anyone have any clue?

EDIT 1:

this is what's in /opt/alien/system/bin/am:

# Script to start "am" on the device, which has a very rudimentary
# shell.
#
base=$ANDROID_ROOT
export CLASSPATH=$base/framework/am.jar
exec app_process $base/bin com.android.commands.am.Am "$@"

This is the command I used (I know it's just a start intent, no action flag to trigger the intent, but before this works, the action won't either):

(I have aptoide v5 installed, and this same command (without the full path) works on an android that I got with the same version of aptoide installed)

/opt/alien/system/bin/am start -n cm.aptoide.pt/cm.aptoide.pt.Start

EDIT 2:

thanks to @tingo, I got a little bit further, by modifying the am script adding the full path to app_process, so am looks like this now: this is what's in /opt/alien/system/bin/am:

# Script to start "am" on the device, which has a very rudimentary
# shell.
#
base=$ANDROID_ROOT
export CLASSPATH=$base/framework/am.jar
exec /opt/alien/system/bin/app_process $base/bin com.android.commands.am.Am "$@"

The thing is that now it does not start the Aptoide (like it did on Android), but instead, returns Segmentation Fault on the console, and that's it.

Any thoughts?

I feel I'm getting closer, but still, just, can't reach my goal :P

edit retag flag offensive close delete

Comments

It would be easier to answer if you showed us the whole command line you tried. 'am' in Android just starts an application; the error message suggests that you did not provide an application to start, or that you tried to start a non existing application.

tingo ( 2014-04-14 00:22:31 +0200 )edit

To make it clear I added the information you requested, altough it is not that important, because I'm looking for any information from anyone that successully achieved any intent trigger, not anyone that succeded with my particular test command.

dsilveira ( 2014-04-14 18:50:55 +0200 )edit

It seems someone forgot to fix the am script when it was put into /opt/alien/system/bin. I tries to exec 'app_process' which is an executable in also in /opt/alien/system/bin:

[nemo@Jolla ~]$ file /opt/alien/system/bin/app_process
/opt/alien/system/bin/app_process: ELF 32-bit LSB  shared object, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), stripped

but /opt/alien/system/bin isn't in PATH, so this can't work. IMHO, scripts should always specify the full path to any executables (or other scripts) they use. If you change the last line of the am script (make a backup of it first) to read

exec /opt/alien/system/bin/app_process $base/bin com.android.commands.am.Am "$@"

it has a chance to work.

tingo ( 2014-04-14 21:34:01 +0200 )edit

@tingo You were right about the error I was getting, it's fixed now. But It Segfaults right away :P

Any suggestion, anyone?

dsilveira ( 2014-04-16 14:19:45 +0200 )edit

2 Answers

Sort by » oldest newest most voted
3

answered 2015-02-14 21:11:01 +0200

attah gravatar image

I found a solution! The problem we were experiencing is an incomplete environment, so I went down the app-launching rabbit hole and found a place where am is invoked, and then i recreated that environment in a shell script.

I put it up here: https://github.com/attah/alien-tools

Now the road is paved for this: https://together.jolla.com/question/79440/android-app-cover-actions/

Give it a spin, let me know what you think and keep on tinkering!

edit flag offensive delete publish link more
0

answered 2014-04-12 09:35:24 +0200

rooster13 gravatar image

Check from the respective desktop file. Use the Exec= command. With that you can launch an Android application from the command line.

edit flag offensive delete publish link more

Comments

1

he doesn't want to launch an application, but trigger an Intent, which can be received by running android apps.

Acce ( 2014-04-12 10:04:20 +0200 )edit

Ok, did not understand the requirement.

rooster13 ( 2014-04-12 10:10:43 +0200 )edit
Login/Signup to Answer

Question tools

Follow
3 followers

Stats

Asked: 2014-04-12 02:45:25 +0200

Seen: 2,073 times

Last updated: Feb 14 '15