Renpy 7.1.0 and OBB files

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
FroGlenn
Regular
Posts: 53
Joined: Sun Feb 25, 2018 2:07 pm
Contact:

Renpy 7.1.0 and OBB files

#1 Post by FroGlenn »

I dont know if this is a problem only with my game, but when I download my game from Google Play after updating to Renpy 7.1.0 certain devices cannot save the obb file in the smartphone storage.

To make it work, I need to go to settings and turn Storage Permission on manually and then it can download and use the obb file.

Searching the internet, I found that after SDK 23 some android phones needs to ask permission for OBB at runtime. From Google:

"Since Android 4.4 (API level 19), apps can read OBB expansion files without external storage permission. However, some implementations of Android 6.0 (API level 23) and later still require permission, so you will need to declare the READ_EXTERNAL_STORAGE permission in the app manifest and ask for permission at runtime"

I'm opening my renpy project in Android Studio to edit files, so this can be a problem only for ppl releasing games this way, but I would like to know if this is not a problem with 7.1.0 in general.

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Renpy 7.1.0 and OBB files

#2 Post by ComputerArt.Club »

Sorry, my games are less than 100 megabytes, it sounds like the obb format is used for larger games, so I don’t have experience with that yet.

FroGlenn
Regular
Posts: 53
Joined: Sun Feb 25, 2018 2:07 pm
Contact:

Re: Renpy 7.1.0 and OBB files

#3 Post by FroGlenn »

I think I solved it.

Using this answer and Google documentation, I added a bit of code to DownloaderActivity.java to create a new step asking for WRITE_EXTERNAL_STORAGE permission at runtime if user uses SDK 23+

The snippet create a new conditional checking if user is using SDK 23+, then it asks for permission, if granted, the donwload of obb starts.

The problem would be that you would be asking all SDK 23+ users permission, and just some devices really need it, so I created my check inside:

Code: Select all

if (expansionFile == null) { 
This way, if the device do not need permission, it will download and store the obb directly while downloading the apk and the expansionFile == null will never be true, so my new check wont be called.

I would really love to hear from Tom or other experienced members if all this is really necessary or maybe I'm just making some dumb mistakes causing the error in the first place.

Post Reply

Who is online

Users browsing this forum: No registered users