Android Google Cast通知已禁用 [英] Android Google Cast Notification disable

查看:104
本文介绍了Android Google Cast通知已禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Google Cast集成到了我的Android应用中。我所有的内容都通过带有通知的服务播放。当我使用Google Cast播放媒体时,它会添加自己的通知。是否可以禁用默认的Google Cast通知并仅使用自己的通知?
谢谢。

I integrated Google cast to my Android app. All my content is playing via service with notification. When I play media using Google cast it add own notification. Is it possible to disable default google cast notification and use only own notification? Thank you.

推荐答案

这是一个很棒的门户网站,您问一些问题,而不是自己回答自己的问题: )

This is great portal, you ask some question, than you answer own qustion by yourself :)

要禁用仅在类CastOptionsProvider中为setNotificationOptions()传递null时所需的强制转换通知。

To disable cast notification needed just to pass null while for setNotificationOptions() in class CastOptionsProvider.

完成答案:

public class CastOptionsProvider implements OptionsProvider {

    @Override
    public CastOptions getCastOptions(Context context) {

        CastMediaOptions mediaOptions = new CastMediaOptions.Builder().setNotificationOptions(null).build();
        return new CastOptions.Builder().setReceiverApplicationId(context.getString(R.string.app_id)).setCastMediaOptions(mediaOptions).build();
    }

    @Override
    public List<SessionProvider> getAdditionalSessionProviders(Context context) {
        return null;
    }
}

这篇关于Android Google Cast通知已禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆