[英]How can I display a custom notification message with Malcom Android SDK?
I would like to display the notification message inside the app but not as it is displayed by the Malcom SDK by default, which displays a predefined dialog when I open the app. 我想在应用程序内显示通知消息,但不显示默认情况下Malcom SDK所显示的通知消息,当我打开应用程序时,该消息会显示一个预定义的对话框。
Can I modify the default behavior of the library to show the message my own way? 我可以修改库的默认行为来以自己的方式显示消息吗?
Thank you very much 非常感谢你
You can avoid the default behavior using the moduleNotificationsRegister()
method with false
in the showAlert
param. 您可以在
showAlert
参数中使用带有false
的moduleNotificationsRegister()
方法来避免默认行为。
Then, to get the notification's message, you just need to add this on the onCreate()
of your launch Activity: 然后,要获取通知的消息,只需将其添加到启动活动的
onCreate()
上:
String message = null;
if(getIntent()!=null && getIntent().getExtras()!=null){
message = (String)getIntent().getExtras().get(MCMNotificationModule.ANDROID_MESSAGE_KEY);
}
In the latest Malcom Android SDK 2.0.5 things have changed. 在最新的Malcom Android SDK 2.0.5中,情况发生了变化。 Now you can use a
NotificationHandler
if you want to handle the notification in a custom way. 现在,如果您想以自定义方式处理通知,则可以使用
NotificationHandler
。
See the documentation about that: 请参阅有关的文档:
https://github.com/MyMalcom/malcom-lib-android/blob/master/doc/Notifications.md#check-notification https://github.com/MyMalcom/malcom-lib-android/blob/master/doc/Notifications.md#check-notification
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.