android - how to create multiple user profile in jelly bean by code? - android

In Jelly beans now you can add multiple user profile, i want this feature in my app but want to create/add multiple profile programmatically.
Is it possible?
Help me to get out of this.

Yes, this is possible, provided the device is rooted, and running only 4.1. Even then, it is an unofficial method that relies on executing terminal commands in a root shell.
I wrote the User Management app when this feature was originally discovered, and then later open sourced it in the interests of helping others. You can find the code on GitHub here.
Other than executing commands in a root shell, there is no method of achieving this AFAIK. The Android SDK does not provide any APIs for creating additional users.

Related

How can I programmatically install apps on android from a system app without being device owner?

I have tried to find a solution on this by searching the net for quite some time. If there is a working solution to my question on stackoverflow, it would be nice if someone points me to it.
So problem is very specific:
I like to implement an app updater that installs apps without any further user interaction as soon as the user has started the setup process.
This would something like the way it is done by GMS (Play Store).
Constraints:
The implementation has to work on devices back to Android 6.
I am an Android system developer and I want to integrate an update for our own hardware.
I have an existing app that is running as system app in the system context.
The app cannot be device owner, as this will block MDM support that customers might want.
I can access hidden APIs of the android system.
The solution may not require root access to the device and shall not use any hacks like calling pm install.
The device has to pass the Google approval what restricts everything to the use of the system APIs provided by Android. I think that this is the reason, why it is so hard to find a proper solution or pointer to a code sample for this.
Has anyone worked on this? Are there apps (like free app-stores) that implement something like this?
Edit: I have found a partial response to my question here: https://stackoverflow.com/a/5805299/6289291
The major difference is, that when building from within the AOSP tree, reflections are of course not required and there are some problems I encountered that I will try to summarize in a response to this question as soon as I have resolved those in a proper way.

List of valid users on Android system

I am debugging an application on a rooted B&N Nook Glowlight. The app runs fine on a rooted B&N Nook SimpleTouch but crashes on the Glowlight.
It seems that the paths in use on the Glowlight have the wrong users assigned to them. How can I get a list of valid users on Android? On a standard *NIX I would just cat /etc/passwd but that file does not exist on this Android system.
I suspect that both devices are Android 2.1. If there is a command that will tell me this for sure, please let me know. The both devices are running Linux kernel 2.6.29 (armv71).
Edit: Note that I mean a list of system users, such as root, and app_12. This is how Unix traditionally handles separation of privileges, and I think is where the problem lies. I don't mean a list of Human user accounts. I'm looking for a CLI command, not an Android API call.
That's available via AccountManager.getAccounts(), if your app has the required permissions to view accounts at all.
From your description, it's possible your app is hardcoding a path that is correct for old Android versions, rather than using a newer, more correct way to get a file's path via Context.getFilesDir(). See http://developer.android.com/training/basics/data-storage/files.html .

how to hide other application from my application from list of apps android

Could anybody please help me find a way to hide other application from my application. I'm retrieving a list of apps installed with check boxes and when I check some apps, those should be hidden from the application list in emulator. I've searched in google but I couldn't find it. I am waiting for help....
Thanks,
You could create a custom launcher, in which you control which apps are shown (within your own launcher) by creating a list of apps within your own launcher.
You will not be able to hide apps from the general system. Android uses the Role\Group security model from Linux, and you (an app running within the Android OS) wouldn't have the security permissions to hide apps from the user on a system level - to have that access right, you would need to be root.
Bottom line, you cannot create an app to hide other apps from the Android System (or the user). This is due to security restrictions (which make sense - malicious apps would be able to hide themselves from the user, which would be a bad thing).
If you wanted to do this in the emulator - you could actually make the changes in the source code of Android (which you can download and modify to your pleasure). This would work within an emulator only (you wouldn't be able to install that on a real phone without hacking, or rooting).
You cannot do that without hacking platform (or rooting it).

ANDROID: is it possible to replace library file of Android OS through an application(.apk)?

We have made some changes in the "skia" library of Android OS (Froyo) and it works well in emulator.
It also worked when we pushed (replaced) the corresponding .so files in to a device.
Now we want to provide this service to the end users. Is it possible to make an application(apk) that people install to perform this task?
If not possible, then what is the best way we can provide the service to others?
If you have created a useful functionality that will be useful for a range of users you can submit your patch to Google code review (you can read how to do this here)
You cannot, unfortunately, unless
you are the device manufacturer (or Google)
you are developing a replacement system image, or target only rooted devices
I believe this would only be possible if the app has root access or you distributed a ROM to your users yourselves.

Installing apk without user input

I have been searching the internet wildly for an answer to this question.
We are creating custom android app for internal use only and we would be installing that on custom andoid devices. We would like to have full control of the device through the app. The end user of this device is not meant to use anything other than the app on this device. I have sealed out all the possibilities of getting out of the app except this one possibility where the program tries to update itself and asks for user permission.
Let me repeat again, This app is not meant to be put on market, only for use with custom devices designed for specific purpose. So security is not an issue here.
The device is rooted and we have done a lot of alterations with it. But I cant quite figure out how to make this update work.
If you have any ideas/solution please share it with me. I can do anything with my device, (even dig a hole in it if required :P) as they would be custom made, and would be packaged with us before going out. Just have to make it work.
If you are talking about internally installing the APK with like an update application specifically designed to update your other application which is not managed by Google Play you may want to look into this. So between xjaphx's answer and the link I just shared you will be able to install and maintain updates.
This is as simple as how it works.
Pre-condition:
Get devices rooted
Prepare Android development environment (Android SDK, platforms-tools)
A cable to connect PC and devices.
Steps:
Open command-line if Windows or shell if Linux
type: "adb push YourApp.apk /system/app"
That's done for installation of the app. Reboot and check whether your app works or not.

Categories

Resources