I have an Android app for which I wanted in COSU mode. I have successfully activated my device into Device Administrator mode.
Now I want the data of the usage of other apps used daily. For eg: Facebook, etc. I need the data to monitor usage of other apps. How can I achieve this programmatically?
TIA.
Not 100% sure what you are looking for, but do you mean something like UsageStatsManager
(documentation)?
Using Android library class TrafficStats, you can find how much bytes received/sent across mobile networks since the last boot.
Also, you can find how much of bytes transmitted/received by the given UID since device boot. and you can find any package UID with RunningAppProcessInfo.
Here is a detailed answer on this here and an article on Creating a network monitor
Related
I'm looking to change notifications settings for a single application remotely.
I've got the device enrolled into a MDM.
Android device running 6.01.
I can remotely deploy / update apps etc...
However, I want to disable notifications for this. I can't seem to find a hands off approach to doing this.
I'd have to break out of the end user lock down application.
Go to settings
apps
find app
notifications
block
restart device.
Is there a way I can remotely make this change?
Thanks in advance.
you might have more luck asking your MDM provider but there is no way to achieve this from the platform. This is not a requirement I have heard before, typically enterprise devices are configured to block all notifications or allow all. If you do not plan on using the application in question you could likely disable the entire app remotely but being able to disable notifications for that specific app remotely is not currently possible.
The MDM provider said it was an OS behavior and needs to be suppressed from the OS. I got it sorted by disabling them the manual way.
I've just found an app that allows to disable Samsung apps without root, and in the background:
https://play.google.com/store/apps/details?id=com.hecorat.packagedisabler
And also this free one:
https://play.google.com/store/apps/details?id=com.ospolice.packagedisabler
How could this be? It doesn't even show a system-type alertDialog to ask the user if it's ok to disable the app. Did they find a flaw that allows doing so?
Is it only for Some Samsung apps? What about other apps and other companies? Is is possible there too?
Could the same mechanism be used for other operations? Like enabling apps?
I currently don't have a Samsung device, so I can't even check this app.
You can hide or unhide the apps provided you make your app as device owner with the api setApplicationHidden of DevicePolicyManager
Your app needs to be the device owner of the device. In order to become a device owner, you either need to do an NFC configuration or adb command shell. You can find a very well written blog by Florent here.
However, there is a new method of getting your application to become a device owner starting with Android Marshmallow. With a lot of limitations though. You have to be an EMM provider and your client has to have a google business or edu licensing for this to work.
There is no application on the google play store that allows your app to become device admin. As a device owner you have a lot of things you can control on the device and hence, I believe Google may not want to provide this kind of control without proper safeguards.
With regards to Samsung Devices, they provide their knox sdk as mentioned with other answers here which gives you access to certain APIs that are not allowed via stock Android.
I'm currently doing some research about my project, a smartphone tracking native application, and I have four questions. Links to any material I can read up will be greatly appreciated, and the most useful/comprehensive response will be accepted.
The primary target smartphones are the Android, Blackberry and iPhone models.
For starters I found out here Uniquely Identify an Android Handset that IMEI can be used to uniquely identify Androids but I think I once read that it can be faked. I don't know about the iPhone and Blackberry.
What's the most reliable way to uniquely identify the smartphone device, if any? Can MAC addresses work or is it possible to spoof that? Can IMEIs truly be faked?
Is it possible to "lock" the device with a custom error message remotely via its unique identification, once the device is reported as stolen? This lock state will remain on the phone even when disconnected from the network, until it is reconnected to the network and unlocked remotely once again.
Assuming such a remote phone lock is possible, can such be reversible by the thief? The native app will run in stealth mode so that it cannot be uninstalled.
Can a cross-platform solution work in this case, or will I have to develop various native apps per platform?
EDIT:
Some more context. As Till rightly said, Apple's "Find my Phone" does this exact thing already (I am just finding out about it, but it looks like a perfect fit already). The user who is choosing to install the app is informed that the phone will be uniquely identified if they do install the app. As for locking the device, "Find my Phone" does it (I gather). Now I need to know how that might be possible on the two other platforms.
With regards the iPhone side of things:
You aren't allowed to uniquely identify the iPhone like that. Apple have just forbidden it unless you get the user's permission first. So if they refuse you permission, your app won't function and you'll need to find another way.
No, you can't do that.
See 2. Also you can't run an app in "stealth mode"
See 2.
Only the network operators can talk to the handsets on an IMEI level. The IMEI number IS the MAC address of GSM networks. However, you can't access that unless you have control of the network. Sure you can get the IMEI from the user, but you can't use that to locate the phone. On CDMA networks this address is called the MEID number.
But there are other ways:
You can get location data on either platform with the users' permission. This is the way you should think about developing your application. You'll want to assign a UUID to a user once they download and install your application on their phones. You can then have the phones report to a server every so often (heartbeat). As long as the phone is powered on and connected to a network, the user would be able to locate the phone.
You can also get the phones IP address on the network, among other things -- such as contacts, messages, files, cache data etc..
On Android it's pretty easy to implement this kind of functionality as a service that could would only be visible on the packages page. Further, if you have root access, you can write whatever kind of rootkit you want such that it hides itself from the system. Same with a jailbroken iPhone. I am not as knowledgeabe about iPhone services though.
Either way, the only cross platform compatibility you'd be able to exploit would be perhaps the way data is sent and received from the server. You could use some standard such as JSON to send and receive data (and hence the same server). Although, both platforms have JSON and Apache libraries, the other parts of the apps or services themselves will need to be completely and dependently developed for each platform (UI, Internal Content Handeling, Syscalls, Permissions, etc).
You can remotely lock, wipe, factory reset, etc. Android devices using the security and device administration Android system interface. This still requires the user to grant permission and it asks them an a more.. obnoxious.. way so that they know what exactly they are agreeing to when they give an app device administration permission. If you ever use an exchange server for business or school, it's likely you'll run into this.
I am unsure about remote iPhone device administration on a jailed system.
If you really want something that can't be removed lest you do a factory reset, you'll need to know a thing or two about Unix programming, and a lot about the operating systems that their respective SDK's don't (and probably shouldn't) tell you. You'll need to be comfortable poking around sources and even reverse engineering if called for. If you're still interested, you'll want to hang around the circles that work on custom phone firmware and software for the iPhone, and Android (and Blackberry). I would start with Android. It's probably the easiest since the sources for the AOSP are easily and legally available.
Our company giving out Android devices to drivers. Our application should never use more then 1Gb by nature of communications we do.
However, some drivers managed to use about 10Gb of data :)
So, I wonder:
Is there any way to track data usage of our app vs other apps so we can notify users and office workers?
Is there any way to DISABLE data access from any app other then ours?
Take a look at TrafficStats, with help of that you can get the amount of data sent/received. And you can get the data by UIDs to see where it was used.
Is there any way to DISABLE data access from any app other then ours?
If rooting the devices is an option then you can use the free Application DroidWall This application makes use of the iptables rules of linux to let you allow / disallow applications from using network data.
Is there any way to track data usage of our app vs other apps so we can notify users and office workers?
As H9kDroid indicates, use TrafficStats. Here is a sample application that takes an initial snapshot of the consumed bandwidth, then takes another one when you tap a button, displaying the overall difference on-screen and the per-UID difference in LogCat. Note that not all devices support the per-UID stuff (e.g., not the Ice Cream Sandwich emulator).
Is there any way to DISABLE data access from any app other then ours?
No, sorry. Eventually, the combination of device admin rules and the new traffic management stuff in Ice Cream Sandwich's Settings app might allow for this, but not presently. Or, you could create custom firmware.
How would you find out what kind of information an Android app is sending back to the "mothership"? For example, if an app is sending your ID, gender, etc. to advertisers.
Is there a way to do this in an Android app? Or would it have to be done via a packet sniffer over Wi-Fi?
Root your device.
Find a copy of tcpdump for Android
Launch tcpdump, capture a dump file.
Analyze offline with something like Wireshark.
You might check Android packet sniffer.
Unfortunatelly, you have to be root on your phone, and have the "su" command installed.
The TaintDroid project does exactly this. Installing it isn't as simple as just installing an app (of course), but they provide pretty detailed instructions. This tool has been used for exactly the purpose of detecting what kind of information an app is accessing and sending to some external source. They also provide the source code if you want to modify it for particular purposes.
The permissions tell you what data it is accessing, for example "Phone State" means getting the phones ID, Coarse or Fine Location is a permission to, so for network or gps location you need to be made aware.
Other data is behind other permissions. So if they aren't cheating you can somewhat figure out what they are using.