When I run my app from Android Studio and install it on the primary user on a device, I notice that it gets installed on the secondary user as well.
In the first place, why is this happening? The android:requiredForAllUsers flag is false by default, and in any case can only be used by system apps or pre-installed apps.
Or is it the case that this happens only for debug-mode apps installed via Android Studio?
How can I prevent this from happening?
It is critical for my app that it be installed on one user only. I have already read the following documents:
Supporting Multiple Users
Manage multiple users
Neither of those documents has any explanation of whether and how the installation process is affected by the multi-user feature.
There must surely be some manifest or build setting that permits or prevents installation on multiple users. Why isn't it easier to find? And why isn't this question more common on SO?
You don't prevent it, you do what you need to do: in this case it would be defining your run configuration so the app gets only installed where you want, because per default it gets installed everywhere I suppose. You can do this by specifying the flag --user user_id. You can get the id with adb shell pm list users
Reference: Android Studio 2.3.2 Launching the app under a work profile or another user account on the target device will result in a crash
The easiest way is to add the --user current flag to launch configs.
Select Launch Configurations
The under Install Flags, add the flag --user current. This will ensure the app is only installed on the current user and not on any guest acconuts.
For Android Studio 4.2
GoTo Run > Edit Configurations then Check the Install for all users(For both personal and work profile) and uncheck only for personal profile
Related
I want to export a new version of my APPLICATION, and i want to force the user to uninstall and reinstall the app for the new version (for different reasons). Is it possible?
Changing the signature of your app, will do the trick. What happens is that the system will warn the user when installing the new app that this app was found but with a different signature. The user has to uninstall the current app before the new app can be installed.
A more direct way than this does not exist. And there is a chance that many users won't understand why the app does not install. You should try to make your app so that this won't be necessary. Uninstalling the current app will also mean that the users loses it's data.
Another option is to change the package name in the manifest file, but this will mean the user loses all it's app data. Because the app will be installed as totally new app.
It's bad....
Rolf
Change the signature / key of your apk. I have read the this forces a full uninstall on the devices
Screenshot from eclipse.
We can install an app with administrative privilege in android. This is very much possible. When the app is installed an activity appears showing up "If we want to activate the administrative privilege?"
But my doubt here is, I want the app to be installed with administrative privileges without user explicitly clicking on Activate(which appears when app is installed).
Actually in my app, there is no activity and the main class is extending application. With in the onCreate() of it, I gave necessary code for installing it as administrative privilege app. The app is getting installed and its even getting listed in the
select device administrators (Settings->Location & Security-> Select device administrators)
But, it is not checked by default after the install. Can I check that by default during the install.
Hope I was clear enough. Thanks in advance. :)
Can I check that by default during the install.
No, sorry.
I want the app to be installed with administrative privileges without user explicitly clicking on Activate(which appears when app is installed).
That would be a massive security hole.
Some of the applications I have installed on my phone update automatically, I don't even have to click anything. This is the behavior I expect from the application I'm developing myself. Do I have to configure something or will android market take care of this?
This is not a behaviour you can set on the application itself. Each user chooses how the applications he downloads are updated. This is a market setting.
In the latest versions of the market, the default is now set to auto-update, but the user is free to untick the box and decide for manual updates, per application. If you open settings, you can also decide whether it's done on Wi-Fi only or on mobile data as well.
This will be done on all updates except the ones where a permission change occurred. For them, the market will still require a manual update.
Auto update is possible. But you should click app to start it at least.
In the start process, you can send the current version status to server through web service, server will identify the version if there is new version. if yes, a new version apk file will be downloaded, and the most important is how to install a apk file sliently.
Generally, you can run the
pm install -r xxx.apk
the apk will be automatically installed, and your app will be updated.
I'm almost positive you can't force users to update their installed apps, but I think it is the default behaviour of the Android Market.
Am developing one Android application which is using thinkfreeoffice.apk for viewing documents in my application. My requirement is I have to download both my application and thinkfreeoffice apks at a time and also install both these apks at a time.
anybody did this one before?
You cannot literally, unless your application is signed with the system certificate or you are using the SDK/ADB install method from a connected PC, or you find and abuse some security bug. As a security measure, any installation done by a normal application on the phone will require the user to go through the confirmation dialog one app at a time.
What you can do is put check in your application for the one it depends on, and keep complaining/downloading/ACTION_VIEWing the downloaded package upon startup of your app until the user either decides they don't want to use your app or agrees with the system install dialogue for the app you depend on.
I think it's impossible to install multiple applications at the same time, as the user has to confirm installation for each apk.
You could of course make the user install your application first, then ask the user to install the office application after which you use an intent to start the installation or redirect them to the Market.
Similar implementations have been used in applications that use third party barcode scanning or speech recognition.
When I update some applications, I see some show "Manual update". I believe this will force uninstall of old version first and the installs fresh.
1. Is it true?
2. How do I FORCE uninstall of new version (with all preferences etc.), and install the new version fresh?
The manual update isn't going to uninstall your application, then reinstall, what is happening is because the dev has changed a security requirement of the app, the user needs to agree to it again.
So for example, if I developed a word search app with no security requirements, the user agrees to install it and uses it so decides to tick the auto update, or hits update all. My first update is simply adding puzzles - it would update fine.
I now add a feature to read a users SMS and their Contacts and use the internet to send me all the details.
The security privileges of my app have changed - now my app will not be included in the auto update or update all as the user needs to agree to these new security privileges and thus hopefully alerting the user to the outrages nature of the security requirements for this type of app.
Read More Here
If what you are trying to achieve is wiping all users data, then you need to add this to your code as I don't think it is possible to do this as a market update option (I could be wrong as its not something I would normally recommend).
To do it in code, a simple look at the app version code, and if its below X then delete prefs & or DB would do the trick I would have thought.