I have a android app which has a copyrighted mp3 track. I dont want users to see the mp3 that is stored in my app on music player.currently users are able to access the track using their default music player.
any lights on this issue?
Add a .nomedia file in the audio track directory of your app.This avoids the files being listed in music player.
There are multiple possibilities, based upon your needs, pick one, or a combination:
1) An easy solution: Put the .mp3 in your private folder. NOTE: Rooted users are still able to play/copy the mp3 file.
2) Another Easy way: rename the .mp3 to something weird, so it will not get picked up by music players. E.g. your_file.aaa ... NOTE: Rooted Users who know this file is actually an .mp3 can rename it and play/copy it
3) Or, a bit more work, encrypt/decrypt the file. This tutorial can get you started. This is an option if you absolutely want to prevent users from playing/copying the .mp3 outside your app.
Convert your file to binary refer this and the encrypt it using something like base64 while saving. while fetching do th reverse
Related
I am confused with the new app storage system in Android. I am not sure where my use case falls under and I need your help in telling me the right approach for this
My app captures images and generates pdf documents. Prior to Android 10, I used to store them in an app directory where the user can easily navigate to them through other files browsing app (like Files app on Samsung). In addition, these files can be accessed from within my app (so essentially read and write).
With the new storage, I am not sure how to accomplish the same thing. If I use the internal storage then user can't see them. If I use the media approach, well it seems it is only for Audio/video plus they will not be organized in a folder like I have them organized.
Am I missing something? How would I solve this problem?
Thank you
On an Android 11 device you can store your files in a subdirectory of the public Documents directory.
You can do that using classic File means or the media store or SAF.
Other apps can see them using SAF or the media store. Or with classic file means when requested all files access.
The user can see them using the default Files app on the device.
As the title says, I have 1000mb audio files in my app (which has a media player ability also). I don't need a 100% protection. All I need is that when user downloads these audio files from the web, only my app could be able to find on open these files and if a normal user shares these files they couldn't open it.
I know a dedicated user or hacker can easily access the main files, all I need is a simple primitive protection from a ordinary user.
What is the best way to do this? Any suggestions or examples would be appreciated.
Thanks a lot
Store those audio in folder named '.nomedia' without quotes.
OR
Use custom file extentions and and save those files using Serialization
To save object to file you need serialization.
You can choose whatever file extension we like e.g. .car.
You can simple encrypt the header of the file not entire file, Your app will decrypt that header before playing it. You only need to encrypt few bytes so there is no performance issue.
I have created an Android Application, in that I am playing and downloading audio file from server. So when user download audio file from server he/she can't show that file in File Manager or any other media player like Gaana app.
How to make it possible?
Thanks,
Sagar.
You can save the files in Internal Storage Area. These files would be private to your app only.
Using getFilesDir() on any context provides absolute path to the filesystem directory where your internal files are saved. There in you can create directory. For more information refer here
You can use few approaches:
Download files into the private application's directory. No other apps will have access to those files. Pros of this approach is that is is the easiest way. Cons is that the inner storage might be limited in the device.
Download files saving them with incorrect file extensions. Pros: easy to implement, can save anywhere. Cons: files can be accessed, copied and renamed by any other app.
The same way as 2nd approach, but add some encryption to the files, so nobody except you can use them. This approach might require on-the-fly decryption.
I'm using the android/midi-lib for my app, but need to get some better sounds for the metronome and possibly the drum. eventually I also need to be able to access the sounds of the drumset. Does anybody know how I can get the midi channels/etc to point to a sample(.mp3 file or something) in my res/raw or assets directory instead of being forced to use the sounds in the standard midi library?
Are there any custom open-source libraries that don't rely on the default MediaStore (so that I don't reinvent the wheel)? Or do I have to write my own scanner? The problem:-
I've created a music player in Android that can also create playlists from local files. The details about the local media is obtained from Android's MediaStore. Everything works fine until I relocate my music files. When a media file is moved, the ID field in its entry in the Android MediaStore gets changed. Obviously that means any attempts to get to the file using the stored (stale) ID's will fail. How do I get around this? Thanks!
You are able to manually refresh the content of the Media library.
Read this related post - I think you will find it useful!