Were there any changes made to the media store in ICS and Jellybean?

PFlores81

Active Member
Licensed User
Longtime User
I have 3 soundboards that give the users the ability to copy and set a specific clip for use as ringer or notification.

The issue I am seeing is largely with ICS, and Jellybean devices.

With gingerbread the code worked fine on the 8 different devices it was tested on.
Code sample below.

B4X:
 If File.Exists(File.DirRootExternal & "/media/audio/ringtones","Round_End.mp3")=False Then 
        
        File.Copy(File.DirAssets,"Round_End.mp3",File.DirRootExternal & "/media/audio/ringtones","ZS_Round_End.mp3")
        u = rm.AddToMediaStore(File.DirRootExternal & "/media/audio/ringtones", "ZS_Round_End.mp3", "ZS_Round_End", True, True, True, False)
Else Return
  End If
 

margret

Well-Known Member
Licensed User
Longtime User
Just as Klaus had said, those are the issues. You will have to fix the mediastore because I commented them out. The syntax for the If exist lines where also wrong. Try this code:

B4X:
Sub Copy_Click
   If Msgbox2("This will copy all clips and set them for use in your ringtone and notifications options!", "Copy", "Proceed", "", "Cancel", Null) = DialogResponse.NEGATIVE Then
      Return
   End If
   If File.Exists(File.DirRootExternal, "/media/audio/ringtones") = False Then
      Msgbox("Directory does not exist and will be created for you.", "NOTICE")
      File.MakeDir (File.DirRootExternal & "/media/audio/ringtones","")
   End If
   If File.Exists(File.DirRootExternal, "/media/audio/ringtones/box.mp3") = False Then
      File.Copy(File.DirAssets, "box.mp3", File.DirRootExternal, "/media/audio/ringtones/ZS_Box.mp3")
      'u = rm.AddToMediaStore(File.DirRootExternal & "/media/audio/ringtones", "ZS_Box.mp3", "ZS_Box", True, True, True, False)
   End If
   If File.Exists(File.DirRootExternal, "/media/audio/ringtones/Round_End.mp3") = False Then
      File.Copy(File.DirAssets, "Round_End.mp3", File.DirRootExternal, "/media/audio/ringtones/ZS_Round_End.mp3")
      'u = rm.AddToMediaStore(File.DirRootExternal & "/media/audio/ringtones", "ZS_Round_End.mp3", "ZS_Round_End", True, True, True, False)
   End If
   Msgbox("Copy and Setup Completed!", "Complete")
End Sub
 
Upvote 0

PFlores81

Active Member
Licensed User
Longtime User
OMG Klaus you are right. I never changed that from the original file set. good lord, not sure how I even overlooked something as significant as that.
 
Last edited:
Upvote 0

PFlores81

Active Member
Licensed User
Longtime User
Just as Klaus had said, those are the issues. You will have to fix the mediastore because I commented them out. The syntax for the If exist lines where also wrong. Try this code:

B4X:
Sub Copy_Click
    If Msgbox2("This will copy all clips and set them for use in your ringtone and notifications options!", "Copy", "Proceed", "", "Cancel", Null) = DialogResponse.NEGATIVE Then
        Return
    End If
    If File.Exists(File.DirRootExternal, "/media/audio/ringtones") = False Then
        Msgbox("Directory does not exist and will be created for you.", "NOTICE")
        File.MakeDir (File.DirRootExternal & "/media/audio/ringtones","")
    End If
    If File.Exists(File.DirRootExternal, "/media/audio/ringtones/box.mp3") = False Then
        File.Copy(File.DirAssets, "box.mp3", File.DirRootExternal, "/media/audio/ringtones/ZS_Box.mp3")
        'u = rm.AddToMediaStore(File.DirRootExternal & "/media/audio/ringtones", "ZS_Box.mp3", "ZS_Box", True, True, True, False)
    End If
    If File.Exists(File.DirRootExternal, "/media/audio/ringtones/Round_End.mp3") = False Then
        File.Copy(File.DirAssets, "Round_End.mp3", File.DirRootExternal, "/media/audio/ringtones/ZS_Round_End.mp3")
        'u = rm.AddToMediaStore(File.DirRootExternal & "/media/audio/ringtones", "ZS_Round_End.mp3", "ZS_Round_End", True, True, True, False)
    End If
    Msgbox("Copy and Setup Completed!", "Complete")
End Sub

Just fixed this, Thank you again Margret. I think that will be the final update for that haha.. I am continuing work on another project which has had many hands in it. I just need to get a similar encryption scheme as truecrypt for it to work. Sort of like an encrypted volume.
 
Upvote 0
Top