How do I open an app Based on an external Event - android

Use case: I have security cameras around my home (on zoneminder). When an event is triggered (someone walks by the camera) I want to have some screen nearby the door and ideally push a notification to devices (hopefully android tablets) to display the camera view on all these connected devices.
I'm happy developing my own app if necessary (even better if such an app already exists). But does Android support this functionality to allow an app to open based on an external event (some message to the app)? I've personally never seen it (phonecall is the one exception). I'm sure listening for events is easy, but I can see there being a rule not to allow apps to 'force open' in this way.
If there is a way, if you could point me to the class that would support this I would appreciate it. Thanks!
(If you have any other solutions for my use case, I'd be happy to hear them. Unfortunately, I'd like these tablets to run other apps too, so keeping the 'camera app' open constantly isn't really a solution for me.)

Related

Detect screenshot attempts on Android 4.0+

I am developing an Android application that places a high priority on protecting the user's data, to the point of storing nothing in persistent memory on the local device.
To further protect user data, we want to make a web-service call to our server whenever someone attempts to take a screenshot of the active application.
Solutions that I have seen so far include this snippet intended to prevent the screenshot from being taken and throwing a screenshot failure message in a Toast at the user. Another approach I was considering was listening for the combination of Volume Down and Power button that some devices use to take screenshots (though devices such as the Samsung S4 deviate from this method). My last resort was going to use a FileObserver in the location of the screenshot Gallery for changes while the app is running, but that also seems like a sub-optimal solution and introduces a Permission request that I'd rather not have. I also can't be sure of the file destination for the images.
I believe the Snapchat app is able to alert participants when a remote user attempts to take a screenshot. Do you have any suggestions on how this feature might be implemented, short of rooting the device? Non-official methods are welcome as well.
FLAG_SECURE is probably the best way to avoid screenshots in a window, but as some commenters say here it has some workarounds.
Maybe this answer solves the question about how do they do it in Snapchat to detect when a screenshot has been taken.

Android: Prevent regular users from accessing safe-mode?

I'm planning to deploy an app on my android smartphone which is supposed to be used by multiple other persons. Now of course I do not want them to do things with the device they are not supposed to do so I informed myself about several different ways to make it as safe as possible (Lock-down apps, Kiosk mode, Mobile-device-management, Code-tweaks and so on).
I found some solutions that look really promising but they all share the same problem that a user could just restart the device and boot it in safe-mode where those helpful apps won't be started. However, there is one exception: I've installed a MDM app called maas360 which somehow manages to apply the restrictions that I defined even in safe-mode, for example by blocking access to the menu settings. How is that even possible? The thing is just that this is not a free app and it offers a huge variety of functions - overall it seems to be a bit excessive for my goals.
So my general question would be: is it somehow possible to restrict access to the safe-mode somehow? Maybe like a password? From what I understand it is not even possible to set a system password for Android devices that you'd have to enter once it boots (except if you set up a password for unlocking the screen first which would then be the same one... very redundant).
Disabling physical switch of volume down (in case of samsung devices) will stop access to safe mode on device. I dont find any other way to do so.

Is it possible to create an android app to make the phone run in sort of a kiosk mode?

I'm wondering if it's possible to develop an android app that will be run in sort of a kiosk mode. The idea is that the user should only be able to interact with the phone through this app.
I understand that an app can be auto-restarted, and things like avoiding incoming calls, could be implemented via a service that would subscribe to the telephony events and would hang up when an incoming call is received. The downside of this is that the usual "answer call screen" would pop up for a short period. The reason behind this is that the stock android app that receives the incoming calls will still be there.
I also understand that, by design, this custom app could be killed at any time by the OS if memory usage gets too low. Although this should only happen if there's a memory leak in any of the running apps.
I'm not sure either if it would be possible to disable the behavior of the physical buttons to access home or settings screens.
I understand that rooting the device and/or creating a custom ROM with modifications would be a safer approach, but also more complex. I'm wondering if a good-enough kiosk mode could be implemented with an android app.
P.S: I'm sorry for reposting these questions, but answers to similar questions are not clear enough.
Make your application be a home screen. That can still be bypassed unless you make your own custom firmware where your application is the system default home screen. We cannot tell you whether being a home screen alone is "a good-enough kiosk mode".
I've been searching for this for days now, nearly every answer is not a complete solution at all (and it's doing my head in)
This link though has the best answer so far
http://thebitplague.wordpress.com/2013/04/05/kiosk-mode-on-the-nexus-7/

Is it possible to do all these on an Android phone?

I am wondering is it possible to do all these on an Android phone? Example, Samsung Galaxy S phone
To automatically launch a video clip upon phone start up i.e. from off position or phone ‘reboot’/’restart’
To run the video clip while the phone is idling
To launch to a particular wap site when interrupted
To restrict user from going to other portal other than the 3 steps above
To restrict user from running other application on the phone.
1) Yes but it may be hard to completely replace the phone's own screens and animation effects thus giving the smooth experience I think you're looking for. It's also pretty user-hostile.
2) What is 'idling'? If you mean standby, absolutely not. You'd kill the battery in 20 minutes in any case.
3) You can launch a website when the phone comes out of standby but it would be really annoying for the user. As for WAP .. I have no idea if you can view WAP on Android. Probably someone has made a viewer. I wasn't aware WAP was being used by anyone since some time around 2008.
4) Not without making your own custom build of Android and flashing it (very difficult technically). Sounds pretty evil for the user.
5) Again, not without making your own custom build of Android. You're reducing the phone to a brick pretty much with this stuff.
Yes, though it is user-hostile.
I have no idea what you are talking about.
I have no idea what you are talking about.
No, except by making your own firmware. Even by replacing the home screen, the user can boot into the Android equivalent of "safe mode" and bypass a replacement home screen app. You would need to have your home screen be the only one on the device, and your apps be the only one on the device.
See #4.
I will add only to question (1), since all the questions have been already answered. If you talk about replacing the standard boot and shutdown animations, then yes, it is very possible and pretty much any custom ROM for the SGS will let you do that. It's just a matter of assembling the sequence of PNG files you want. There are two image flashes before the animation, one is built-in in the bootloader, the other is hardcoded on the kernel.
Examples: http://forum.xda-developers.com/showthread.php?t=869347
You can do all these things, however you will need to flash a custom image - I assume you want to customise in-house handsets for a specific project, rather than have this as a generic app - I can't imagine normal users installing this kind of lockdown, and it sounds similar to an approach I was looking at for a project needing cheap PDAs with GSM connectivity.
If that's the case, and volumes are low, you might be better off targeting developer handsets, which can be bought through a publisher account on Android Market. I think this limits you to 10 handsets.
Hope this helps,
Phil Lello

Detecting Android Malware using Support Vector Machines (SVM)

I'm trying to develop an application capable to detect malicious application for Android platform using Support Vector Machines (SVM).
I can get many system information from "logcat" and "strace" tools but I don't now how to manage to detect real malicious applications.
Does anyone know how to stablish/record normal behavior use of the device using those tools, I mean, get information from the device and set a behaviour pattern.
Best regards
You will always have trouble determining malicious application behavior: Kymie M.C. Tan, Roy A. Maxion, ""Why 6?" Defining the Operational Limits of Stide, an Anomaly-Based Intrusion Detector," sp, pp.188, 2002 IEEE Symposium on Security and Privacy, 2002
But if you really want to try, perhaps the starting point is here: "Intrusion Detection Using Sequences of System Calls." S. Hofmeyr, S. Forrest, and A. Somayaji Journal of Computer Security Vol. 6, pp. 151-180 (1998)
I wonder, if this is possible ...
How do you want to rate whether a behavior is normal for an application? Do you plan a "learning phase" where everything a certain app does, is recorded (if that's possible without root access in the first place!) and then saved as the "profile" of "normal behavior" of that app?Say you record whatever behavior an application has, e.g. a tool to organize icons on the homescreen. Now say this application also offers the function to call one of your favorite contacts directly, it will need the permission to access your contacts and to make phonecalls. If this feature is hardly used, you would probably not record it during your "learning" period of this app and rate the app as malicious once it tries to make a phone call.And what if an app shows malicious behavior during the "learning phase" where you can't detect it because you haven't determined the "normal behavior" yet?
Sounds like the "normal behavior" has to be saved somewhere to rate an app before you install it and it starts acting weird or performs unwanted actions. But then again: what is anwanted for one user may be perfectly normal for another one ...
I'm interested in whatever fancy solutions people come up with, but I guess this will be a hard one ...
what if you use sets of malicious calls in Android first rather than profiling the normal ones.
Also, take note, if you're using unsupervised classification, it does not know what kind of data that it classifies
For Windows API usually people take a look on the sequence to determine their sets of actions.
You can find papers/researches done on that too for the Android platform.

Categories

Resources