Android: making a Music Player app more efficient - java

I am making an android music app. I have a few queries about how to make it more efficient-
Should I store the tracks available on the device, in my app? If yes, what should I use JSON, SQLite or CouchbaseLite?
How often should I refresh the stored records?
Any other tips will be highly appreciated.

There is no need to save the music in your own app's database, android saves them for you and provides a content provider (MediaStore) that allows you restricted access to the content of that database. So every time your app wants to load music from the device, it would use the load music from the Media Store, making your own database would only mean having a copy of the data in the device and that would be waste of memory since you would still have to query your database to get the music.
you can learn more about content providers and media store from the following tutorials.
Media Store
Content Provider

Related

Android Studio Server data transfer

I am developing an app in android studio and I would appreciate some help with it.
The idea is to make the app get data from some type of online server/database/whatever would be the best option. Then after retrieving data from there it would use it to display the data in app and user would be able to interact with data retrieved (aka ordering a product), then the app would send some type of signal that the product has been ordered online and at the end you would be able to see the order from your computer, which will somehow connect to the same online system.
Is there any way to do that and if so I would appreciate some help.

Where should I store images for my android app? How to store and retrieve those images?

The app is an online app. And the size of my app (.apk) is already over 85mb. I want to store the images I am using on "some" server, instead of drawable folder. The problem is I don't know the particular server, and how do I store and retrieve the those images?
The app is written in java language.
It's an app to locate charging station for electric vehicle.
So, please give me some "servers" on which I can store images, and use them as and when reguired.

Where to store images for android app?

I'm creating a android application for Tourists. In that application user will be able to take photo and send them to storage. Other users will be able to display this photos on their devices. My question what kind of storage I have to choose to only display that photos without downloading them ?
If one person takes the picture and another can view it on another device, it means you will have a server involved. This means you'll need to download a version of the image (even just a low quality version of it as cache) or you cant view it. Check out firebase ->firebase<- quite handy & well documented to do this kinda thing

How to manage a (big) JSON object and save the data into the phone?

I'm working on an App for Android and I have to retreive information (JSON) from a URL; save it on the phone and then display the information on a list.
Until now I've managed to retreive the information using Jackson library, but now I wonder which is the best way to keep this information on the phone.
I tried to save it as a file into the Internal Storage but then, when I try to read this file to create a JSON Object again, I get errors and I can't find the file on the phone using ADB Monitor to check what's going on.
Then, I tried to saved into the External Storage, but with Android 6.0 there is new Permission Model which I don't quite understand. I would like to have more time to just implement this but I have a deadline for this task.
My last option is to create a SQLite database. Which I haven't done before and also is taking some time to understand.
I would like to read some recomendations from people with experience because I'm new on Android and I don't know in which of these options to focus.

Uploading data from Android App to desktop program

I'm pretty new to android so apologies if I'm missing an obvious solution, I'm developing an android app that would be used to record various data including photographs and hopefully the intention would be for this collected data to be uploaded to a desktop application where certain desktop specific jobs could be carried out.
Due to the fact I intend to save photographs within the app in the SQLite database as a bytearray which recorded information would be I think that it would be too data intensive to send to a server, plus I wouldn't want the desktop app to necessarily be on a server, it should be standalone. I'd prefer to use the USB connection and allow a USB upload of the data from the app sqlite db direct to the database on the pc, probably sql server. What would be the best way to approach this? Could the android ADB be used to acheive this?
Any help or suggestions on this would be much appreciated.
Regards
I believe that your sqllite database (as well as photos contained there) will be stored on the SD card of the device. You have to options here, first, when your desktop applications find the folder on the device SD card (should be mounted on the filesystem after connecting the device to your PC), second is to use bluetooth and initialize the transfer from the device to your desktop application.
You could try having them on the same network and having them interact that way. I know applications such as RemoteDroid do this, but I have no experience doing so myself. There is also the fact that there is the data saved on the sd card / by putting your device in Storage mode and you could just point your desktop to the device drive and assume a designated folder your app uses exists.
Adding on to the answers here, you could save your photos as files in your sd card and transfer it to your pc from there.
Here is a dev guide on storing files.
Another way is to transfer over WiFi. Ice cream sandwich seems to have a WiFi Direct api that allows us to perform P2P transfers over WiFi. I have not used it yet but have a look at this
Solution 1
I would probably use rsync between my desktop and android. This way you can export data from your sqlite to a flat file and import it to your local database on your desktop. This way you can also put your schema into a file.
RSync is a very stable protocol to exchange files.
Solution 2
You can also use Amazon S3 for this purpose. The file name can contain the version number for ensuring that you have the latest file.

Categories