Play touch sound whenever the user interacts with screen - android

I want to play sound in android whenever user touches the screen irrespective of which app they are in. Like making it the UI touch sound. so that my app keeps running in the background and playing sound whenever user interacts with screen. where do i the code? what to write? pls help. This is for android. And i'm using eclipse.

This is not possible.
Android does not allow you to intercept touch events on the screen when outside your own app as this would allow malicious apps to take over all other apps and render the phone useless.
Furthermore, it would very quickly get annoying for the users, particularly if they're playing a game or something that requires a lot of touch events taking place.

I'm afraid it's impossible. You can intercept touch events only in your Activity.
Similar questions had been already asked
https://groups.google.com/forum/?fromgroups=#!topic/android-beginners/H45Xwm43NGQ

Related

Custom android launcher isn't immediately responsive to touch events

I'm building a custom Android launcher; at the moment it's pretty simple, it's a SurfaceView that renders a set of icons, and the app registers itself as a custom launcher using the manifest.
The SurfaceView is a custom class and it listens for touch events by overriding onTouchEvent. As I've tested my launcher, I noticed that if I quickly go to the launcher from an app ("press home", except its a gesture these days) and then press a button on the launcher, the touch event (I'd expect ACTION_DOWN) doesn't register. There's basically a tiny bit of latency before ACTION_DOWNs are properly propagated to the SurfaceView, after launching the launcher. I'd guess the latency is between 500ms to 1 second.
Does anyone know why this might be or how I could debug this further? It's a small thing, but it makes it annoying when trying to quickly change apps.

How to avoid having the live wallpaper respond to touch events on recent tasks on Lollipop

Background
I've made a live wallpaper that can handle touch events .
The problem
There are some cases which I don't want it to handle touches (or listen to other events). This help prevent weird drawing and also save on the battery a bit.
For example, on Lollipop, I've noticed that when you show the recent tasks screen, the live wallpaper still has focus. This didn't happen on pre-Lollipop, because the recent tasks screen took over everything on the screen.
Another example is the wallpaper-chooser, even if you just show thumbnails of all live wallpapers, you would still show your own and handle touch events, as if the user is on the launcher.
However, when you show the notification bar or the menu of the launcher (by pressing the menu button), the live wallpaper will not get any touch events.
You can see those issues on other live wallpapers, like "Magic fluids free" for example.
Again, the problem is that on some cases, there is no way to disable the touch events, because you can't know when they happen (recent tasks and wallpaper chooser are such examples).
What I've tried
There isn't much to do. all of the methods of the Engine class failed to find the state of the sceneraios I've written about:
onOffsetsChanged, onVisibilityChanged, onSurfaceChanged, onSurfaceRedrawNeeded, onOffsetsChanged
The question
Is there any way to overcome this issue?
To stop listening to events in case the live wallpaper isn't on focus?
How about setting
setTouchEventsEnabled(false);
in your WallpaperService Engine class, when you don't want touchs to be handled, and set it to true when you do.

Android, Two applications active at the same time [duplicate]

In Android , Is it possible to display one application(rendering Video) as a floating screen in one half of the screen. and at the same time interacting with another application(e.g chat application or any other application. ).The floating screen appliction will be my application so that it will allow the user to do multitasking.
The idea is to keep the surfaceview of the application, which is rendering the video, on top, and at the same time interact with other applications.e.g gallery or any other application..
If by "two active applications" then you mean real applications (i.e. with activities, back stack, &c) active at the same time, then no (except in some specialized devices, with custom APIs).
However, there is a trick you can use to achieve a similar effect. Applications with the android.permission.SYSTEM_ALERT_WINDOW (displayed as "draw over other apps" in Play Store) can create windows from a service and show them. So you could probably get the effect you want with this method.
There is an open source library called StandOut which provides this behavior in an easy to use manner. You might want to take a look at it.
In short, the answer is no. There is no way currently for multiple apps to be visible on the screen at the same time.
You could theoretically reuse code over multiple different applications, so you could create a video window that could play video, while simultaneously showing a text editor fragment that allows notes to be taken, and you can send data between different applications using an Intent, but unlike modern desktop computers, only one application can currently have the focus of the screen at a time in Android.

Android: Recognising Gestures when screen is locked

I am currently in the process of creating an MP3 player. In particular, the main mode of user input is in the form of (touchscreen) gestural input. I would like to add the functionality allowing users to continue interacting with the MP3 player when the screen is locked. That is, how can I get the device (A Galaxy S3 in particular if it's worth mentioning) to recognise gestures in the lock screen and "parse" them to the MP3 player?
Note: by "locked" I mean when one can see the lock screen (i.e. not when the screen is turned off).
How would I go about doing this?
Thanks in advance.
The recommended way is to make Lock Screen Widgets. These are widgets that allow you to interact with apps in the lockscreen such as the Google Play Music app.
Check out the official tutorial here:
http://developer.android.com/guide/topics/appwidgets/index.html#lockscreen

Is there a way to remove the pause button from the custom camera view in Android?

I am building an Android app that uses the phone's camera feature. I know there is a way to build a custom camera view. Instead, I am choosing to use the camera app via an intent and not build my own camera view. I want to disable/make disappear the pause button while taking a video and have just the stop button. I looked up the Camera API Guide at www.developer.android.com but it doesn't talk about how I could do this. Does anyone know a way to do this?
I doesn't think that this is possible. Using Intents is just a way to tell Android "hey, I'd like to take a video (photo, see MapView, etc). Can you do it for me?". It may trigger one or MORE Apps listening to that Intent, depending on what apps the user has Installed. Usually you can only choose very basic options via Intents, i.e. take video/picture or tell the MapView at which Position it should show up. These options usually also appear inside the App during normal use. I never see a "CustomCamera-App" that hasn't a pause Button, or where one is able to deactivate it inside the menu. Therefore the chances that it is possible to set that special option tends to zero.

Categories

Resources