Android Question Shortcut / view with action attached added to lockscreen in Android 11

JohnK

Active Member
Licensed User
Longtime User
Is it possible to add a shortcut/view on the lockscreen using B4A, on A11? Its a personal project. ie for my use only

I am rooted, and running Pixel 4a with the latest stock Android 11. I previously always have run custom ROMs with middle lock screen shortcuts, configurable by the user. Even custom ROMs in android 10+ have stopped adding this feature, which I found very useful. I am hopping I will be able to duplicate it for myself in B4A. I am guessing all he security addition in A11 would stop it as an avenue of possible abuse.
 

Attachments

  • Screenshot_20210111-150020.png
    Screenshot_20210111-150020.png
    27.7 KB · Views: 112

JohnK

Active Member
Licensed User
Longtime User
actually, just saw an idea on reddit that on first glance, may simulate the above.

If I was to create a persistent notification, could I use that to display multiple icons, and then retrieve which icon (ie where about on the notification) the user clicked?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If I was to create a persistent notification, could I use that to display multiple icons, and then retrieve which icon (ie where about on the notification) the user clicked?
Yes. Add a service and make it a foreground service. Now add more notifications and set them to be ongoing notifications.

You can use the notification_tag field to include more information about each notification.
 
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
I also read some more after I posted the above, but the extra details I found, was that the icons are not visible until after the notification is clicked on; it just text before that.

So, it would basically fail, in that it would only be text until it is clicked on. Is that correct. i.e. it will only be text until clicked on?
 
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
Thanks, I''then give it a go. I read somewhere that for android 11, the lock-screen notification is only text, and the icons only become visible after the notification is clicked on.

My plan, if it (ie icons) works, is to listen to the lock intent to show icons when locked, and hide/cancel the notification when the phone is unlocked. That's the idea, but with all the security restrictions that really affect how A11 works, just from a user perspective,I'm not expecting it to work. I think when I was doing a search, there might be an app on the playstore that does something similar.
 
Last edited:
Upvote 0

JohnK

Active Member
Licensed User
Longtime User
Just tried an app I found on the playstore. It DOES show the icons on the lock screen, but because I have security to unlock, when I click one of the app icons on the notification on the lock-screen, the notification simply disappears. When I unlock (using fingerprint), nothing special, except when I click (and hold I think) the notification in the status bar, the selected app from the lock-screen is started.It looks like it would be too much effort for such a nice to have.

Thanks for your help anyway.
 
Upvote 0
Top