it is possible to open a pdf file in the game on android?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
it is possible to open a pdf file in the game on android?
hi everyone ! i need help
it is possible to open a pdf file in the game in android ? i've made a screen button to open the pdf file and in laptop its working but when i build it to apk an install it on my phone, its not working when i clicked the button.
here's my code in script.rpy
label mCOC1:
screen pdf():
vbox:
xalign 0.5
yalign 0.4
textbutton "{u}Open PDF file" action Help("game/resources/coc1.pdf")
2nd problem
i put the pdf file in right directory and its working on laptop but when i build to apk , the directory of pdf file in android/data/resources/coc1.pdf is missing i dont know if it is deleted when building the game or not, so when i clicked the button , nothings happen .
any one can help me here or understand what i mean ? im just a student. i wish someone can help me.
it is possible to open a pdf file in the game in android ? i've made a screen button to open the pdf file and in laptop its working but when i build it to apk an install it on my phone, its not working when i clicked the button.
here's my code in script.rpy
label mCOC1:
screen pdf():
vbox:
xalign 0.5
yalign 0.4
textbutton "{u}Open PDF file" action Help("game/resources/coc1.pdf")
2nd problem
i put the pdf file in right directory and its working on laptop but when i build to apk , the directory of pdf file in android/data/resources/coc1.pdf is missing i dont know if it is deleted when building the game or not, so when i clicked the button , nothings happen .
any one can help me here or understand what i mean ? im just a student. i wish someone can help me.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: it is possible to open a pdf file in the game on android?
No, it's not possible to do this on Android. (In general, it's much more complicated for one program to open another on mobile devices.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: it is possible to open a pdf file in the game on android?
Ahh i see. Thanks But even when i use renpy.file() it is not possible yet? Then Can i ask you a suggestion to my problem? I want to make a quiz game and i made a button to read or study the module its a pdf file, so that the user can read or study after taking a quiz . What should i do?
Re: it is possible to open a pdf file in the game on android?
It depends. If it's educational, maybe giving a link to the resource.
You can also turn your file into a number of images and make a screen to show these images as slideshow. Or maybe doing it more fancy and use text-images as overlay on some notebook image.
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: it is possible to open a pdf file in the game on android?
I'd suggest hosting the information on a web server, and then using OpenURL to send the user to it. Web servers are a lot less restricted, and so an app can submit a URL to the system to open easily.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: it is possible to open a pdf file in the game on android?
Yea i think that, but this module is 700+ pages, if i turn it all to images and make it a slideshow, i think the size of the game will be bigger when it build to apk. Im planning to make this game to be offline ._ticlock_ wrote: ↑Sun Jan 17, 2021 10:42 am
It depends. If it's educational, maybe giving a link to the resource.
You can also turn your file into a number of images and make a screen to show these images as slideshow. Or maybe doing it more fancy and use text-images as overlay on some notebook image.
Last edited by Mjhay on Sun Jan 17, 2021 12:40 pm, edited 1 time in total.
Re: it is possible to open a pdf file in the game on android?
Thanks. thats a good idea, but im planning to to make a offline game . Im stuck on this problem .
Re: it is possible to open a pdf file in the game on android?
Well, that is a lot of pages. In this case, the navigation with the slideshow would be inconvenient anyway. Potentially, players could download the file from the provided URL link and later use it offline in a separate app, but that is inconvenient as well
Re: it is possible to open a pdf file in the game on android?
Yes that right, im really stuck on this .
But I think i should try to provide URL to the player to download the file. But how to do that thing? What should i do?
Re: it is possible to open a pdf file in the game on android?
You need to use action OpenURL as PyTom wrote above. For example:
Code: Select all
screen pdf():
textbutton _("Open PDF file") action OpenURL("https://www.PATH_TO_FILE/coc1.pdf")
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3792
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: it is possible to open a pdf file in the game on android?
You could possibly direct the player to the file via Android's file://sdcard/ method. Use it with OpenURL
I haven't used this method since around Android 4.4 though so it may no longer be supported.
I haven't used this method since around Android 4.4 though so it may no longer be supported.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Re: it is possible to open a pdf file in the game on android?
Thanks for that ..
But what about the pdf file? if the game is in the other user ? They dont have the file .
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: it is possible to open a pdf file in the game on android?
In general, writing to the filesystem on Android is something that is hard to get right, with each version getting more and more strict about what you're going to do.
Hosting it on a webserver is likely to work and keep working. Writing to the filesystem is very likely to lead to heartbreak, now and in the future.
Hosting it on a webserver is likely to work and keep working. Writing to the filesystem is very likely to lead to heartbreak, now and in the future.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Who is online
Users browsing this forum: Amazon [Bot], MisterPinetree