How to show number of unread sms on mesege inbox icon - java

when sms is recieved a pop up is appeared on inbox icon which show number of unread sms,, how can i show that popup which indicate number of unread sms in inbox....
Is there a way to add a badge to an application icon in Android?

Unfortunately, Android does not allow changing of the application icon because it's sealed in the APK once the program is compiled. There is no way to programmatically change it to a 'drawable'.
Read this link: Is there a way to add a badge to an application icon in Android?

There is no way to implement this for all devices out there. The problem is, this is no feature of Android by itself, but of the specific launcher, and while there are some launchers that offer this possibility (each slightly differently), there is no solution that would work with all devices.
Also, it is discouraged to use this UI pattern in Android apps, as it is an iOS design pattern.

Related

Is there a way to detect when a popup window appears in Android

I started a project of a windows program that connects to an android phone and gives the user information
about it, so I want to display all of the popups that appere on the phone. to do this I need the app version of the program to catch them somehow and give me the name of the app that sent the popup and the popup's contant. is it possible?
it would be kind of security issue if any app could do that... you can try with AccessibilityService with some permissions for reading screen/running Activities and checking style of every Activity is this "popup", but note that some of them are just DialogFragments. So I doubt you can recognize "popups" this way in a reliable way. Look for AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED for more info

How to reset the app icon badge number for messages/notifications back to zero for ALL APPs on Android

There appears to be a bug (or strange feature) with the number of notifications displayed on the app icon badge on Android: the number display doesn't reset to 0 and increment from there with new messages after all of the messages/notifications have been viewed. This is a problem apparently experienced by a Very Large number of Android users. If possible, want to create an app that can clear this number for All Other Apps, not just for the app that I have created.
Here is an example of what I'm talking about.
A moment ago I had no unread messages in WhatsApp, Slack, or gmail. I had also swiped away the visible notifications for each app on the notification screen. Each app icon displayed no little red notification badge. Then, I received a single message on WhatsApp. The app icon then showed the red dot with the number 36 in it, indicating 36 messages. That number hasn't been at zero or one in months, basically since I bought the device and installed WhatsApp. This essentially means that the number displayed is worse than useless, it's simply wrong or misleading at best if it corresponds to some remaining number of somethings that I'm not aware of. The same basic behavior pattern seems to happen with Slack, gmail, and other apps.
There are posts regarding how to reset the badge icon number for one's own app, eg:
How to reset the Badge app icon number?
There are also many posts of users asking how to reset the number without programming, using system functionality, eg:
https://forums.androidcentral.com/ask-question/926172-incorrect-unread-text-message-count-galaxy-s9-app-badge-icon-has-wrong-number.html#:~:text=Try%20going%20to%20Settings%3EApps,and%20see%20if%20that%20helps.&text=Go%20to%20the%20message%20settings,solve%20the%20message%20count%20issue
https://forums.androidcentral.com/samsung-galaxy-note-8/879508-google-email-notifications-numbers-wrong-cant-fix.html
It seems to me that it would be helpful to many people to have an app that the user could give adequate permissions to so that the app could reset the badge icon counter back to 0 for all other apps, so that thereafter, for each of the other apps, if the user got a message/notification, they would see a '1' on the icon badge, rather than some other larger number.
Is it possible for an app to do this? If it isn't possible to reset all apps at once, is it possible to do it for one app other than the app that is doing the resetting, or to do it for a list of individual apps?
What is the required code?
Also, is it possible to do this in some way through the OS, without requiring specialized code? I tried the methods that people have posted but didn't find one that worked without substantially disrupting the device (eg wiping the home screen).

How can Android apps access messenger chats?

I want to write an Android App that analyses chats. For each messenger, for each contact, I want to get a list of all messages sent and received (since installing my app). The key thing here, is that I want the list of messages to be in order. My app should support as many messengers as possible. What would be the best way to do this?
I researched and found a few ways to access messengers' messages:
Using accessibility services
(Related: How to read window content (using accessibilityService) and evoking UI using draw over other app permission in Android?)
to read the screen content of other apps that is annotated with accessibility labels
caveats:
the messenger needs to have accessibility implemented correctly
I have to filter which text blobs are relevant
Using NotificationListenerService
to get the content of notifications for received messages
caveats:
only gets content of messages for which there was a notification
except for their time, there is no order of the messages given
taking screenshots and doing optical character recognition
caveats:
probably insane
When I get the messages, I still have to order them. For this, I think, the accessibility services are my best bet as I could use the date information on screen in most messages, and also their position on the screen.
However, there is still an edge case. As I understand it, accessibility services can only see the content currently on the screen. The user might also use another device to chat while the device with the app installed is powered off. Thus, once the device with the app installed is powered on again, the app might not be able to see the old messages written while the device was powered off (until the user scrolls up again).
Are my assumptions correct? Do you know of a better way for my app to read/sort the messages?

Expanding Android Notifications Via Android

I've created a series of notifications which seem to be taking up more room than can be displayed in the notification area. I expect to be able to click each notification and see it's entire contents - however for some reason the notifications do not seem to expand when clicked.
SOURCE:
https://docs.google.com/document/d/1IsXl2ymLkkoTzEqAPpM99tPtKCJgBhAlbWJW2HZ5Zro/edit?usp=sharing
The Android Documentation on Notifications covers this pretty well, specifically the section on Expanded layouts. The expanded view is done by adding a bigContentView() (API 16+):
A large-format version of contentView, giving the Notification an opportunity to show more detail. The system UI may choose to show this instead of the normal content view at its discretion.
If you are producing multiple notifications and you are concerned about the amount of room they take up, read up on the section titled Stack your notifications.

Android SMS context menu

I have done a little but of looking around on google and think i know the answer to this before asking, however most of what i found on the internet dates back almost a year so.
Is it possible to add an extra menu item to the SMS context menu so for example an app i am working on, if you press it it can open you app from that message.
otherwise is it possible to add a "flag" to an SMS so then when it is recieved on a device it would try to open it in a different application than the stock SMS one if it exsists.
*edit to elaborate:
I am currently writing an app which is basically a custom SMS app (its a uni project) What i am trying to find out is if it is possible to 1 of 2 things:
1, add a context menu item to a SMS in the standard app - the idea of this menu is to link it to open it in my app
if not then
2, add somesort of flag? to the text message so that when its recived on the phone a service or something checks to see if the flag exists, if it does then opens that SMS on my app (if its installed) else opens it in the standard default SMS application
For the second approach I will suggest you should use BroadcastReceiver.
BroadcastReceiver is used when there will any action which needs to happens on a particular
event let's say onIncomingVoiceCall or incomingSMS.
I think this will serve your purpose.
If you find my answer useful please mark it.
Best Regards,
~Anup

Categories