Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] java – Is it possible to broadcast if an applications is opened or not

Posted on November 11, 2022 By

Solution 1 :

There are some broadcasts that require explicit registering in the system (Annotated with You can not receive this through components declared in manifests, only by explicitly registering for it with Context.registerReceiver().).

The most important ones for apps that run code after installing are:

ACTION_USER_PRESENT: Sent when the user is present after device wakes up (e.g when the keyguard is gone).
ACTION_SCREEN_ON: Broadcast Action: Sent when the device wakes up and becomes interactive.
ACTION_SCREEN_OFF: Broadcast Action: Sent when the device goes to sleep and becomes non-interactive.
ACTION_MY_PACKAGE_REPLACED: A new version of your application has been installed over an existing one. This is only sent to the application that was replaced. It does not contain any additional data; to receive it, just use an intent filter for this action.
ACTION_HEADSET_PLUG: Wired Headset plugged in or unplugged. Same as ACTION_HEADSET_PLUG, to be consulted for value and documentation.
ACTION_DATE_CHANGED: The date has changed.

Problem :

I would like to know if an Application such as whatsapp or youtube is opened by the user. Looking at the logcat, I can see that when the activity of the whatspp is opened – following

com.whatsapp.intent.action.CHATS

intent actions is opened. Am looking for a way to log this – so I can run an algorithm to suggest which page of the application will be opened at a given point of time

Comments

Comment posted by CommonsWare

“I would like to know if an Application such as whatsapp or youtube is opened by the user” — generally speaking, this is not supported on modern versions of Android, for privacy and security reasons. “Am looking for a way to log this” — that has not been possible for several years. You cannot spy on the details of the activities being started by the system, again for privacy and security reasons.

READ  [FIXED] java - error: cannot find symbol variable itemsAdapter
Powered by Inline Related Posts

Comment posted by Balls

@CommonsWare Then how does apps like digital wellbeing is able to track the usage of these applications. Is there any specific API for that purpose

Comment posted by CommonsWare

“Then how does apps like digital wellbeing is able to track the usage of these applications” — that was written by Google. Google can use internal APIs that third-party apps are banned from using.

Comment posted by Balls

@CommonsWare Thanks that helps!

Comment posted by CommonsWare

Hi! Welcome to Stack Overflow! Please explain, in detail, what this has to do with the question.

Android Tags:android, android-intent, java

Post navigation

Previous Post: [FIXED] Android Studios error : Unable to locate adb location
Next Post: [FIXED] android – Here Maps Navigation samples seem to be missing the Navigation Library

Related Posts

[FIXED] android – Making a LiveData to observe multiple retrofit requests in same View Android
[FIXED] java – Filter parent and child at Realm – Android Android
[FIXED] android – can I use callbackFlow even though I have not a callBackListener Android
[FIXED] android – Use AndroidX artifacts checkbox missing from AndroidStudio(Version 3.6.1), When creating a new project? Android
[FIXED] Android Studio BSOD when running virtual device Android
[FIXED] java – ConstraintLayout cannot be cast to RecyclerView Android

Archives

  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can Vicks humidifier be used without filter?
  • What color is Spanish green?
  • How old is Jamie in The War That Saved My Life?
  • When should I use scalp massager for hair growth?
  • Can I put polyurethane over liming wax?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme