qpython-android / qpython.org

QPython contributor & sugguestion & question homepage
http://qpython.org
58 stars 11 forks source link

How exactly do you start an activity with androidhelper? #167

Closed dentex closed 7 years ago

dentex commented 7 years ago

The relevant section "Intent & startActivity APIs" of the manual has empty code example blocks...

In the android shell, this activity starts if I do: am start -n com.pas.webcam/.Rolling.

In QPython, I tried:

import androidhelper
d = androidhelper.Android()

# and many variations of the next line, that doesn't work...
d.startActivity('android.intent.action.MAIN', packagename='com.pas.webcam', classname='Rolling')

I added ".class" to the classname's string, or used "ACTION_MAIN" as action... Nothing. I always get Result(id=N, result=None, error=None), with N being and incrementing integer.

Thanks in advance

liyuanrui commented 7 years ago

hello, this classname is wrong, try this

d.startActivity('android.intent.action.MAIN', packagename='com.pas.webcam', classname='com.pas.webcam.Rolling')
dentex commented 7 years ago

Ok thanks. Anyway, I did find the workaround to call the "am" command directly from my script.

Il 25 lug 2017 12:25, "lr" notifications@github.com ha scritto:

hello, this classname is wrong, try this

d.startActivity('android.intent.action.MAIN', packagename='com.pas.webcam', classname='com.pas.webcam.Rolling')

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qpython-android/qpython.org/issues/167#issuecomment-317696214, or mute the thread https://github.com/notifications/unsubscribe-auth/ACy9DjdEGwBrQOtSeYcOyylm7PFpf-Tkks5sRcKpgaJpZM4NQyHs .

riverfor commented 7 years ago

Thank you for update.

dentex commented 7 years ago

You're more than welcome. The command was simply:

call(['/system/bin/am', 'start', '-n', 'com.pas.webcam/.Rolling'])

Il 25 lug 2017 17:04, "River" notifications@github.com ha scritto:

Thank you for update.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/qpython-android/qpython.org/issues/167#issuecomment-317766435, or mute the thread https://github.com/notifications/unsubscribe-auth/ACy9Dmq8aouI27LLcRR21iumxd3grvJyks5sRgN-gaJpZM4NQyHs .