My app is used in my job to make sales.
This app can remotely update itself (not using Google play), update its data, send information, etc...
In some point, the app reads a heavy catalog of images (several hundreds of MB). To avoid download this data, a micro SD card with all the images has been included in each device.
To read the images in the SD Card I use "Environment.getExternalStorageDirectory()". Until today everything worked ok.
However, the new devices are GalaxyTab 7 Plus, they are very cool machines, but when I use "Environment.getExternalStorageDirectory()" I got the internal SD path. The tablet recognized the External SD card (as "extSdCard") but I don't know how to access it.
I tried with the "vold.fstab" file (following the answer to this question How could i get the correct external storage on Samsung and all other devices?) but I don't trust too much... I mean... is this thing valid? I checked the vold.fstab from a GalaxyTab 10 with android 3.0 and a GalaxyTab 7 Plus with android 4.0 and they are pretty different...
So, in short:
I always want get the external SD card path and if this does not exist, then get the internal SD card path (if exists). I can't do this because java don't let me choose between then when I use "Environment.getExternalStorageDirectory()"
Thanks!
The Android SDK, at least through 4.1, does not support the notion of multiple points of external storage. Hence, there is no documented and supported means for you to get to this secondary card from a directory standpoint.
The contents of that card may be indexed by the MediaStore, through proprietary extensions added by the device manufacturer. Every device that has an external SD card that I have tried appears to do this. Hence, if there is a way you can somehow adjust your logic to not worry about where the files are, but instead to find them via MediaStore, that should work across devices.
Beyond that, you're stuck with guessing games, per some of the answers on the question that you linked to.
Related
I am developing an app which is a graphical book. Every week, a new chapter is being released and the app will be updated. There are basically images that are going to be shown to the user as slides. The user can subscribe and all chapters will be visible to the user (the image sources are offline and embedded inside the APK file). The images are not saved into the internal SD card (like they are not shown in the phone gallery after installing the app).
I am afraid that it is not a safe way to show the content to the users. What if someone just extracts all the images? I am thinking of the solutions below. Please give me the best option to keep my image files secured.
Obfuscating the app (I'm not sure if this works in this case. I know obfuscating helps to change the codes but I'm not sure if it helps to encrypt the images)
Using an online server and let subscribed users download the images (I think this way it might be saved inside the external storage. Anyway after the download the images must be available offline)
Should I encrypt the images by an encryption method?
Let's explore your options one by one
If you obfuscate the app, it can be deobfuscated
If you use an online server, the images will be downloaded, you can manage to store the downloaded images into the memory instead of the disk and then show directly from memory.
If you encrypt the images, you need to have some decryption method/key implemented in the app, which can be retrieved and bingo,
the user can have decrypted images.
So if downloading the images from an online service will not break your business requirement, then go ahead with that.
Remember that, in any of the cases, if one is determined to save the images, he/she can.
You may need to have multiple methods in place to make it harder for those, seeking to save it.
I've got an app created with Android Studio.
I'm using an SQLite database which gets downloaded and saved in phone's storage.
The problem is that in certain types of phones (Lenovo / Xiaomi to be exact) the sqlite file gets deleted after some time and the users have to re-download it.
The problem is appearing only on these 2 types of phones and also not all of them.
I can't replicate that on any of the phones I tried nor emulated ones within Android Studio.
There is no code that would delete the SQLite file and also I couldn't find anything in here or google about Lenovo/Xiaomi having similar problems like mine.
Any Ideas, would be appreciated.
I don't know about Lenovo, but Xiaomi phones have a "Clean up" feature that regularly (at least once a week, in my experience) asks the user to, well, let it clean up files. I don't know what it uses to decide if a file is obsolete or not, but it is a very aggressive cleaner (it wants to clean up cache files for apps that have just been used and are in constant use, for example). This is likely what is removing your downloaded files. You can check the location you're downloading them to, and see if changing that helps; or you could see if you can find any documentation on the file cleaner so you can find out how to stop it from flagging your DB as "rubbish".
I would like to write a program in java that copies mp3 files from my PC, renames them so they sort correctly, and transfers them to the sdCard on my Android phone via USB. I assumed this would be a trivial task since I have already successfully written a similar program for transferring files to an external HDD, however I reached an immediate stumbling block. It seems that java (and indeed other desktop applications) cannot locate the device's file system even when given the exact path that windows explorer reports (This PC\SAMSUNG-SM-G900V\Card).
I've tried researching and the problem seems to have to do with the device being considered a Portable Device rather than a drive (maybe) but I have not found a concrete solution. An answer to the following question seems to suggest it is impossible but I find that hard to believe.
Can Android's internal memory be mapped to a drive letter on PC?
Does anyone know of a way to access Portable Device storage through java? If if it indeed impossible, can someone perhaps help me understand why it is possible through Windows Explorer but not through other programs.
In school (high school), my partner and I are developing an Android tablet application. We were both issued Acer Iconia A500 tablets to use. I need to pull files created by our application on run-time off the device (adb pull), but because they are not rooted, and I wouldn't want to root school property, is there an effective way to remove files from an android device stored in your applications data/data/packagename/ area? We also did try the emulator, but have had numerous different problems with it, and when it does work, it takes about 4-5 minutes to upload an apk to it every time I change code and re-upload it. Any ideas on a good way to get files off a non-rooted device, in this case a database I'm trying to copy from assets, so I can inspect it?
If you have a choice, I'd definitely recommend writing your files to the SD card because that will be a lot easier to view and handle.
If your file must necessarily be written in /data, what you could do is mirror it to the SD card for debugging purposes. So every time you write the file, you also write exactly the same content to the SD card (if the debug flag is on, otherwise no).
If it's a file that is not being created by your code but by other code, what you can do in your app is copy it to the SD card when you detect that it's been changed.
You could use the external storage permission and write to the SD Card instead. Then you can pull them using the regular windows directory when you plug it in. Also, it should not take that long to update your code via the emulator, are you turning the emulator off every time?
i wonder on which smartcards i can actually run javacard? afaik it requires the "open platform" OS, but: which USIM-cards for mobile phones today (especially in germany) do actually support this?
Updated with TheGoodUser correction
I afraid issued cards will be useless for you.
Almost (if not all of them) will be in lifecycle state CARD_SECURED which doesn't allow you to load an applet using GlobalPlatform/OpenPlatform.
In case of SIM cards for the network operator there is a way to load an applet on the Java card - OTA. If Remote Applet Manager applet (part of OTA) is installed and configured applet could be loaded and installed to the SIM using ENVELOPE command (special formated SMS comes to the phone and phone passes them in ENVELOPE command to the card). Unfortunately for you to do that you still need to know keys - card will expect signed or/and encrypted ENVELOPEs. So you'll need keys to do that.
If your interest is just academic - you can always buy java card with some SDK/Tools from some small card manufactures and play with java card. If you want to install something on existing card I'd say it is impossible.
As far as I know all SIM card produced during last ~10 years are able to run java. The problem is that you need code can be obtained from the card owner, i.e. the carrier. But carrier will not give you this code unless you are the carrier's partner...
Probably the following links can help you.
http://forums.techarena.in/software-development/1353925.htm
How to programmatically load a Java card applet ( a .cap file ) using Visual C++/PCSC
some operator provide USIM to customer by javacard.you can download applets into java card.