Check android device possible to install? - android

I have a question about installation of an app on android device. I have an application that requires that a user installs another application. That required app may be different at different times, but sometimes user device cannot install this required app for some reason. I want to check programmatically that a user can or cannot install a required app. Is it possible??

As mentioned in the comments, you can check whether another application is already installed, but there's no simply way to determine whether another application is technically capable of being installed.
This determination is based on the AndroidManifest.xml file of the other application (at least), and possibly some internal checks that occur within other application's code. You would need to know the requirements for the other application (minimum SDK version, supported screen sizes, camera and other hardware requirements, etc.) and check for them yourself.

Related

Find installed android applications for a different user

We have an Enterprise Android application that runs under the work profile. We would like to check to see if an application is installed under the "normal" user profile on the device.
Just wondering if there is anyway way to do this at all? The PackageManager.getPackageInfo(packageName) only returns applications that are installed under the work profile (even setting the tag in the manifest file).
Is this possible at all?

How generous are privacy-related permissions on Android and iOS?

I have a few questions about privacy protection on Android and iOS. I've looked at Android documentation, but as a beginner I am not sure if I understand correctly (I put my understanding in square brackets). Especially, not finding the obvious way does not mean there are no workarounds to get the same information. Therefore, could any developer give advice on the following questions? Answers about iOS are also appreciated.
Can the user allow an app to use the microphone/camera/location only once (i.e. the system should always ask the user every time this app needs access)? [No, the "never ask again" option in the dialog is not meant for this purpose.]
If microphone/camera/location permission is given to an app, can it access these while in background? [Yes.]
Is it possible for an app (running in foreground) to obtain the list of other apps currently running or installed on the device? [Yes for installed ones, not sure about currently running ones.]
Can an app in background know what other apps are currently running and which one is in foreground? Can it possibly figure out whether the user is using the phone? [Not sure.]
Can an app (apart from the OS itself) take screenshots? [No.]
With regards to Android:
Can the user allow an app to use the microphone/camera/location only once (i.e. the system should always ask the user every time this app needs access)?
Not directly. They could have this effect by granting the permission, using the app, then going into Settings and revoking the permission. I suspect that few people do this. Offering a one-time-use-only option directly in the runtime permission dialog is an interesting option, though I suspect that Google would pass on it as making the flow too complicated.
If microphone/camera/location permission is given to an app, can it access these while in background?
Locations, yes, though with some limits on Android 8.0+ (for power savings). Microphone/camera, yes, though reportedly no longer starting with Android P.
Is it possible for an app (running in foreground) to obtain the list of other apps currently running or installed on the device?
Installed, yes. Running, not really, on newer versions of Android.
Can an app in background know what other apps are currently running
See above.
and which one is in foreground?
Not really, on newer versions of Android.
Can it possibly figure out whether the user is using the phone?
You can tell if the screen is on. IMHO, "whether the user is using the phone" has lots of possible definitions.
Can an app (apart from the OS itself) take screenshots?
I do not know how you are drawing the distinction here. An app can request screenshots and screen recordings through the media projection APIs on Android 5.0+, though this involves user acceptance. This acceptance is a one-time-per-process thing, so the user would have to grant access again in the future (akin to what you were seeking for microphone/camera/location).

Android app doesn't look eligible for cloning

I am trying to clone my app for using multi-user accounts for the same app.
This is inbuilt feature for many manufacturer now. Some apps also support in doing so, like Cloneit, Parallel etc.
My issue is my app doesn't appear in the lists of applications that can be cloned. Neither in the manufacturer option nor with other cloning apps.
Is there any setting I am missing in my app? for it to be eligible for cloning
Thanks
----UPDATE----
My apologies, I did not read your question thorough enough. I thought you were asking about supporting mult-user accounts. That was not your question.
So let's chat a bit further, but I'll leave the multi-user stuff below if it helps anyone else.
So first of all, when you make an app, it is available to all users on the device unless you hide it from some users. That is default behavior as long as the device supports multiple users.
Parallels, Cloneit and other apps are doing something completely different though. They are "not using multi account" they are making you a virtual environment that runs in parallel to your active one, allowing you to make exact copies of the app, but in a whole new active directory.
---QUICK LESSON---
See the way Android works is each application has a package ID, this
basically it's unique username for your phone.
Android has various user-groups to access areas of the device,
folders, and administrative settings. We have come to know these
user-groups as "Permissions".
When you install an app, it will request to be added to each
respective Linux User Group (permission) so that it has the right and
ability to touch the respective ares of the Android OS and file
system. Post-Marshmallow, you have to be added to the permission (aka
user-groups) at run-time by requesting in code and allowing the OS to
get user feedback to add you to the group.
Parallels, basically clones all of this behavior and makes a new environment for apps to be installed again, but in a different space, so user-groups, permissions etc, would have to be reobtained and the new space which is just normal coding practice, nothing unique about that statement.
However, Parallels indexing process of finding apps that it can clone is based on it's current environment, settings, and support capabilities. So if you compiled your application with settings, SDK, or anything that is not currently supported in the parallel environment, then your app would not be available for install.
Think of it like this. If you go to the App store from a phone that is running OS 6.0, you would not see apps that are written for 7.0 or 8.0 as they are not compatible and therefore, they don't show up in the list to download and install.
Parallels, does not necessarily clone your exact OS, it may have it's own packaged OS that it spins up. I can't speak to how/what Parallels or any other device creates their virtual environments for installation and cloning.
So all of that to say, check your compile SDK, check your target SDK, and check your minimum support. There is likely something in your compiling settings that is not compatible with Parallels virtual environment.
Start by creating a dummy app, and target something older, and make it more compatible. See if it shows up. If it does, then move up your SDk target and other versions until you see that it no longer shows up, then you will know which values affects it and why.
Hope that helps, please do update us on what you find in terms of support in Parallels.
OLD DISCUSSION, LEFT FOR SHARED KNOWLEDGE, NOT RELATED TO ABOVE
---MULTI-USER DISCUSSION for OEM App Development---
As of 5.0 Android, multi-user is disabled by default so the manufacturer must modify.
frameworks/base/core/res/res/values/config.xml:
<!-- Maximum number of supported users -->
<integer name="config_multiuserMaximumUsers">1</integer>
<!-- Whether Multiuser UI should be shown -->
<bool name="config_enableMultiUserUI">false</bool>
https://source.android.com/devices/tech/admin/multi-user
to allow the device to support multi-users.
As for using the Cloning apps, they each have their own methods of indexing apps, and handling this cloning process. Some may only index on app startup, others may index at install, so I would say you should confirm the behaviors of the cloning app you wish to play with.
Now if you are certain the device you are using supports multi-user then let's continue.
If you are a system level app intending on managing users, you will need permissions to do so as shown below:
<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"
android:protectionLevel="signatureOrSystem"/>
Here is a helpful link for setting up and handling switching between users in your application.
http://light-green-android.blogspot.com/2015/11/talking-between-user-android-profiles.html
https://source.android.com/devices/tech/admin/multiuser-apps
But again, this is only if you are building a system level app for an OEM.
Give latest appcloner a try. I'm pretty sure it allows you to do this thing. It can clone almost any app you like.

Release application with someone's package name

My question may look strange but I'll try to explain somehow. Let's imagine there is an Android device with software that adjusts some settings based on application package name - it's a real-life scenario. This software may provide better performance for listed applications and there is no way to add my application to that list. What I'm capable of doing is to release my application under one of listed package names (not to Google Play, just provide APK on GitHub so that anyone who wants to use it will install it manually). And there comes my question:
is it legal to use some company's existing package name for my own application? Is it protected legally? My app is free & open source application.
Just to be clear: I'm not doing this to impersonate "real" application with bad intentions. I just want my application to use full range of device capabilities... And download page will state it clearly & visibly :)
In other words: can I release app with package name e.g. com.google.android.talk? I know that it won't override existing app if someone has it installed etc. (it's not my goal to override some application). I'm just talking about such possibility and legality.
This is totally legal, as you can use whatever String you want for your app/package name.
However, just doing this will most probably be not enough to "impersonate" the other app, as this would be a serious security flaw. First of all, there can never be two apps with the same package name installed.
If the app you speak about is created by a "serious" developer, say Google or one of the OEMs, it will check both package and signature of the app and will therefore know your app is not the same as the replaced app.
Also, when the user tries to install your app, a package conflict will happen, followed by the signature conflict. There are two scenarios here:
If the app you are replacing is a standard app, the user will be able to install your app from adb, but only after thay accept to completely wipe the data of the original app. You have probably seen this dialog while developing stuff.
If the app is provided by the OEM and has system permissions, the installation will simply fail, with no possibility to "overwrite" the app. This can be dodged by having the devices rooted, replacing the .apk file in the system directory and restarting the phone.
Please mind that none of the above will work by just uploading the .apk to the phone. This needs to be done from adb. On-phone installer will just fail.

Android - different OS, different versions

My question is the following: can I have one application on the market, but when the user downloads it, depending on what OS the user is running, she downloads different file - one file for 2.2, other for 2.1, third for 1.5, etc?
No, that is not possible. However, you can have your application respond differently to whatever OS level the device is running. Use android.os.Build to find out what version you are on, then use reflection or conditional class loading to route your behavior accordingly.
OR you can create different apps for each target OS version, name their packages differently (for instance com.example.16, com.example.20 com.example.21) and in each Android.xml specify minimum and maximum API level to the one you target. So the 2.1 version will have both mini and max API level set to 7. Then you publish all of them to the market under the same name.
When a user with an Android 2.1 searches for your app he will see only the one with the package name com.example.21 thus fixing your problem.
It seems appropriate to note that Swype's approach to problems like this is to download an "Installer" application first. (It's not from the Market, but it could just as well be)
Swype's installer uses a login and password to contact a Swype server, and download and install the appropriate .apk for your Android device.
Generally this approach is impractical to a smaller developer, as it requires server setup, etc. But it's another possibility that I thought I should mention.

Categories

Resources