Displaying Blackberry Push Notifications - java

I'm all setup in receiving push notifications. I am displaying a count with a icon on the top status bar. However I am unsure where to look next on how to display the message (possibly in the new Messages/Email view, like the twitter app).
I have all my messages persisted but no way to preview them when the status bar is clicked.

Have you looked at the Messaging guide from RIM? It describes how to set up a listener on the ApplicationMessageFolder that you can use to trigger your application.

Related

How not to interrupt the current process in the application when the user clicks on push?

on one screen in my application, I am recording audio.
Scenario: User records audio on this screen. A push comes from our application. The user clicks on this push and another push processing activity is launched.
Result: The user loses his session.
Question: what are the options for handling this case so that the user does not lose his session? Ideally, before switching to a new activity, the application would ask the user if he is sure that he wants to go to another screen, because the session will be lost. But how to track it?
Thanks a lot for your advice
The best solution I have found is to clear all old push notifications in the notification shade when going to the recording screen.
val notificationsManager = getSystemService<Any>(Context.NOTIFICATION_SERVICE) as NotificationManager?
notificationsManager!!.cancelAll()
Further during the recording, if a push notification arrives, I receive this in my service inherited from FirebaseMessagingService in onMessageReceived().
If the recording screen is currently open, I do not show a notification in the notification shade. But I show a widget on the recording screen with the push text and if the user presses it I ask if the user wants to go to another screen because the recording will end.
I hope my experience helps someone. Similarly implemented in Intercom

How can I add custom view in android status bar?

I am creating a chat app, and I want to add a view like textview or a progressbar in android system's status bar for the app like this
I don't know what to do for this. I also searched in google for a solution, but they giving result for Notification.
Here I mention that, I'm not asking for any notification or floating view! I just want to add a view in that status bar.
Can anyone help me to do this?
Thanks in advance!!
As an app developer, you have no permission to set a view inside the status bar. Only the Android OS itself can manage and change views in the status bar according to the current state of the device (what notifications it has, battery status etc.)
As a developer, you can only:
Hide it
Change its color
What are you trying to achieve? Surely Android has a better solution to your problem.

How do I check if some notification message is already read or deleted from action bar by user?

I'm trying to create a stack notification in the action bar.
I want to update the counter (++counter) when a new notification arrives and show the counter value in the action bar.
like this:
"2 new messages"
My problem is that when the user has already clicked on the notification message then it is deleted from the actionBar. Then later if a new notification appears I want my counter to reset and again show in the action bar the sum of messages that have not been read.
How can I know if the notification has already been removed/read from the action bar?
This gets easier if you decide to reset the unread message counter when the user reads the messages. Now, you need to delete the old notification and make a new one, with the updated count.
That is, there's no need to check, just make a new notification and dismiss the old one:
How to clear a notification in Android
Are you targeting the latest APIs (21 or above?)
Check for NotificationListenerService from Android Developers.
There are two methods, onNotificationPosted() and onNotificationRemoved()
Now, use a Set<notificationID> mySet. In onNotificationPosted(), call mySet.add() to add all the notifications posted.
In onNotificationRemoved(), call mySet.remove()
At any point when you want to check if notification is avaialble in notification bar, call mySet.contains()

How to update icon dynamically in contacts for my android app?

I am working on a app which add its icon in android default contacts app just like whatsApp icon appears in contact info. I want to update my apps icon dynamically on receiving some events, say a user comes online, then icon in contact list should be different then the icon shown when user is offline.
Can anyone suggest any way to do this?
Thanks
I assume your contact list is a ListView, and that you have an adapter that inflates each cells layout (that is, displays the icon and name of the contact).
Whenever you detect a change has occurred (an event was received) (maybe consider using a Loader if you aren't already), you should be able to call Adapter.notifyDataSetChanged() to update the cells.

Delay dynamic GUI changes

Activity description :
The main idea is to have an sms sending list and when user clicks the 'Send' button, the broadcast receivers start to receive and GUI changes like highlighting the 'Sent/Not sent' member list, updating progress bar , counting etc
Problems : Activity runs for hours and it's very important to save the exact same GUI change in sync with the user's action on the phone
However I have a few problems and th
The battery is dead/app crash.
Solution : Saving each 'send' state to file and loading it the next time when the user runs the app
The user hits the back/stop button or has an incoming call / Just wants to surf the web.
Solution : Maybe keep running it in the background? by using transparent activity ?
*NOTE : its not about the 'save' state or 'restore' state because everything depends on the broadcast receiver
Ideal way could be
do the backend logic with broadcast recievers + intent service and log the data in backend
Use the activity to just display the UI state based on the saved data.

Categories

Resources