में साथ जवाब के लिए Android source देखें:।
<!-- Default color for notification LED. -->
<color name="config_defaultNotificationColor">#ffffffff</color>
<!-- Default LED on time for notification LED in milliseconds. -->
<integer name="config_defaultNotificationLedOn">500</integer>
<!-- Default LED off time for notification LED in milliseconds. -->
<integer name="config_defaultNotificationLedOff">2000</integer>
हालांकि विभिन्न रोम इन अलग-अलग मान हो सकता है उदाहरण के लिए मेरा रिटर्न config_defaultNotificationLedOff
के लिए 5000
तो तुम हो सकता है।
Resources resources = context.getResources(),
systemResources = Resources.getSystem();
notificationBuilder.setLights(
ContextCompat.getColor(context, systemResources
.getIdentifier("config_defaultNotificationColor", "color", "android")),
resources.getInteger(systemResources
.getIdentifier("config_defaultNotificationLedOn", "integer", "android")),
resources.getInteger(systemResources
.getIdentifier("config_defaultNotificationLedOff", "integer", "android")));
diff के अनुसार, इन विशेषताओं exis की गारंटी है: उन्हें रनटाइम पर लाने के लिए चाहते हैं एंड्रॉइड 2.2+ (एपीआई स्तर 8+) पर टी।
क्षमा करें, लेकिन यह उलझन में है। यू अधिसूचना नोट = = बिल्डर का उपयोग करें। वह नहीं चलता है। इसके अलावा मैं बिल्ड() को कॉल नहीं कर सकता। (मैं सबसे छोटा एसडीके 8 के रूप में उपयोग करता हूं)। तो मुझे builder.getNotification(); को कॉल करना होगा। लेकिन यह भी नहीं चल रहा है ... – StefMa
@StefanM। मैंने अपने नमूना प्रोजेक्ट से वास्तविक कोड के साथ अपना जवाब अपडेट किया। 'अधिसूचना कॉम्पेट.बिल्डर .बिल्ड 'एपीआई स्तर 3 से उपलब्ध है। –
केवल अधिक उलझन में ... बिल्ड() उपलब्ध नहीं है ग्रहण! और setIcon भी ... – StefMa