Android Question Setting n.Light = True does not work

DickD

Active Member
Licensed User
I tried getting the light to flash on 3 different platforms with Android 4.4, 6.0.1 and 4.2.2. It didn't work on any of them. The other notify methods like AutoCancel, sound and vibrate all worked well.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

DickD

Active Member
Licensed User
Setting Notification.Light to true means that the system default light mode will be used. It is possible that it is disabled by default.

I recommend you to use NotificationBuilder as it provides more options. Post here if you still wasn't able to get the notification lights to work.
https://www.b4x.com/android/forum/threads/notification-builder-library.27376/#content
I followed your link to the Notification Builder Library but was not able to install it. It uses the android-support-v4.jar file which is no longer available in the current version of the Android SDK. I was not able to locate the file elsewhere. I posted a reply to the author.
 
Upvote 0

DickD

Active Member
Licensed User
Add this line instead:
B4X:
#AdditionalJar: com.android.support:support-v4
I already tried this as per the library installation instructions. I still get the error "Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\android-support-v4.jar"
 
Upvote 0

DickD

Active Member
Licensed User
Add this line instead:
B4X:
#AdditionalJar: com.android.support:support-v4
I found that this line needs to be added to the attributes section of the app and NOT to the manifest editor as per the installation instructions. But unfortunately this also does not turn on a light on any of the 3 phones I tested. I tried both DefaultLight and setCustomLight. Neither worked.
 
Upvote 0

An Schi

Well-Known Member
Licensed User
Are you testing the notification wirh firebase?
If yes, you should not send the push via firebase console, send it with b4j instead.
 
Upvote 0

DickD

Active Member
Licensed User
Are you showing the notification when the screen is off?
Yes I see/hear/feel the notifications when the screen is off and surprisingly the light also flashes. It's only when the screen is on that the light doesn't flash.
 
Upvote 0

DickD

Active Member
Licensed User
This is how Android works. The light only appears if the screen is off.
I guess I never thought about this but yes, it looks like the light flashes only when the screen is off. I assumed that it was something that could be controlled by the app. Thanks.
 
Upvote 0
Top