0

I am actually working on a demo in which i want to do some tasks when i got triggered from sl4a but according to my understanding it can only call android api's but what if i want to do some custom task or you can say that define a command that will run my custom piece of code or my API. correct me if am wrong somewhere.

Thanx

varun bhardwaj
  • 1,522
  • 13
  • 24
  • What custom task? and what custom piece of code? You'll have to be more specific. Is your API a restful one? – Stephan Branczyk Mar 14 '13 at 07:07
  • like if i want to turn on the wifi and send sms in one task or you can say that if i want to run my piece of code is it possible – varun bhardwaj Mar 14 '13 at 07:21
  • Sending an sms shouldn't be a problem, but unless your device is rooted, I don't think Android allows you to turn on wifi (if the user has it turned off in the preferences). Of course, I could be wrong about that. There could be some undocumented feature that I do not know about. – Stephan Branczyk Mar 14 '13 at 07:26
  • Are you looking to launch an SL4A script from within a different SL4A script? – Carl Smith Mar 14 '13 at 18:38
  • @Stephan: You can control WiFi without root I think. SL4A supports it. – Carl Smith Mar 15 '13 at 00:59
  • my purpose is to embed a custom command with in sl4a is it possible as sl4a a is open source. – varun bhardwaj Mar 15 '13 at 13:09

1 Answers1

0

Sending an sms is very simple, using the API -

[code]

droid.smsSend(number, body);

[/code]

but turning off the wifi adapter doesn't seem to be supported in sl4a - the closest you'll come is

[code]

 droid.wifiDisconnect();

[/code]

Unless you know how to import some of the hidden java api's - which I'm still trying to figure out.

These api calls are documented in sl4a's built-in "API browser," found in the menu while editing a script, which makes it easier to determine what the native API is or isn't capable of .

I hope this helps

Jeff Darcy
  • 69
  • 8
  • Any of the Java API which isn't exposed through `android.Android` is impossible to access from Python. Only the languages who's interpreter is implemented in Java can do that. Py4A uses CPython. – Carl Smith Aug 29 '13 at 23:13