Android Push Notification Message Cut off -
hi im working on project uses push notifications push out information in text format. when receive push notification text cut off , replaced "..."
im using notificationcompaq builder build notifications when app receives information receiver.
here gcmbroadcastreceiver im pretty sure issue in builder im not sure need fix it.
import utilities.commonutilities; import android.app.activity; import android.app.notificationmanager; import android.app.pendingintent; import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.support.v4.app.notificationcompat; import android.util.log; import android.widget.toast; import com.google.android.gms.gcm.googlecloudmessaging; /** * handles incoming messages server. * */ public class gcmbroadcastreceiver extends broadcastreceiver { static final string tag = "gcmdemo"; public static final int notification_id = 1; private notificationmanager mnotificationmanager; notificationcompat.builder builder; context ctx; @override public void onreceive(context context, intent intent) { googlecloudmessaging gcm = googlecloudmessaging.getinstance(context); ctx = context; string messagetype = gcm.getmessagetype(intent); string message = intent.getextras().getstring("price"); if (googlecloudmessaging.message_type_send_error.equals(messagetype)) { sendnotification("send error: " + intent.getextras().tostring()); } else if (googlecloudmessaging.message_type_deleted.equals(messagetype)) { sendnotification("deleted messages on server: " + intent.getextras().tostring()); } else { sendnotification(message); } setresultcode(activity.result_ok); } // put gcm message notification , post it. private void sendnotification(string msg) { mnotificationmanager = (notificationmanager) ctx.getsystemservice(context.notification_service); pendingintent contentintent = pendingintent.getactivity(ctx, 0, new intent(ctx, mainactivity.class), 0); notificationcompat.builder mbuilder = new notificationcompat.builder(ctx) .setsmallicon(r.drawable.icon) .setcontenttitle(commonutilities.pushtitle) .setstyle(new notificationcompat.bigtextstyle()) .setcontenttext(msg) .setlights(0xff00ff00, 300, 1000) .setvibrate(commonutilities.pattern); log.d(tag, "notification built " + mbuilder.tostring()); mbuilder.setcontentintent(contentintent); mnotificationmanager.notify(notification_id, mbuilder.build()); toast.maketext(ctx, "new message: " + msg, toast.length_long).show(); } }
any on appreciated thanks.
edit ive checked message received gcm before app builds notification , receiving full message there nothing being cut off during receiving of message notification builder. cannot seem figure out whats causing that.
Comments
Post a Comment