1

我已經成功地從樣本中實施了gcm,並且可以收到通知消息,但是當我從欄中向下拖動時,文本的一部分會出現在選項卡中。通過單擊通知欄中的選項卡打開(警報)對話框

我不知道如何打開(警告)對話框,當點擊標籤並顯示整個消息。

有人嗎? 來自荷蘭的感謝!

protected void onMessage(Context arg0, Intent arg1) { 
Log.i(TAG, "new message= "); 
String ticker=arg1.getExtras().getString("ticker"); 
String subject=arg1.getExtras().getString("subject"); 
String message=arg1.getExtras().getString("message"); 

Vibrator vibrator = (Vibrator) arg0.getSystemService(Context.VIBRATOR_SERVICE); 
vibrator.vibrate(1000); 

String ns = Context.NOTIFICATION_SERVICE; 
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); 
int icon = R.drawable.ic_launcher; 
CharSequence tickerText = ticker; 
long when = System.currentTimeMillis(); 
Notification notification = new Notification(icon, tickerText, when); 
Context context = getApplicationContext(); 
CharSequence contentTitle = subject; 
CharSequence contentText = message; 
Intent notificationIntent = new Intent(this, FragmentActivity.class); 
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); 
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 
final int HELLO_ID = 1; 
mNotificationManager.notify(HELLO_ID, notification); 

回答

0

PendingIntent需要的東西的SystemUI可以從包的外部開始,因此要確保類是在你的清單中聲明。

更多信息可在Notifications guide中找到。