I have installed termux on my android phone.
I have Foxit-pdf-reader installed in my Android phone
I want to open a pdf file using Foxit pdf reader from termux command line
I tried to open the app using the below command in Termux and it successfully opens the Foxit pdf reader
$ am start --user 0 -n com.foxit.mobile.pdf.lite/com.fuxin.app.frame.AppActivity
Starting: Intent { cmp=com.foxit.mobile.pdf.lite/com.fuxin.app.frame.AppActivity }
Now I close the app and try to provide the Pdf file location
My pdf is located at: /data/data/com.termux/files/home/storage/downloads/test_termux.pdf
$ am start --user 0 -n com.foxit.mobile.pdf.lite/com.fuxin.app.frame.AppActivity -d "file:///data/data/com.termux/files/home/storage/downloads/test_termux.pdf"
Starting: Intent { dat=/data/data/com.termux/files/home/storage/downloads/test_termux.pdf cmp=com.foxit.mobile.pdf.lite/com.fuxin.app.frame.AppActivity }
It opens the app as it was previously opened. But does not open the corresponding file.
Also tried
$ am start --user 0 -a android.intent.action.VIEW -d "file:///sdcard/downloads/test_termux.pdf"
Starting: Intent { act=android.intent.action.VIEW dat=file:///sdcard/downloads/test_termux.pdf }
This shows the various pdf viewers but not the foxit.
Also, I tried
$ am start --user 0 -a android.intent.action.VIEW -d "file:///sdcard/downloads/test_termux.pdf" com.foxit.mobile.pdf.lite
Starting: Intent { act=android.intent.action.VIEW dat=file:///sdcard/downloads/test_termux.pdf pkg=com.foxit.mobile.pdf.lite }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=file:///sdcard/downloads/test_termux.pdf flg=0x10000000 pkg=com.foxit.mobile.pdf.lite }
this does not work
So how to open a particular pdf using the com.foxit.mobile.pdf.lite
app. It opens when I click on any pdf from WhatsApp or file manager with a foxit-pdf-reader. So it should be possible using command line also
I don't know if this is what you are looking for, but at least it worked for my device.
Just clear all the defaults in the setting and set foxit pdf reader as your default pdf reader and then just run the following command:
$ am start --user 0 -a android.intent.action.VIEW -d "file:///sdcard/downloads/test_termux.pdf"
Starting: Intent { act=android.intent.action.VIEW dat=file:///sdcard/downloads/test_termux.pdf }
Then why not try using tasker Set a Task :1 launch app - foxit pdf reader :2 open file - ( /sdcard/downloads/test_termux.pdf ) U may set the profile to execute the task as and when u want If u want to use terminal u may download a mod version of termux_tasker plugin If this is also not what u want then pls specify the reason of opening a file through termux .In my case i just wanted a quick access to any pdf so i just adjusted the taskertask in pie shortcut lmt and my work was done!!
User contributions licensed under CC BY-SA 3.0