Android Message Callback
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

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 (
<View>
<SectionHeader>Messages</SectionHeader>
<InfoCard
title={You have ${unReadCount} unread messages from Amica.}
buttonTitle="Message Center"
onPress={handlePressMessage}
/>
</View>
)
};
export default AppUnread;
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)
Hi @bpfeiffer187 , Were you able to resolve the issue with the code snippet provided above?