[Q] SharedPreferences: Memory requirement and usability across app versions - Java for Android App Development

I am using SharedPreferences to save app data (around 80-200KB).. my doubt is what happens if even that much memory is not available? Is there a way to mention that my app requires atleast 200KB more than whatever is installation size or don't install?
and a question on usability of SharedPreferences across app versions.. even as I modify during my development, certain changes require clearing of earlier stored data.. would like suggestions if there are ways of defining/storing keeping in mind the changes/future-versions than just plain save/restore I am doing at present
and why doesn't SharedPreferences allow to save/restore byte/short types?

You can use Base64 encoder to encode byte array to String and save it by SharedPreferences.Editor.

Related

Any registry scanners??

Now please don't start some flaming about how Android doesn't have a "registry" - It has ways of storing persistent application data not on the SD cards (http://developer.android.com/guide/topics/data/data-storage.html)
So are there any programs to list/scan/edit these private and primitive data sets?
The find and grep command-line tools are the classic ways to look for things on UNIX/linux/android.
You also need to deal with binary vs ASCII files. The file tool can help determine this.
The combination of these tools is left as an exercise for the reader.
Yeah, I don't understand your reply.
I was wondering if there were apps for non hacked Android phones (if the original app can write, surely another an can peek)
With android's permission setup, applications cannot modify data for other applications unless the app you wish to modify stores its data in a file on the sd card, or provides a "content provider" for other apps to work off of.
General system settings are found at http://developer.android.com/reference/android/provider/Settings.System.html
Most programs will store their settings with the "SharedPreferences" class (http://developer.android.com/guide/topics/data/data-storage.html#pref), which cannot be modified by other applications (as far as I know).
Aside from the global settings, the only real way to view or modify app specific settings is if that app has an accessible ContentProvider (http://developer.android.com/guide/topics/providers/content-providers.html).
If you want to poke around any deeper, then you need root access and to look through the sql tables directly. See http://davanum.wordpress.com/2007/12/11/android-how-to-poke-around-the-sqlite3-databases/.

[Q][DEV] Using Images in applications.

Hi people, I'm developing and an application that uses a sqlite database, and I'm having trouble to store images in database, I read a lot of examples, but not working here, can someone tell me the best way to store images in SQLite?
(and then I'll need to store movies as well..)
EDIT: In the future I'll have to develop a backoffice so the company can add/change/delete items in the db.
Thanks!
Would it not make more sense to store the images on the SD card and store a path to the image in the database?
alostpacket said:
Would it not make more sense to store the images on the SD card and store a path to the image in the database?
Click to expand...
Click to collapse
I've been seaching and now I know that is not good to store images in SQLite, but in SDcard is still bad because it will be acessed by user.. I think I want to store them in internal memory, private to the app, but I don't know how to.. if some one could help me it wold be great!
batista16 said:
I've been seaching and now I know that is not good to store images in SQLite, but in SDcard is still bad because it will be acessed by user.. I think I want to store them in internal memory, private to the app, but I don't know how to.. if some one could help me it wold be great!
Click to expand...
Click to collapse
You can store images in your database easily, by storing their data as a byte[]. Create your table with a BLOB column, then read the image as a byte[] and use ContentValues class with method put(String name, byte[] value), and finally SQLiteDatabase.insert(ContentValues values).

Internal storage

I am developing a graphical password for android phones. After clicking on certain points on an image, the pixel positions should get stored in the internal memory of the phone or in a file, so that next time the user signs in, the values that the user puts can be compared with stored values. The values stored should not get erased. How do i go about this? Any function? ( Developing in eclipse)
You 'll find your way through surface view and open gl es it can provide x y cordinates of piont of touch see developer.android.com
Sent from my GT-S5302 using Tapatalk 2
Welcome to XDA!
malinis said:
I am developing a graphical password for android phones. After clicking on certain points on an image, the pixel positions should get stored in the internal memory of the phone or in a file, so that next time the user signs in, the values that the user puts can be compared with stored values. The values stored should not get erased. How do i go about this? Any function? ( Developing in eclipse)
Click to expand...
Click to collapse
First of all, welcome to XDA!
Second, you may want to take a look at http://developer.android.com/guide/topics/data/data-storage.html. I do not recommend writing the coordinates to a file on the internal/external storage of a phone (unless encrypted somehow) because anyone could easily look at it. Hope this helps!
Thanks all. I used sqlite / database handler.. helped me
malinis said:
Thanks all. I used sqlite / database handler.. helped me
Click to expand...
Click to collapse
So you put the coordinates into a database?
Well, you can also look up all values from a sqlite database: https://play.google.com/store/apps/details?id=dk.andsen.asqlitemanager
Encrypt them.
yeah..put them in database, once u pull the file from the device, i can read it using the sqlite browser.. Its working fine for the application. Encryption yet to be done. Just a novice
malinis said:
yeah..put them in database, once u pull the file from the device, i can read it using the sqlite browser.. Its working fine for the application. Encryption yet to be done. Just a novice
Click to expand...
Click to collapse
I think that encryption is important. Check this: http://stackoverflow.com/questions/2430412/what-java-library-should-i-use-for-cryptography
Enjoy learning.
yes it is.. thanks for that!

[Q] Does WP8 have clipboard storage?

I was wondering if cut/copy commands are stored on WP8 in isolated storage or somewhere else similar to the uipasteboard in iOS? Any help would be appreciated.
There is no OS-level "Cut" command. Copy (and Paste) work only for text, but are supported by the OS and across apps, not in any per-app storage. The public APIs for clipboard access are extremely limited; apps can detect when there's clipboard content and can put their own text on the clipboard, but that's it. (Internal APIs for actually accessing clipboard data do of course exist, but app's aren't generally permitted to use them.)
Developers are of course welcome to implement an app-internal clipboard of any kind they want. For example, Pocket File Manager supports Cut/Copy/Paste for files (in the same manner as Windows Explorer on PCs) but that's purely app-internal.
GoodDayToDie said:
There is no OS-level "Cut" command. Copy (and Paste) work only for text, but are supported by the OS and across apps, not in any per-app storage. The public APIs for clipboard access are extremely limited; apps can detect when there's clipboard content and can put their own text on the clipboard, but that's it. (Internal APIs for actually accessing clipboard data do of course exist, but app's aren't generally permitted to use them.)
Developers are of course welcome to implement an app-internal clipboard of any kind they want. For example, Pocket File Manager supports Cut/Copy/Paste for files (in the same manner as Windows Explorer on PCs) but that's purely app-internal.
Click to expand...
Click to collapse
Great! So basically I the WP8 doesn't have a storage place where sensitive data (i.e. Credit Card info) would be stored if someone decided to do a copy on a card number so they don't have to retype it in later in the app. Correct?
I see a lot of .DATA files in isolated storage. Do you know what these are and how to open them? Much appreciated again.
Well, as I said, there is an OS-level clipboard (shared between apps) that can handle text (but nothing else). CC#s are text, so they could be copied this way. The only way to make that impossible would be to prevent the user from selecting the text (a pointless goal in any case, as the user could just copy the number manually, or take a screenshot, or... you get the idea).
Isolated Storage is completely up to the app. The OS has nothing at all to do with it, besides providing a location in the file system for each app to use. Without even knowing what app you're talking about, I can't begin to tell you what the format of those files is.

'Storage Access Framework' woes..

TLDR at bottom!
I am needing to finally update a specialized app to support newer frameworks. I haven't had to touch this app about 8 years or so, because it was running fine, and it did its job. Sadly, because of some of the new library requirements by Google Play, it's gotta be updated. One of these changes is handling the new Storage Access Framework / writing to storage on the device. I've read the docs that searching has pointed me, and even looked at some of the examples. Sadly, the examples seem rather limited in nature, and my app doesn't seem to fit any of the 'given' examples.
The ultimate end goal is to have the users select an output directory once. And then IN that directory, the app creates folders based on the user's project. (like, 'FrontLine', 'RearLine', 'Cement', etc..). In each of these sub-directories, then, pictures and txt files are stored. (Either downloaded via http client, or taken/generated by the user.)
I was able to implement an intent calling 'ACTION_OPEN_DOCUMENT_TREE', and I get a content URI back. However, hooking that to a Camera library (for example, the androidx.camera library) needs a File or an output stream. Trying to create an output stream then gives me an error stating that access needs to be granted using the external storage permission.
I feel liek I'm missing something 'big' and obvious to connect my user's chosen output direcory into a File or some converting that will let me mkdirs, and write out files.
TLDR; Needing user to select a base output directory, in which my app creates Project directories in it, and then allows storage of pictures or text into these directories. Tried Storage Access Framework, and despite having the user select a directory, am still getting a permission denied error when trying to create output stream.
Any pointers are more then welcome, as googling I have reached dead ends, sadly. Kinda peeved at this new 'framework' and the limited scope it seems to have. (At least, in examples..)
Thanks guys!

Categories

Resources