Problems with activity starter and viewing pdf files

594 views
Skip to first unread message
Assigned to ewpa...@gmail.com by taifu...@gmail.com

Bruno Bueno Mena

unread,
Sep 17, 2018, 12:52:02 PM9/17/18
to mitappinv...@googlegroups.com
Hi all!

I created this little application to test the pdf viewer months ago. It used to work perfectly, today I didnt work.
I tried on 2 smartphones with negative results. I didnt modify anything of the blocks. 
In my old smartphone it says "this document cant be open" and it's not one of those texts I put on the blocks
when the activitystarter is not working. When I get out of this little application I can view the pdf correctly.
In my lets say new smartphone, isnt working but at least it tries to open it, though the screen is black.
When i get out of my application I can view the pdf correctly.
I tried with the old compilation and the new for Google Play, it didnt work either.

What is happening? new upgrade of android is blocking the pdf viewer?

By the way im using the typical pdf viewer of Tayfun.

thanks in advance!

Taifun

unread,
Sep 17, 2018, 3:08:21 PM9/17/18
to MIT App Inventor Forum
does the example project work for you?
https://puravidaapps.com/pdf.php
which device / Android verison are you using for your tests?

Taifun

Bruno Bueno Mena

unread,
Sep 18, 2018, 4:05:06 AM9/18/18
to mitappinv...@googlegroups.com
Well my blocks are like this:



its a bit more complete version of your "how to view a pdf document" from your snippets.
(Maybe you thought I was referring to your extension)

Im not using your pdf extension, because im not into extensions yet and this one is for android version 5.
I wanted my app to be used by all possible mobiles, but with the last change for Google Play, now it has
more sense to do it.

devices:

old mobile ---> android 4.1.2 LG-P760
newer mobile ---> android 6.0.1 Galaxy J5

It happened to me something similar with Skype, I used to use activitystarter to make a direct phone call
but there was a moment that it werent possible. I remember that I had to modify my app for this.

Can I read a pdf without using your extension or is it the only possible way now?

TimAI2

unread,
Sep 18, 2018, 6:07:11 AM9/18/18
to MIT App Inventor Forum
You can still use a webviewer or activitystarter to view a pdf:

Bruno Bueno Mena

unread,
Sep 18, 2018, 8:21:19 AM9/18/18
to MIT App Inventor Forum
Tim, activitystarter is not working for me.
I didnt try the webviewer because I dont have pdf stored in a website.

It's a feature for my app, I created a little apk to test it. It worked before
but not now, I dont know what has changed.

Taifun

unread,
Sep 18, 2018, 12:06:13 PM9/18/18
to mitappinv...@googlegroups.com
for the activity starter solution you will need a pdf reader app on your device
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 



Bruno Bueno Mena

unread,
Sep 18, 2018, 1:55:51 PM9/18/18
to MIT App Inventor Forum
I have a pdf app in both smartphones, I can view pdfs with them.

The problem is that I cant view them inside my testing app. It used to
work but not now and I didnt modify anything, it seems that some
specification of the activity starter doesnt work anymore.

viewingapdf.jpg


Taifun

unread,
Sep 18, 2018, 6:36:09 PM9/18/18
to MIT App Inventor Forum
did you try the example project from here

Bruno Bueno Mena

unread,
Sep 20, 2018, 1:31:27 PM9/20/18
to MIT App Inventor Forum
I've tried your "pdf project" in both phones:


old mobile ---> android 4.1.2 LG-P760

newer mobile ---> android 6.0.1 Galaxy J5

"Vier pdf from Device" didnt work, its like the pdf viewer try to open it but
it sends a message "this document cant be opened".

"View pdf from web" works perfectly for both.

Something is blocking the activitystarter, like when Skype started not to do direct calls
with activitystarter either.

Taifun

unread,
Sep 20, 2018, 2:46:53 PM9/20/18
to mitappinv...@googlegroups.com
thank you Bruno
assigned to Evan to check...
here is the exampe project https://puravidaapps.com/snippets.php#2pdf
Taifun
PS: I edited the subject of this thread to avoid misunderstandings...

Evan Patton

unread,
Sep 20, 2018, 3:08:45 PM9/20/18
to MIT App Inventor Forum
Hi Bruno,

Would you mind sharing the project with me that is exhibiting the problem? We can test it here at MIT and see if we can replicate/diagnose the problem.

Thanks,
Evan

Taifun

unread,
Sep 20, 2018, 3:30:27 PM9/20/18
to MIT App Inventor Forum
a temporary solution to fix this issue is to drag a sharing component into the project, see Mika's tip here https://community.makeroid.io/t/getting-error-while-accessing-pdf-from-directory-kindly-help/10116/11?u=taifun
@Evan: see the example project here https://puravidaapps.com/snippets.php#2pdf
Taifun

Bruno Bueno Mena

unread,
Sep 21, 2018, 4:13:40 AM9/21/18
to MIT App Inventor Forum
Tayfun,

The drag solution didnt work either. I tried 2 things:

1) Just dragging into my project and your pdf project without any
blocks related to the sharing component. The aswer was "this 
document cant be opened".

2) Not only dragging it but using the block "call sharing sharedfile/file"
with the result uri given by activitystarter. The error2001 appeared, 
saying the file (written as a path) couldnt be found, and right after the
"this document cant be opened" error.

Taifun

unread,
Sep 21, 2018, 1:51:10 PM9/21/18
to MIT App Inventor Forum
you might want to ask Mika in the Makeroid forum about that workaround...
Taifun

Evan Patton

unread,
Sep 21, 2018, 1:57:27 PM9/21/18
to MIT App Inventor Forum
Thanks Taifun. I will use this as a baseline and see whether we can replicate it at MIT.

Cheers,
Evan

Boban Stojmenovic

unread,
Sep 24, 2018, 10:00:00 PM9/24/18
to MIT App Inventor Forum
Modified example project from here https://puravidaapps.com/pick.php

Seems like it doesn't accept DataUri if it contains content://com.android.externalstorage.documents/document/primary%3A


I have added file component to grant permission at run-time when build App for Google Play.

This works on most of my devices except on Samsung S3 with Android 4.3, get an error message failed to find configured root that contains.

Modified file provider_paths.xml in ..\res\xml\ with this instead

    <root-path name="root" path="." />

And now it works on all devices.

Hope it helps in some way to find the error...

/Boban
pickModified.aia

Evan Patton

unread,
Sep 25, 2018, 9:35:17 AM9/25/18
to MIT App Inventor Forum
Thanks Boban for the detailed report. The SDK 26 update will convert file:// URIs to content:// URIs, which is why this works the way it does. It might be the case that we aren't allowed to reuse content URIs coming from other activities, although I'm not sure why that would be the case. Does the example work with the File component but without changing back to file://?

Cheers,
Evan

Boban Stojmenovic

unread,
Sep 25, 2018, 2:40:25 PM9/25/18
to MIT App Inventor Forum
Using third party Explorer, I get this and it works.

Using direct file, works.

With my sample file and build App, works on all devices.

As I mentioned earlier, it doesn't work if I build with App for Google Play on Samsung S3 with Android 4.3 without further modification.

/Boban

Boban Stojmenovic

unread,
Sep 25, 2018, 11:43:29 PM9/25/18
to mitappinv...@googlegroups.com
Ups forgot this one..

Does the example work with the File component but without changing back to file://?

edit... When you're tired you don't realize that some things don't work.

Doesn't work
(The file file:///mnt/sdcard/AppInventor%2Fassets%2Fcolors.csv could not be found) (2101)

Doesn't work
(The file content://com.android.externalstorage.documents/document/primary%3AAppInventor%2Fassets%2Fcolors.csv could not be found) (2101)

Doesn't work, using direct file.
(The file file:///mnt/sdcard/AppInventor/assets/colors.csv could not be found) (2101)

/Boban

Boban Stojmenovic

unread,
Sep 26, 2018, 12:47:45 AM9/26/18
to MIT App Inventor Forum
On the other hand, this works using file component.


Using direct file.

/Boban
Reply all
Reply to author
Forward
0 new messages