2010-07-07 8 views
1
Notification notification = new Notification(icon, tickerText, when); 
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); 
notification.defaults |= Notification.DEFAULT_SOUND; 
notification.defaults |= Notification.DEFAULT_VIBRATE; 
notification.defaults |= Notification.DEFAULT_LIGHTS; 
notification.flags |= Notification.FLAG_AUTO_CANCEL; 

notification.flags |= Notification.FLAG_SHOW_LIGHTS; 
notification.ledARGB = 0xff00ff00; 
notification.ledOnMS = 300; 
notification.ledOffMS = 1000; 

Change in manifest : 
<uses-permission 
     android:name="android.permission.VIBRATE"></uses-permission> 

나는 위의 코드를 추가했습니다. 오류없이 실행됩니다. 그러나 효과는 보이지 않습니다. 그것은 안드로이드 1.5에서 실행됩니까 ???벨소리 및 진동 전화 재생 중

답변

1

알림 관리자 호출에이 알림 설치를 래핑해야합니다.

하는 일부 자습서를 참조하십시오에 대한 notificationmanager

mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
mManager.notify(APP_ID, notification); 
관련 문제