如何使用 Parse 库将大视图样式应用于通知 [英] How to apply a big view style to a notification using Parse library

查看:19
本文介绍了如何使用 Parse 库将大视图样式应用于通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个库运行良好,但我有疑问.

This library works perfectly, but i have a doubt.

当我向超过两行的用户发送消息时,用户无法在通知区域看到所有消息.

When I send a message to users with more than two lines, users can't see all message in notification area.

但我知道ANDROID可以做到

But I know that ANDROID can do it

http://developer.android.com/guide/topics/ui/notifiers/notifications.html#ApplyStyle.如何从 parse.com 获取通知?

http://developer.android.com/guide/topics/ui/notifiers/notifications.html#ApplyStyle. How to do it for notification from parse.com ?

看图片来解释我的问题

图片1 http://gorio.eng.br/parse1.png

Image2 http://gorio.eng.br/parse2.png

推荐答案

Bitmap icon1 = BitmapFactory.decodeResource(getResources(),
                    R.drawable.gorio);

            NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
                    getApplicationContext()).setAutoCancel(true)
                    .setContentTitle("Exemplo 1")
                    .setSmallIcon(R.drawable.gorio)
                    .setLargeIcon(icon1).setContentText("Hello World!");

            NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle();
            bigText.bigText(msg);
            bigText.setBigContentTitle("GORIO Engenharia");
            bigText.setSummaryText("Por: GORIO Engenharia");
            mBuilder.setStyle(bigText);
            mBuilder.setPriority(NotificationCompat.PRIORITY_MAX);

            // Creates an explicit intent for an Activity in your app
            Intent resultIntent = new Intent(getApplicationContext(),
                    MainActivity.class);

            // The stack builder object will contain an artificial back
            // stack for
            // the
            // started Activity.
            // getApplicationContext() ensures that navigating backward from
            // the Activity leads out of
            // your application to the Home screen.
            TaskStackBuilder stackBuilder = TaskStackBuilder
                    .create(getApplicationContext());

            // Adds the back stack for the Intent (but not the Intent
            // itself)
            stackBuilder.addParentStack(MainActivity.class);

            // Adds the Intent that starts the Activity to the top of the
            // stack
            stackBuilder.addNextIntent(resultIntent);
            PendingIntent resultPendingIntent = stackBuilder
                    .getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
            mBuilder.setContentIntent(resultPendingIntent);

            NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

            // mId allows you to update the notification later on.
            mNotificationManager.notify(100, mBuilder.build());

这篇关于如何使用 Parse 库将大视图样式应用于通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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