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

Android Message Callback #81

Open
bpfeiffer187 opened this issue Oct 29, 2019 · 2 comments
Open

Android Message Callback #81

bpfeiffer187 opened this issue Oct 29, 2019 · 2 comments

Comments

@bpfeiffer187
Copy link

bpfeiffer187 commented Oct 29, 2019

I have found the android message callback for react native to not be working. I use the call back to then display how many unread messages the user has from us. it works on iOS fine.

let side is iOS right side is android
image

I have created a custom component to handle this.

here is the code:
const handlePressMessage = () => {
Apptentive.presentMessageCenter();
};

export const AppUnread = () => {
const [unReadCount, setUnReadCount] = useState(0);
const callback = (count: number) => {
setUnReadCount(count);
};
Apptentive.onUnreadMessageCountChanged = callback;
return (

Messages
<InfoCard
title={You have ${unReadCount} unread messages from Amica.}
buttonTitle="Message Center"
onPress={handlePressMessage}
/>

)
};

export default AppUnread;

@weeeBox
Copy link
Contributor

weeeBox commented Oct 29, 2019

Hi @bpfeiffer187,

Apptentive SDK uses message polling technique so most likely you would see 5 min delay between sending messages from the dashboard and receiving them in the app. If you can't get any callbacks on the unread messages and but can see messages in the Message Center - try this snippet to verify that the callback still get invoked:

Apptentive.register(configuration)
  .then(() => {
    Apptentive.onUnreadMessageCountChanged = (count) => {
      console.log("Unread message count: " + count);
    };
  })
  .catch((error) => {
    showAlert('Error', `Can't register Apptentive:\n${error.message}`);
  });

Don't use your current callback when you check this (since it would overwrite the first callback)

@twinklesharma1311
Copy link
Contributor

Hi @bpfeiffer187 ,
Were you able to resolve the issue with the code snippet provided above?

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

3 participants