Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sl4a python notify question

I have two questions regarding the sl4a scripting language. I'd like to develop a python script that will be periodically contacted by a server and post some information to the notification bar.

I've successfully add message to the notification bar, but

  1. The notification icon is always sl4a logo. Is there a way to change it to something else? (I don't mind to use some hack method such as rename the resource file, if that will work...)
  2. When I click the notification, it just remove the message. I'd like to add some intent that would take the user to certain app or webpage. Is it possible?

Thanks!

like image 605
Patrick Avatar asked Aug 29 '11 02:08

Patrick


1 Answers

  1. Officially, there is no API exposed to SL4A for customization of notifications which exist does exist in Android.
    Reference: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomExpandedView http://code.google.com/p/android-scripting/wiki/ApiReference

  2. Officially, there is no API exposed to SL4a for firing an intent on user click from user. .

    notify(
     String title: title,
     String message)
    

Notify, just displays a notification that will be canceled when the user clicks on it. Now, somehow if you can trace cancellation of this notification, you can start a new intent using your script.

Hack?

Please note, Android treats these notification from SL4A and not from your script. (due to which you are getting the SL4A icon) Thus, somehow it is possible to use all API which are exposed to a normal JAVA code, treating SL4A as an application but then this approach will make all your apps using SL4a have the same logo. ;)

like image 156
3 revs, 2 users 97% Avatar answered Nov 13 '22 18:11

3 revs, 2 users 97%