Is there a way to access the raws of a different app through manifest settings or anything of that sort? I am trying to access raw mp3 of an app to play on a different app.
1 Answers
If by "raw" you mean the contents of another app's /res/raw/
folder then you can't. At least not without SuperUser/Root access.
You could theoretically manually pull apart the app in question on your PC and use their resources as you wish where you wish but that may very well be at best a breach of their TOS and at worst copyright infringement.
However, if you have control over the app in question that contains the resource you want access to you could define a ContentProvider to allow public access. Perhaps the app even already has one?
Edit: You have now clarified that you have access to both apps so then you can of course share whatever you like with yourself.
As I mentioned above you can use a ContentProvider
to share resources or information between apps. In this particular case you are looking to share an audio *.mp3 file I would suggest a FileProvider
which inherits from ContentProvider
.
I'll leave the implementation details to the official Android docs linked as they do a much better job of explaining it than I ever could.
In a nutshell though:
- App A which holds the audio file defines a FileProvider.
- App B makes an Intent request to App A for a/the file (with optional authentication)
- App A can either return the file now or offer a choice of files to App B.
- App B either consumes the received provider and gets its file or tells App A which file it wants.
- App A can now pass the chosen file to App B which consumes it.
P.S. As some bedtime reading you could have a look at this alternative implementation that links to a github repo and explains the usage of a project from SO's very own CommonsWare: https://stackoverflow.com/a/14734310/1590950

- 1
- 1

- 4,892
- 4
- 31
- 50
-
I am trying to use the mp3 raw of one of my apps to be played on a different app. They are both linked with the same UID and it should be working. – Dat_фрикаделька May 30 '14 at 18:29
-
Then you should define a ContentProvider in the app supplying the resource and use it the the app receiving the resource. Link up in my answer. – indivisible May 30 '14 at 18:32
-
How would you put an mp3 into ContentProvider though? It seems as if it only holds primitive type. – Dat_фрикаделька May 30 '14 at 18:39
-
I have edited my answer above to include an answer that fits the new info. – indivisible May 30 '14 at 19:01
-
so does the FileProvider allow access to the app's raw or does it relocate the raw? – Dat_фрикаделька May 30 '14 at 19:05
-
You may need to extend FileProvider to allow you to use assets instead of real files – indivisible May 30 '14 at 19:12
-
Here is a link to a similar answer to get you started: http://stackoverflow.com/a/7177103/1590950 – indivisible May 30 '14 at 19:12