Android make my app files only play from inside the app - android-mediaplayer

I created an app in which the client can record few conversations and store in external storage. The client must be able to transfer the files if needed. So I am storing the recorded files in external storage. But client don't want the files to be played from outside the app, (from sd card) or from music player. Is it possible? Please let me know. Is using internal storage is the only way to do it?

well this is not a programming question, but ...
you have 2 options here, decide based on your requirements
1) if you want the records to be simply not appear in any player
or multi media app, you have 2 options:
A- let the storing folder name starts with . (ex, .myrecords)
OR
B- add a file inside the folder named .nomedia
but this will not PROTECT the records, as if someone mounts the sd-card records can be copied and played on any device/pc
2) if you want to secure the files, you will need to encrypt them as advised by Joey Chong
so once the recording completed, the file got encrypted, and stored on external storage
once the user enters the playback screen, and picks a file to play, the app will decrypt it first, in a new (temp file) then play it, and delete the temp file once user leaves the playback screen.
-- for exporting the records to PC or other devices,
you can add a function (button maybe) to export selected records, that simply decrypts the selected files into a specific folder, say (/appfolder/exported/) then user can copy them or do whatever...
and user have to DELETE the files at export folder once purpose of export is ended. (maybe a button too) Clear Exported
storing in internal is not good idea, specially audio/video as it might be large files, and some devices does not have really large internal storage.
this could be more a comment but its way too long

Is internal storage that you mention mean private location inside your app? As far as I know even you put in internal storage, Media player still able to locate the file unless it is inside your app private location.
What you can do is encrypt the file and store in external storage. When you need to play back, decrypt the file to your app private location and playback.

Related

Accessing the localStorage of one device from another in react-native

Some days before, i saw a blog post about why we need to keep whatsapp open on our smartphone to make it work on our PC.
It said that WhatsApp fetches the data (messages) from our smartphone and shows them on our pc which seems pretty good as it will lower the load on our database.
So now i wanted to know if there is a way to do so in react-native i.e, access the localStorage of one device from another.
Why i want to do that?
I am building an app where in the profile, i also take the profile picture from the user and i don't want to store it on the database but instead store it locally and serve it from there.
The reason for that is that we need buckets to store media files and serve them from there and i wanted to cut that part when deploying my app.

Saving data on phone in a Cordova app

I am making a mobile app using Cordova and I need to save some sensitive and not so sensitive data inside the phone. I am a bit lost on what is the best way to do it.
I need to save:
A JSON web-token (for authentication).
A response from server (I save this to populate my page in case the GET request fails).
Coordinates information when user is logging data to the app (for later upload to a server from with in the app). These will be many separate logs, and can be large in size for local storage ~5-10 MB.
Till now i have been successfully saving everything I need to the local storage but I don't think that is the correct way to do it. So that is why I need some help in deciding what is the best course to take from security point of view.
Saving server response is just for better UI experience and static in size so I guess local storage is a good option to use.
But web-tokens and GPS logs is sensitive information and I dont want to keep it in the local storage as it is accessible from outside the app.
What other options do I have?
Cordova still doesn't have encrypted storage.
Is saving to files a good approach? This here says that data contained inside cordova.file.applicationStorageDirectory is private to the app.So can I use it to save the logs and the token?
The plugin also lists the file systems for Android and iOS and lists which of those are private.
I am currently working with android phones but want to extend the app to iOS later. I have never worked with file systems and caches before so I am a bit lost.

Store remote 2d barcode in React Native

I am developing a prototype for a mobile ticketing platform where I have to create 2D barcode ticket for the user , currently I am creating 2D barcode from google chart service and displaying it using Image Tag.But Now I do not want to hit remote source every time , I want to download image on first time and save it on local phone source .
So I need guidance to where should I store this image in Async Storage or CameraRoll
Thanks
If you store your images in Camera Roll then they'll be visible to the phone's user when they browse their photos and they could potentially get synced to iCloud. This seems to me to be bad form.
AsyncStorage is a key-value storage mechanism, and the value is expected to be a string. You could use this if you base64 encoded your images, but you'd also have to store another value to track a list of the images you were keeping in AsyncStorage.
I don't think either of these are ideal. Personally I'd look into storing them on the device's filesystem, and fortunately there's a project that seems to enable you to do just that: react-native-fs "Native filesystem access for react-native". I think this is the most natural approach and will allow you to iterate over your stored images.
A final idea is to use a database; you could perhaps use one of these:
https://github.com/mafintosh/browserify-fs (uses level.js behind the scenes)
https://github.com/almost/react-native-sqlite (sqlite)

Using Dropbox API for (subscription) content delivery

I run a multi-gigabyte audio content subscription service. Right now all of our clients get download links via email for all of the content.
I had an idea of employing the Dropbox API after a "successful charge" webhook and giving (read-only) access to a shared Dropbox folder with all of the content. That way, the customer would stay in sync with all updates, changes etc...
The way I picture it, the user checks out and is immediately asked if he would like to add our company's folder to his/her Dropbox.
Does this seem feasible/practical?
Looking at the API, I only see an option to provide a download link but not an actual shared folder. Am I correct in this observation?
That's correct, the Dropbox API doesn't currently offer any API calls for managing shared folders. It only has a way to get the read-only share links like you mentioned.
However, if you'd be interested in potentially participating in a shared folder API beta in the future, please sign up here.
#Greg's answer is correct, but I thought I'd mention a couple other options:
You could use the Saver to let users save the files directly into their Dropbox. This wouldn't help you to push new content to them—they'd still have to visit your site to save the new files—but it would let you cut down on your bandwidth costs, since Dropbox would cache the files for you.
You could use a combination of /copy_ref and /fileops/copy to copy the contents from a central Dropbox account into each user's Dropbox. This wouldn't use any of your bandwidth (once the file was in the central Dropbox account).
Please note, however, that free Dropbox accounts only start with 2GB of storage space. Since you mentioned "multi-gigabyte," you'll need to keep in mind whether your customers will actually have sufficient Dropbox space to store the files you want to share with them. (Even if you were able to use a shared folder, they would need to have enough space left to accept the shared folder invitation.)

Mac App: Storing Information w/ Document-based Applications

I'm in the process of planning out the infrastructure for a Mac App, and we have a startup screen with many user files listed. We want the App to be iCloud-compatible (thus the need for Document-based (key-value won't cut it since they aren't nested - correct me if I'm wrong here)). Essentially, we don't want to have the user keep track of each individual file themselves as that would be irritating, but rather store it in the App's folder until the user needs it (i.e. Email, Export, etc). It would eliminate a lot of the friction in the app, we think. I guess my question is:
Is it possible to store files automatically in the App's installation folder (or somewhere locally?) without bothering the user - in a Document-based app - and still be App Store compatible? Seems like the ideal solution - user opens app, App knows it's save location and automatically saves documents there when a user creates one, and pulls them to share if needed. Any help?
Yes, it's possible. You won't want to store document's in the application's installation folder. For one thing that'll violate the App Store rules, but it's bad behavior anyway, since Applications are normally installed in /Applications, which shouldn't be cluttered up with other files. So storing things in ~/Library/Application Support/YourAppName is the way to go.
To actually implement this, take a look at NSDocumentController and NSDocument itself. You'll basically want to override/modify any UI that allows users to choose a location to save/open documents. Instead, just let them name the documents, and then automatically save them with the given name in the app support folder. Then create a UI that allows them to browse and open those files within the app.