小编thi*_*nth的帖子

通知声音问题

我正在尝试测试通知.我创建了一个启用了音频播放的模拟器.我能收到通知,但我听不到声音.可能是什么问题呢?我缺少任何设置吗?

NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(ns);
        int icon = R.drawable.icon;
        CharSequence tickerText = "Hello";
        CharSequence contentTitle = "My notification";  // expanded message title
        CharSequence contentText = "Hello";      // expanded message text

        Intent notificationIntent = new Intent("ABC");
        PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

        long when = System.currentTimeMillis();

        Notification notification = new Notification(icon, tickerText, when);

        notification.defaults |= Notification.DEFAULT_SOUND;

        notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);


        mNotificationManager.notify(HELLO_ID, notification);
Run Code Online (Sandbox Code Playgroud)

当我看到logcat时,我有以下堆栈跟踪.

09-20 15:44:47.297: DEBUG/MediaPlayer(62): Couldn't open file on client side, trying server side
09-20 15:44:47.347: ERROR/MediaPlayerService(34): Couldn't …
Run Code Online (Sandbox Code Playgroud)

android android-emulator

3
推荐指数
1
解决办法
4949
查看次数

标签 统计

android ×1

android-emulator ×1