开发者

sl4a python notify question

开发者 https://www.devze.com 2023-03-31 04:09 出处:网络
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 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开发者_JS百科 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!


  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. ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消