How to perform swipe down programmatically in android - java

Hi I want to refresh a application by swiping down programmatically (for example Facebook app) from a service running in the background. Is it possible?

Not generally. Apps can't send touch events to one another. It can be done if its your app in the foreground receiving the gesture (although then there's easier ways to do this than faking a gesture), or it can maybe be done if you're an accessibility service (but they won't allow you on Google Play if you're using accessibility for something like this).
If its a personal app, you can checkout AccessibilityService and dispatchGesture() for a possible solution.

Related

How to detect in android that soft-keyboard show/hide in any other Application?

I want to receive the broadcast in my android app whenever soft-keyboard show/hide from any other application.
That is not possible. If the application you're writing about doesn't expose such events, then you're out of luck. Besides, soft keyboard is a separate app and it doesn't have events for showing or hiding it. That's why even if you would only like to detect these events in your app, you would need hacks to handle that. Here you can find an idea: SoftKeyboard open and close listener in an activity in Android?

Strategy for transparent Android app that allows 3rd party app behind it to update

I have an Android app that is transparent that monitors for an event and then displays a message and toggles the background between transparent and a translucent red. The app itself is working exactly as I was hoping. The problem is that only the top most app (my app) is active and updating the view. The app displays over a 3rd party app that runs a live video stream. I want the live video stream app to continue to update while my transparent app is on top. Since I have no control over the other app and it doesn't support multi-window approach, I am looking for a different approach or work around to accomplish the same thing.
I have read of people trying to use a system popup based on a service. Does anyone have experience trying to solve a similar problem and found a good approach for designing the app or a work around?
Try to google about Activity lifecycle. When another app comes as the top application (let's say your transparent app) the last playing application goes to onPause until the user bring the last app back to the top again.
The short answer is: what you want is not possible.
any question?

Android - Globally assign function to gamepad key combination

I'd like to set up an Android TV box (Lollipop 5.1.1) to be able to function just with an Old PlayStation controller. Unfortunately it doesn't have a dedicated home button. I'd like a solution which makes the device return to home screen on a key combination (like L3+R3)
I've never made a standalone Android App or Service before but I am more than willing to learn it with some kind help :)
May a service with game controller event listener work?

Embed android application into other android application (Overlay + Events)

I was wondering if it's possible in android to embed an application into in another application. In this way you can have control of the embed application and you can add some other functionalities thanks to the parent application.
EDIT :
To be more accurate, I would like to have an application (parent application ) which can overlay the content of another application (embed application) without losing control of the parent application.
Thank you,
You can not specifically embed one app in another. And unless there is a specific inter-application API you have available to you, you cannot control the one app from your parent app either.
However if you just want to be able to view your parent app as some kind of overlay over another app, there are techniques that you might find useful.
It is possible to create an overlay view that can be seen when other apps are in the foreground. This is used by some chat clients, video playback, and task launchers. You can find some info on this method by looking at my answer here:
Background app to listen to Drag gestures
It is important to realise that in "the old days", a technique like this could be used to steal data from someone's phone. It was possible to receive taps & drags, and then pass them on to the other app.
This was a security hole, and has been fixed. So these days, you can choose if your overlay view should receive the taps or not i.e. if it is interactive, or just shows info.
Because of this, you will not want to cover up any of the "embedded" app with your own UI.
It is not possible any more to receive taps in your app, and pass them through to the other app.
This is not possible in general. The only thing that comes close is "embedding" an app widget in a home screen.

Android: Possible to start any activity of other apps from my own?

This is an Android noob question.
I am trying to start an activity of another apk through my own application. Now I know I can launch any other application and invoke its main activity. In many cases I'm also able to start subactivities, for example display it's settings dialogue.
However with some applications, for example Facebook or Endomondo I would get a FC everytime I try to launch some specific activity of their application.
Now I suspect that this is a permission issue and that the Facebook or Endomondo devs just don't want other applications to get access to their activities. But do I have to find out which activities I can use and which ones I can't use by trial and error every single time?
Plus: Is there any way around this dilemma? Maybe on a rooted device?
Cheers for any pointers.
As you already said you can only use activities of other apps which are designed to be used by others applications. Normally the developer of the other app define a set of intents and actions their app will be able to understand and process.
Using any other app's activity is by default not possible, this is by design of Android as every app runs in it own sandboxed process (there are some exceptions where apps can share a process).
So to use another app's activities you must know the intents it listen on. Normally this can be found in the applications website or documentation or on OpenIntents a dictionary for intents.

Categories