Android - Use admin policy to configure app preferences remotely on multiple devices - android

I am working on some corporate app for Android which will be installed on all the company owned devices.
We need the company admins to be able to configure some preferences in the app. preferrably remotely using policy or any other method without need to hardcode the preferences changes in the code and redeploy it on all devices all over again.
Do android API has such feature?
I've looked into the Device administration (which should be deprecated soon) but it doesn't seems to be what I am searching for.
I want to be able to remotly setup keys in the sharedPreferences just like a PreferenceActivity would do.
We could also build some private REST server to call it from the app in order to retrieve the preferences we want and programmatically setup them.. but I'll be happy to find simpler out-of-box feature to do that without the need to maintain a server.
Any Idea?
Thank you in advance

Related

Can Android or iOS applications determine if their host device is configured by a Mobile Device Management (MDM) solution?

I am working on a mobile application and would like to inform users when an update is available, if that user's device is not managed by an MDM. If the device is MDM-configured, we don't expect the end user will be able to update the app without the configuration being changed by the administrator. To provide a better user experience, we want to provide relevant information. To do this, I'd like ideas to determine if an app (written in Kotlin/Swift) can poll for this type of information.
I saw some things in the Android Docs about checking for Restrictions Providers, but I think this is the wrong avenue. I'm not very familiar with this, so correct me if I'm wrong.

Monitoring data flow between Android Framework and App

I need to know how we detect the event of an Android app making a request to the Android Framework for sensor data. Also, if it is possible the Android Framework responding to the said request. I am trying to create a service that will be able to log this information for security or privacy purposes. Is this possible? What is the ideal way to go about it? If it is not possible, do we know why not? Is there an alternative solution?
I am trying to create a service that will be able to log this information for security or privacy purposes
I fail to see how spying on application activity regarding sensors will be "for security or privacy purposes".
Is this possible?
You are welcome to build your own ROM mod that has a revised version of Android, one that contains security vulnerabilities that would allow an app to monitor the sensor requests and responses between another app and the OS. Or, your ROM mod can do the logging directly, through an altered version of the framework.
Otherwise, no, this is not possible from an ordinary SDK application. I do not have enough experience with root-requiring frameworks like Xposed to know whether this is possible using them, though, again, that would require root.

SharedPreferences sync

I desire the application state synchronized across the various devices that Users own phone and tablet. I want a way to automatically, or by a button for example, synchronize Android application settings (int and strings saved on SharedPreferences) with a Google account or APIs or automatic sync (in Google account Settings) but i'm very confused..
I see App Engine, GCM and "cloudendpoints"
So..what is the best solution to automatically sync the Preferences? Any example or guide? I think that the solution is easy but hard to find!
The solution is not easy. AppEngine can handle the web server part easily in many ways. The Android side will be harder, most particularly making it automatic. Android probably stops preferences being changed arbitrarily by external data to avoid security vulnerabilities.
Approach the problem from the Android end by first updating your preferences with your own App, then try it from your own Service, and then add AppEngine client software to your service. You will discover what you need to know along the way.

Local testing for Android App using Cloud Endpoints for Google App Engine

I am developing an Android app that uses Google Cloud Endpoints on Google App Engine (in Python) for its backend. The Android app authorizes the user using Google Play Services on the Android device, and it all works fantastically.
However, now that I have actual users, I'd like to be able to test this all locally before deploying any app engine API changes to production, and I haven't figured out how to have the Android app talk to my local development server anywhere. The testing recommendations suggest that I just do some manual tinkering with API Explorer, but as I'm using the Endpoints Proto Datastore for my API, which makes the Android development easy, it also makes the API Explorer basically useless, since the calls I need to make are far more complicated than what I can generate by hand.
One answer to this question suggests that there is a way to point the Android client at the local server, but while I can use the --host argument to have the dev_appserver's default server listen on something other than localhost, I can't seem to find a way to do the same for the API server. And even if I could do that, it might only be the first step to a full end-to-end local testing setup for my Android app.
Can someone post more details on how I might do this, or short of that, please enlighten me on the best practices for testing Android apps that use Google Cloud Endpoints on App Engine? Thanks in advance for any answers.
Alright, finally got it working, thanks for the tips, Dan! Here are the remaining details that would have saved me a few hours - hopefully this is helpful to someone else.
1) As I expected and mentioned earlier, dev_appserver.py needs to be run with --host=0.0.0.0 so that it can listen on the local network.
2) In order to properly parse the ID token to make the user authentication work, you need to have the PyCrypto library installed - it is not installed by default, so just having it in your app.yaml isn't enough. I found the binaries for Windows here.
3) Then, in my generated Tictactoe.java-equivalent class, I had to change the DEFAULT_ROOT_URL to be http://<my-local-machine>:8080/_ah/api/ (which is where my local machine is running), so that requests went to the local network. Alternatively (and perhaps less invasively), you can use builder.setRootUrl to the same address from wherever you initialize your builder. This way you don't muck with your generated classes.
4) I also had to make the change Dan mentioned described here.
After doing those four things, everything seems to be working now and I can test my app locally - hooray!
In the local environment, the dev_appserver is the API server. If you've configured it so that it's accessible from machines other than localhost (i.e. another machine/device on the network) API requests should be accessible as well.
However, there's currently an issue with the local server and gzipped requests. Until that's fixed you'll need to disable gzipping within the client library in your Android app (see this post).

MDM workflow in Android

Can any one help me out how to do MDM Integration in Android from client and server prespective?
I want to do an enterprise application which having lock and wipe functionality. I have no any clue of workflow of MDM in Android.
Thanks.
Android Device Admin API will do both things what you want to do (lock/wipe device and even more). An example is given and also you can find this complete source code in your Android SDK directory.
Now as client server perspective:
You have to implement your task (lock and wipe) in your android application (in client, i.e. known as agent). Now your application should be capable to communicate with your server or vice-verse.
I am 100% agree with adamk as he said "Remote controlling your application remains exclusively your responsibility - the Android framework does not provide (or enforce) any solution for that."
And Android gives your this feature too, as adamk said to use C2DM, he was right but now C2DM is deprecated, and GCM has been introduced, “a service that helps developers send data from servers to their Android applications on Android devices.” The service can send a message of up to 4 kb to an application on an Android device, most often to tell the application to retrieve a larger set of data. GCM will now handle all queueing and delivery for messages to Android applications.
You should read how to use GCM, and you can find sample code too. Download GCM Android Library from SDK Manager
and check android-sdk/extras/google/GCM directory
After establishing successful communication between your agent and server, evaluate msg in agent sent by server and perform desire action (lock/ wipe). This is again up to you how you define your message payload and how you handle those payloads in agent application.
Here is an article about Android MDM.
Happy Coding :)
You can use DeviceAdmin to gain privileges for managing the Lock preferences and performing device wipe (among other stuff).
(The user must add your app as a device administrator beforehand)
Remote controlling your application remains exclusively your responsibility - the Android framework does not provide (or enforce) any solution for that.
You may want to consider using Google's C2DM API, which is a convenient push mechanism.
As mentioned in the above answer, DeviceAdmin API can help. If you are using an Android device, you might know about the Android Device Manager (the web-based version) which allows you to manage your device. Basically, you can track, locate, lock, and wipe your device, some of the basic features of an MDM solution. So, in coding (though I am not a coding expert), you need to get access to the Device Manager (I guess, using some listener codes, or notification access).
Apart from this, MDM allows creating policies and groups of users (which would be a part of the coding in the app itself), then pushing the command over the internet (or OTA) to the connected device.
MDM also allows managing Apps and Data on the device, for which, you need the app to get access to the internal as well as external device storage.
Hope this helps. Good luck creating your MDM software

Categories

Resources