Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unread count is not getting updated in IOS SDK. #20

Open
arasu01 opened this issue Apr 17, 2017 · 9 comments
Open

Unread count is not getting updated in IOS SDK. #20

arasu01 opened this issue Apr 17, 2017 · 9 comments
Assignees

Comments

@arasu01
Copy link

arasu01 commented Apr 17, 2017

Kept the app in the background.
Received the push notification from the hotline. Then opened the app, in which 'applicationDidBecomeActive' I have checked the unread count. It always gives 0. Below is the code:

func applicationDidBecomeActive(_ application: UIApplication) {
       Hotline.sharedInstance().unreadCount { (count) in
            print("unread count : \(count)")
        }
}

But this works in below case after a delay.

  1. It works when the killed and opened.
  2. It works when the hotline show conversion view controller is presented.

It was not updating until the above case is done. Can you please check and fix it.

@harish-kumarc
Copy link
Contributor

Hi arasu01,
In Hotline we have a two way polling mechanism for messages - one is at app level and other at SDK(hotline screen) level and that we are using to evaluate user unread count. This is the reason you are getting unread count instantly when you are in conversations. It also work when you are in your app (not in Hotline screen) but there is small delays due to polling.

Thanks

@arasu01
Copy link
Author

arasu01 commented Apr 18, 2017

@harish6989: Thanks for prompt response.

The unread count was never updating when in the app(not in hotline screen). I have checked it by going to background and foreground, it always shows me 0 and as I can see there is 2 notification in the notification center.

Also after receiving the notification, I have tried it by checking in "applicationDidBecomeActive" method for many times it was not updating.

@hrishikesh-p
Copy link

Hey @arasu01

Can you please check if the didReceiveRemoteNotification method is being invoked and does that function have the Hotline:handleRemoteNotification invocation ?

Also , you need to invoke Hotline:handleRemoteNotification under application:didFinishLaunchingWithOptions as well . This will guarantee that the push notification received is handled by the SDK.

In the absence of these. The SDK only polls once during app launch or when the user is in the SDK screen. The poll only happen if atleast 2 mins has elapsed since the last launch. This might seem long during your testing, but It works well for real world scenario.

I recommend checking why the push notification was not delivered to the SDK handle function. Please check and let us know.

@arasu01
Copy link
Author

arasu01 commented Apr 18, 2017

Oh. That's very late. It must happen whenever we are opening the app from background. Also, It works well in android SDK when the app is background and same is not happening in iOS SDK.
So, how we can show the unread count to the user, it will be very buggy.

Is there any way to find when the unread count is updated?(Something like post a Notification etc..,)

@arpe
Copy link

arpe commented Apr 22, 2017

I am experiencing the same issue as @arasu01 .

App is in the background, push notification received, the badge on the app icon goes to '1'. Then, when opening the app, and retrieving the unread count as indicated above, the count is zero.

When there is a new message, and the user brings the app to the foreground (by clicking on the app icon), I would like to show the Hotline conversations immediately. I want to use the unread count to determine there ar pending messages, but that does not seem to be reliable...

@harish-kumarc
Copy link
Contributor

harish-kumarc commented Apr 23, 2017

Hi @arpe
To display unread count in your app you can implement Hotline unreadCount API in scheduledTimerWithTimeInterval or via NSNotificationCenter. Count represents real-time unread message(s). And conversation list also displays unread in individual category(message channel).

For redirecting user to a Hotline message screen immediately, notification tap is req. for that you need to handle handleRemoteNotification api in your didFinishLaunchingWithOptions: for closed state and didReceiveRemoteNotification: for background or active state.

Thanks

@lucianocn
Copy link

Same issue here.

@srikrishnan-ganesan
Copy link

Hi @lucianocn , if you have push working right with us this feature should work without issues. If push has been an issue to configure with us - we can probably get on a screen share and sort this out for you.

@harish-kumarc
Copy link
Contributor

Hi @lucianocn, can you please elaborate/give us more context whether the issue you are facing is push related or with message(s) unread count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants