简体   繁体   English

如何使用Malcom Android SDK显示自定义通知消息?

[英]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参数中使用带有falsemoduleNotificationsRegister()方法来避免默认行为。

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.

相关问题 如何在API 7的通知中显示长消息文本 - How can I display a long message text in the notification on API 7 我如何制作推送通知以每天早上在android中显示 - How can i make push notification to display in every morning in android 我如何知道要显示或不显示通知的Android应用程序的应用程序状态? - How can I know the application state of an Android App to display or not a notification? 我如何从推送通知服务中获取消息并显示到消息活动中 - how can i get the message from my push notification service and display to my message activity 在Android(在JB上),如何向自定义丰富通知添加操作? - In Android (on JB), how can I add an action to a custom rich notification? 如何在android中显示通知消息 - How do I display the notification message in android what I get from the server 如何在Android的WebView中显示自定义消息? - How to display custom message in WebView of android? 如何在Android上的应用程序中显示锁屏消息? - How can I display a lockscreen message with an application on Android? 如何在Android手机的第一个屏幕上显示消息? - how can i display a message in the first screen of an android phone? 如何在Android中显示持续通知? - How should I display a constant notification in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM