Android: How do i trigger an app on an event? - android

Suppose I want to start an app to run in background as soon as an event occurs in the phone.
For example:-
When I open my gallery I may want to automatically start my app which monitors my file browsing and prepares database for most recent documents, most listened song, etc and is automatically closed when I exit my gallery folder.
Whenever I open my internet browser I might want to start my app in background, which monitors how many times I visited a particular site and it automatically closes when I close the browser.

I don't think this is possible, and i'm not talking about remote launch app, but capture events of other apps like Gallery or Browser.
If this are only hipotetic examples, you should show a real examples because i think collect this type of data will be more painful problem than trigger app on an event due a lot of security reasons.

Related

Trigger an unopened Mobile App Callback whenever User takes Photo

How can I make an Android app that has a callback triggered whenever the user takes a photo (or more specifically, screenshots). The screenshotting would occur when the user is not active on app (would be while other browsers or apps are open), and I couldn't find any information on how to request user permission to access all their screenshots, and how I can trigger my app callback whenever a screenshot occurs on the mobile device.
I looked at Flutter packages and articles, but none described this functionality (closest I could find to running such background processes even when the app is not open is Geolocation).
Flutter only has packages to trigger callbacks of a screenshot when the app itself is open, rather than of anything on the mobile device.

Receive a callback when third-party app successfully loaded the file in android

Is there a way to know if the third-party app successfully loaded the file?
My app has a user manual which is in pdf. When user taps the link to open it, my app calls for another app to open the file (implicit intent). The problem is, sometimes the 3rd-party app lags 2-5 secs before showing the pdf.
Now, what I want is to show a loading dialog in my app while the 3rd-party app is loading the pdf in the background and once the pdf is successfully loaded, receive a callback from the 3rd-party app to finish the loading dialog and show the user manual.
Is it possible? Thanks in advance :)
Create a ContentProvider within your app which serves the PDF file. You could then use a local broadcast or an event bus to have the content provider notify you when it's done serving the requested file. As your third-party viewer-app likely won't request the file until it's done initializing, you should get an event close to when your file is being displayed.
The moment you call an Intent to start an activity of another app, you couldn't interact with your app (activity, fragment) anymore, so I think it's not feasible.

Monitor any other running app from a service Android

I was developing an app for an enterprise which has given the employees an android phone, they wanna monitor every time a user tries to open any other app and send a report to a manager so I´ve developed an android service that checks every time any other app is call meaning: OnCreate, onResume, etc.(that´s done) Now they wanna check what that particular user did once he got into the other app: for example if he opened the messages(com.android.mms) , what message he sent or what he had recieve. other example: if he opened the dialer(com.android.dialer) they wanna know what phone he called. What makes it tricky for me, is that they want this for EVERY POSSIBLE APP a user can have installed in their phone.
My Question is the following: is there a way to capture this kind of information of a running app, from a service?
I appreciate any answer and I´m open to suggestions of how should i do this.

Give limited access to android app using Phonegap

I have created an android app using phonegap. I want to run the app to limit its usage to only 5 times means user can open this app only for 5 times after that user will not be able to open it instead it will show a message.
How can i do this ?
Depending on your requirements you could probably have a setting that you increment and save every time the app is opened, then when you see the app is over it's open limit you'd block access.
With this method clearing the data on the phone would reset the value. For this to be very reliable you'd have to have some sort of device ID that gets sent to a server that would determine if the app has been opened before and how many times.

application closing without error - In background

I've created a simply web radio streaming app, and on of my app user told me that sometimes when he open another app (for example, Facebook app) my app gets close without error.
How can I trace this event?
Thank you!
It sounds like your app is simply experiencing the standard Activity lifecycle.
When the user leaves your app (eg opens the Facebook app), onStop() is called. From there, the app can either be restarted, it can just sit there, or it can be destroyed.
Since the Facebook app is fairly resource-intensive, I am guessing that the system is destroying your app to free up resources for the Facebook app, or whatever other app is being launched.
If you tell us more about what you are trying to accomplish, we can provide more suggestions on how to do that.

Categories

Resources