私はアンドロイドで通知をいじっていますが、なぜ NotificationCompat が大きなアイコンを表示せず、ジンジャーブレッドの番号がジェリービーンのように表示されないのか疑問に思っています (写真を参照)。
通知を起動する方法は次のとおりです。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnShow = (Button)findViewById(R.id.btnNotif);
Intent intent = new Intent(this, NotificationReceiverActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setWhen(System.currentTimeMillis())
.setContentText("You are near your point of interest.")
.setContentTitle("Proximity Alert!")
.setSmallIcon(android.R.drawable.ic_menu_info_details)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.orchide))
.setAutoCancel(true)
.setTicker("Proximity Alert!")
.setNumber(10)
.setContentIntent(pIntent)
.setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_VIBRATE| Notification.DEFAULT_SOUND);
/*Create notification with builder*/
notification=notificationBuilder.build();
/*sending notification to system.Here we use unique id (when)for making different each notification
* if we use same id,then first notification replace by the last notification*/
btnShow.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
notificationManager.notify(1000, notification);
}
});
}