मैं एक प्रोग्राम बना रहा हूं और मैं चाहता हूं कि ऐप अधिसूचना करे। जब अधिसूचना बंद हो जाती है तो केवल टिकर टेक्स्ट प्रदर्शित होता है। इसके साथ कोई ध्वनि या कंपन या प्रकाश नहीं है।अधिसूचना ध्वनि या कंपन नहीं बना रही है?
यहाँ मेरी कोड का एक उदाहरण है:
int icon = R.drawable.icon;
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
Context context = getApplicationContext();
CharSequence contentTitle = "My notification";
CharSequence contentText = "Countdown Complete!";
Intent intent = new Intent();
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
Notification notification = new Notification(icon, myCountDown.getName() + " is completed!", System.currentTimeMillis());
long[] vibrate = {0,100,200,300};
notification.vibrate = vibrate;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.defaults |= Notification.DEFAULT_SOUND;
notification.setLatestEventInfo(context, contentTitle, contentText, pendingIntent);
notificationManager.notify(myCountDown.getId(), notification);
हाँ ध्वनि चालू है और अधिसूचना बंद होने पर मैंने ध्वनि डिंग उठाई। मैं कोड आज़माउंगा और देख सकता हूं कि यह काम करता है या नहीं। – Tj5
मैंने कोशिश की और मुझे एहसास हुआ कि यह कंपन के लिए कम से कम क्या कर रहा है और मेरे कोड को अधिसूचना प्रबंधक को रोशनी और ध्वनि के लिए डिफ़ॉल्ट का उपयोग करने के लिए सूचित करना चाहिए ... तो यह अभी भी काम नहीं करता है – Tj5