Scoped storage was introduced with android 11. This changed how apps access the file system on android devices and has caused a problem with the Wifi Sync App. Usually resulting in an error about the selected music folder not being root. Some users have reported the app working ok on android 11 devices without having to make the below changes. I suspect the app was installed while the device was android 10 and was updated to android 11 with an OTA update and the OS kept the existing file permissions. Once the app is reinstalled or has it's data/cache cleared it will stop working.
Below are instructions on how to get the wifi app working with android 11+ devices.
Disclaimer – I’m not a programmer. I’ve been learning as I go so use the below instructions and the app at your own risk.
Install Android Studio. Easy to do, there are plenty of guides on the net for this.
Download the code for Music Bee Wifi on github and extract it to a folder.
https://github.com/mayallst/MusicBeeWifiSync/archive/refs/heads/master.zipInside that folder, delete .idea\vcs.xml - it causes an error when importing it into Android Studio if you don't.
Open Android Studio
Select File->Open and open the folder you extracted above. It will take a while to build gradle, I’m not sure what this does but just be patient. It may prompt you to upgrade gradle. I opted to do that. Again you have to wait a little while.
Once it's loaded there will be a list of files on the left. Under Manifests, drag AndroidManifest.xml onto the right of the screen and it will display the contents.
Add the following line above line 5 in this file.
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
This change allows the app to have file permissions to all of the external storage. The app previously had this access level but scoped storage blocked it, so you are not giving it access to anything it couldn’t access previously. It’s just a work around to restore functionality.
On the left of the screen under the Java folder, drag WifiSyncBaseActivity to the right of the screen.
Change line 115 from this -
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.N || Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) && !PermissionsHandler.isUserSelectedPermissionsPathValid(WifiSyncServiceSettings.accessPermissionsUri.get())) {
To this -
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.N || Build.VERSION.SDK_INT >= 34) && !PermissionsHandler.isUserSelectedPermissionsPathValid(WifiSyncServiceSettings.accessPermissionsUri.get())) {
This change just stops it checking if it actually has permission to the folder you select. The code to check permissions has changed which caused the root folder error message.
This isn’t necessary but you can set a different version number.
Right click "app" in the left window and select Open Module Settings
I changed the version code to 75 (was 74) and Version number to 2.2 (was 2.1)
Now just build the APK.
From the menus at the top of the screen, select Build->Build Bundle(s)/APK(s)->Build APK(s)
This will create the following APK in the original folder
app\build\outputs\apk\debug\app-debug.apk
Copy this file to your phone.
Use a file browser to find the file on your phone and run it. It will state something about not being from the Play Store and it's unsigned, just install anyway.
Once you open it you will get a dialog to allow it to manage all files on the phone, click allow.
Before you do anything else, go out of the app and go to permission settings on the phone.
On mine I had to go to settings->apps->special app access->All files Access (This was on a redmi note 10 pro running a custom A12 AOSP rom)
Even though I had given it permission earlier, I found MusicBee Wifi Sync was set to "Not Allowed" in this menu. I changed it to Allowed.
Go back into the MusicBee app and you should be able to select a folder now without it popping up an error.
On first sync you may get an error about the playlist folder not being a child of the of the folder you selected, just hit sync more and try and sync again, it should work fine the second time. If you want to avoid this error just make sure there is a playlist folder in your selected music folder before you perform the first sync.
The changes above should allow the app to work on android 11 and above but if you are on android 11 and it’s not working, try the below changes. Don’t bother doing the below if you are on Android 12 or greater as it will just be ignored by the OS.
In the AndroidManifest.xml file, change the following code -
android:allowBackup="true"
android:theme="@style/AppTheme">
To this -
android:allowBackup="true"
android:theme="@style/AppTheme"
android:requestLegacyExternalStorage="true">
I have another version that handles permissions a bit better for the user and technically could be uploaded to the play store as it is targeting SDK 30. I will add this to the guide at a later date.