android user vs app config/preference files -- I'm confused - android

The docs talk about app-specific files and others like media files. Android is a multi-user environment, right?? It seems that in some instances at least, multiple users on a device all use the same instance of the app (google apps for instance). The Docs talk about "Files meant for your app's use only" i.e. app-preferences. How does android deal with user preferences for an app? Are most apps just single-user? In the case of a tablet for instance, does each user in the family have to install their own instance of an app?

Android is a multi-user environment, right?
Yes.
It seems that in some instances at least, multiple users on a device all use the same instance of the app (google apps for instance)
If you mean the same installed APK (or APK set), then yes.
How does android deal with user preferences for an app?
If you mean SharedPreferences, they are stored on internal storage. Each user gets their own view of internal storage, independent from that of any other registered user on the device. So, if there are 1,337 users, and each have used the app, there will be 1,337 SharedPreferences files, one per user.
In the case of a tablet for instance, does each user in the family have to install their own instance of an app?
No. However, depending on circumstances, some users may not have access to all of the installed apps (e.g., restricted profiles).

Related

Android build release | Is there any specific way to allow the android app download for some selected mobile phones only?

I am creating an app for store management that will be used in retail stores for managing user and other store related activities like redeeming coupons / points. The requirement is to install this app on some specific devices only provided by stores. I am listing use case below for better understanding:
There are two Samsung M51 devices, let's say SM001 and SM002 so the app should only work on SM001 not on SM002.
There may be below ways(theoretical) to achieve this:
It will not install on restricted devices, but it does not seem feasible as we need a mechanism that puts a check on deviceID(Some device specific identifier) before installing it.
It can be installed on any device but when the user opens it then it will check with the list of allowed deviceIDs and then show an error.
from above two assumptions another question arises that what will be the unique identifier for a device and that never changes?

Is it possible to have multiple applications providing a preferences entity in Android?

My company provides a number of Android applications that all need a central preferences entity. For example "user_id" which is an integer that would be the same across all applications. Now the user can have 1 or any number of my company's applications installed in any order.
What we've been doing is having a central file in the sdcard/Android/data directory. But this can be cumbersome as this external directory may need to be removed at uninstall time. I would like to provide a solution where uninstalling this external directory would not be necessary.
My first choice is a ContentProvider. But where we can have 1 or more applications installed in any order, I'm not sure this is feasible. And ALSO what would happen if you installed application 'A' which has a content provider, and then installed application 'B' which I guess would use that content provider provided by 'A', and after that user uninstalls application 'A'?
Being that I'm not an expert at content providers in Android, is this the way to go? Would there be another way I could do this without using an external file?
Thanks
/Loren

Using Saved Game Service for non-game apps

I have an android (non-game) app that I want to implement cloud backup for. I've looked at the Backup API but found it limited as the actual backup and restore backend processes are controlled by the phone manufacture and Google. I also want to allow the user to manually backup and restore when they want.
There is the new Google Play Games Saved Game service which offers what I'm looking for but my app is not a game.
Has anyone implemented the Saved Game service for a non-game app and can offer some advice on it's suitability? Otherwise, does anyone know whether Google will allow this approach (using the game service for non-game app)?
Thanks.
It sounds like a better solution would be to use the Google Drive API. Specifically, the ability to store application data. From the developer doc:
The 'Application Data folder' is a special folder that is only
accessible by your application. Its content is hidden from the user,
and from other apps. Despite being hidden from the user, the
Application Data folder is stored on the user's Drive and therefore
uses the user's Drive storage quota. The Application Data folder can
be used to store configuration files, saved games data, or any other
types of files that the user should not tamper with.
See: https://developers.google.com/drive/web/appdata

is it possible to secure android apk to specific tablet

I have developed an android application and I want to distribute the application on tablet. This means my client will not require to download the apk as it comes with tablet.
This software is for training purpose i.e. video and other documents.
I don't want the apk to be extracted, in another words, I would like to bound the apk to run a specific device.
In summary, my aim is to deliver the apk with tablet device (and I want to avoid extraction of the apk).
Is this achievable?
If the user gains root access on the tablet, you cannot do anything to avoid this.
However without root access, if the apk comes shipped with the tablet, there is no way that someone can send it to other tablet/phones.
If you want to add further security, you can do a simple offline authentication, when the app starts.
eg
1) on first install, prompt user(who will be you, since you have to install the app before giving the tablet to an employee - right? if I understood correctly your problem) to give a user and a pass.
2) Then save credentials in phone(using preferences), and later on(step 3) match them with some hardcoded ones in your apps code.
3) Each time app starts, do a quick check of preferences credentials, and if it doesn't match, close the application.
While this isn't very good way of securing your app, you may come up with a more reliable solution. If tablets have internet access all the time, you can add a proper username/password authentication, but you have to create some sort of accounts to all of your users.
Did you know something about Signed-apk?? First of all create your account on play-store and get the keystore for your project. then create a signed-apk using keystore and password given.

Restricting the sharing of android application apk

I am new to android. I have a application to make where in i have to restrict the application's .apk file getting shared by the user to the other phone android phone holders.
Its like if i keep my .apk file in my own website then i want that the user can download the .apk from my website the cannot share the same .apk with some other person. I want to restrict the sharing of the apk to multiple phones. Everytime a user wants to install the app he/she has to install if from the play or through my website but the .apk shared cannot to installed.
Also i wanted to ask if we can distinguish whether the app is distributed and installed or installed from the play.
So can you please tell me some way out for doing this?
Thanks in advance
1) You can not stop users to forward your apk if they have apk in storage, what you can do is to delete it after your app installed(you should search it via some api and if found delete it), Limitation :- apk can be shared before installing.
and there are tools/apps exist in market which claim to convert installed app into apk, and then it can be forwarded to other device.
Similar question on Forward locking of apk
2) Though you can not stop user to forwarding of your apk, But can stop other user to use it, if they receive this app from other sources then your web, as I myself did it earlier, by client server communication where a key is getting generated on Server based on mobile IMEI, so this app is going to be activated for particular mobile based on IMEI number. hence if other users try to use it you can check if this IMEI is register or not, and take action accordingly.
Unless a user uses a USB cable/Astro file manager like utility, on a ROOTED phone, he wont be able to extract the apk out and transfer to another phone. And the percentage of users knowing how to root a device is very low. So this issue should not arise.
Even if it is assumed a user can very easily extract an apk (which a general user wont be able to), the problem whittles down to generating a unique identifier string on each apk, and then packing it within this apk. Now when it is extracted and installed on another device the app can check with identifier and close after displaying a "no-copying" message.
Note that the identifier should be tied to a unique string, say the device IMSI number, or phone number, or a combination of both. And this string needs to be written to a file that is transferred over when apk is copied, I would recommend a properties file in assets folder within the apk for this. Hope this helps
if somehow we manage to attach the app data folder with that APK.file of that app, then our problem will rectified easily. like if you send the folder of the app to someone then app will automatically loads your data to the other user. if he can't separate that two things (apk. file of APP and data folder of the APP).
Hope it will help you...and me too..

Categories

Resources