Android - Is it possible to overwrite userdata of another app? - java

I want to update user data of another app from my app. The purpose of this is to update some images that the other app uses. Is this possible?

It depends on where the data/images are saved.
For every app there is a folder named /android/data/package.name to which only that application has access to read and write. No other application has the privilege of writing to that particular folder.
But if the data is saved somewhere else than /android/data/package.name folder, then you can definitely overwrite their data giving that you have proper read/write permissions.

Related

clear app data without killing application

I need to clear all app data including cache without killing the application. All solutions I have seen either just remove cache data or they kill the application after removing app data. Is there any way to do aforementioned thing without the application being closed?
Android developers save user data mainly in three locations. File System DataBase SharedPreference.
File System
context.getCacheDir();
context.getFilesDir();
context.getExternalCacheDir();
context.getExternalFilesDir();
You can navigate the file system and delete the file you create.
Database
You can use context.deleteDatabase(String name); to delete the database you create.
SharedPreference
context.getSharedPreferences(String name, int mode).edit().clear(); will remove all values in the sharedpreference file.
Indeed, it's your responsibility to find all the files and directories your app creates. I think it's hard to do it exactly right.
And with the application running, it generates new files when you are cleaning the room. So the methods above can provide your user a way to minimize storage usage, but can not really completely remove all data.

How to save application data for use across users in OS X

I have a Mac Java application that needs to persist data across reboots. The data needs to be saved so that any user has access to it. E.g. an SQLite database file that can be used for all users.
It looks like the /Library/Application Support/ folder is supposed to be used for this, but I'm not able to write to it without making my app run as root or changing the permissions of the file to rwxrwxrwx.
What is the proper way to save application-level data on Mac?
The developer documentation covering this is a bit of a large topic:
https://developer.apple.com/library/Mac/referencelibrary/GettingStarted/GS_DataManagement_MacOSX/_index.html#//apple_ref/doc/uid/TP40009046
https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40010672
According to the File System Programming guide you should make a specific subdirectory inside /Library/Application\ Support for your app to store app data common to all users on the system. I'd use reverse domain name notation such as com.yourcompany.yourapp or something else unlikely to collide with another app's use of the common directory for this.
You might also look into using an existing app bundler for OS X such as https://bitbucket.org/infinitekind/appbundler rather than hard code paths to file locations.

application size issue

I'm building a dictionary application and I have a problem right now. My application's is 16MB and when I install it on a phone, Database files copies to the data folder and in the manage apps section I see that my application size is 32MB (my app+data folder).
I don't cheat user, I want to say, my app is 16MB, but when user install it , it become 32MB. Why? this is a negative point and I want to solve it. I want my app uses only 16MB in users phone. just that
How I can fix this? I have to read and write in assets folder directly or there is other solution? this is a problem in low storage size phones. how I can fix this?
I am not sure how your database is structured in terms of whether it is a pre-loaded database wherein you just include you .db file with all the data OR is it something where in you push all your DB content with the app and then at the time of app installation you actually install all you data in the DB.
In case of the latter situation you double the size of your app because you already have data content (in files) which you want to use to populate your database (say 16 mb in this case). Then you use these files to actually create your DB file (which is 16mb again) and this doubles the size of the app.
So what you could do is pre-populate your DB content in a .db file and then just use this file directly as the Db file in your app (this will keep it to 16mb). Follow this tutorial :
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Hope this helps.
Not sure I fully understand your situation.
Do you have a roughly 16MB dictionary, that is packaged inside your app as string constants in your code or some resource file or something (to make it 16MB) and then, when your app installs or first launches, you also write this dictionary into your app's database?
If so, then now you have 2 copies of your dictionary around to make it 32MB.
To solve this, either keep only one copy in your app, or download the dictionary from somewhere to get it into your database rather than storing it as a constant in your app.

Android application allowing users to download online content

I am creating an android application using the 2.2 API. I have created the layout of the app (Design interface) and now i need to populate my application with data.
For example, my application shall allow users of my uni to login and then find lecture (PDFS and POWERPOINT DOCUEMENTS) and be able to view them.
Now i am unsure whether to do this using a database where the files have been pre saved so when the user requires the files it is accessed from the database
OR
whether to have some sort of coding that directly links, say a button 'Lecture 3' to the actual web link of Lecture 3?
We have a Blackboard system which holds/displays all our lecture and labratory material, so i could have a link to the material held in the website?
I've heard of JSON, JQUERY but completely unsure on what they are lol.
I was going to use SQLite as my database, however, refering back to what i said before, i am unsure whether that can hold files (DOC, PPt etc)
Look forward to all your help
Thanks in advance
If you want to make your Application as off line(without internet user can access files) then Take files from server and store those files in Application memory and store that path in local data base.when you want to show those files to user take the path from data base,go to the path location and show files to user.
else download the files directly from server and show those files to user at that time only.

Android application backup and restore?

For the application I'm creating, I'd like users to be able to backup their application data (to an SD card for instance). What I mean by application data is the preferences and SQLite database. I'd also like to make it possible to restore the data.
Is it possible to do this with BackupManager? If yes, can someone give me a simple example.
BackupManager is for saving your data to the cloud. To have something backed up to the SDcard, you could write some kind of a service for your application which does this. All the files/dbs/preferences can be written to a folder.
But, this approach also has a risk if the user formats his SD card or deliberately deletes the folder. You can have no control over that.

Categories