Listener for new processes - Java for Android App Development

Is there some sort of a listener that I can register for that listens for new processes that are created? I would like to get the process name, pid, and the uid from it.

Related

Database Open Dilema

I have an Activity. This Activity runs a Service. The Service runs a BroadcastReceiver.
In the Service or BroadcastReceiver I need to write some data to a database. So I instantiate my DB Helper class. Yeah buddy...I get about 100 "In Constructor" messages and than a Stack Overflow FC. Woo Hoo!
I'm stumped as to where I can instantiate the DB Helper so I can write my data.

[Q] android receiver for sendBroadcast

Hi,
How can thread in android applcaiiton make sure that there is receiver registred for receiving broadcast?
Application starts two threads (one back-end thread which check contacts book for contact deletion and other GUI thread which shows contact list on screen).
Backend thread is sending a broadcast but since GUI thread and backend thread starts in parallel so some times broadcast is sent even before GUI thread registers for receiving broadcast.
Code:
app.sendBroadcast(new Intent(
SipManager.ACTION_CONTACT_DELETE_RECEIVED));
[CODE]

[Q] Android service restarts, but application does not

I am a complete newbie in Android.
I am developing an application that sends over a webservice information about the last dialed number, call status, and duration of the call.
The application works perfectly fine, but when the device closes the application the android service does restart but the activity does not.
The way I am sure about that is that I have Toasts when the service is started: "Servicio TRUCKA iniciado" and "Servicio TRUCKA creado" tell me that the service has been created and started.
And when the information is sent to the webservice I have toasts saying: "Enviando informaciĆ³n..." and "InformaciĆ³n enviada."
But when the application is closed (via the android task manager that automatically closes apps) the messages from the service "Servicio TRUCKA iniciado" and "Servicio TRUCKA creado" do appear, but the toasts from the information sent part do not.
I hope someone can help me and tell what am I doing wrong?
Really really thanks a lot!
I can not add code to the post, so I am adding the project hoping someone can help me
CLOSED
Human stupidity has no limits.
My actions where not in the service

[Q] How to group calls from CallLog.Calls by Number

Hello everyone,
I've queried Android's CallLog.Calls and populated an ArrayList with my call model object however when I display these objects in a RecyclerView, certain phone-numbers appear multiple times, once for each call entry that was made from or to that number.
I'd like to group the calls from the same number together.
Is there a built-in way in Android to group these call entries so that I can display them as a single entry in my call log RecyclerView?
I tried to add "GROUP BY" to the query but contentResolver.query() does not seem to accept it in any of its parameters.
Thanks!
You can remove the duplications after you get the data using a HashSet, for example:
ArrayList<String> items = getItems();
HashSet<String> hashset = new HashSet<>();
hashset.addAll(items);
items = new ArrayList<String>(hashset);

[Q] Android service and broadcast

Hello all,
I have a question about Android service and broadcast.
For my application I am trying to keep track of the time with the Timer class.
The user can press a button and a timer will increase his value. (visible in activity).
What I am trying to achieve is to keep this timer going even if the user closes his application.
And after some specific time (say like every 10 mins) I want to send the user a notification to let him know the timer is still running.
Am I using the right implementation for using a service and broadcast?
I'd say there is no need for any broadcasts.
The Service can keep track of the Timer and Notification, then your Activity either starts and binds to the Service or if the Service is already started it rebinds.
Then use a PendingIntent to either stop the Service or start the Activity on Notification clicks, depending on your flow.
registered-user said:
I'd say there is no need for any broadcasts.
The Service can keep track of the Timer and Notification, then your Activity either starts and binds to the Service or if the Service is already started it rebinds.
Then use a PendingIntent to either stop the Service or start the Activity on Notification clicks, depending on your flow.
Click to expand...
Click to collapse
Thanks for your reply! I meant alarmmanager sorry! My idea was to check every x amount of time with my alarmmanager if my service (timer) is still running. Or is there also no need for a alarmmanager?
I guess you could do that, depends on the overall goal. You could also create a static flag in your Service that is flipped on start and on stop. Then post a delayed runnable/message to check the flag?

Categories

Resources