InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Sl4a Won't Install Interpreters On An Emulator? |
|
Answer» In fact, SL4A works fine on EMULATORS, having been to a LARGE degree developed on them. But these interpreters REQUIRE a bit of ROOM, and the default AVD size for a sdcard is on 16Mb. This is inadequate. I would allocate a minimum of 128Mb, and in fact commonly set mine to 512Mb. Bear in mind that it's unusual to get an Android device with less than 2Gb these days. In fact, SL4A works fine on emulators, having been to a large degree developed on them. But these interpreters require a bit of room, and the default AVD size for a sdcard is on 16Mb. This is inadequate. I would allocate a minimum of 128Mb, and in fact commonly set mine to 512Mb. Bear in mind that it's unusual to get an Android device with less than 2Gb these days. |
|
| 2. |
What's Logcat? |
|
Answer» Logcat is a ROTATING log of MESSAGES that ANDROID produces. It's a very useful tool for programmers to work out what exactly is going on if someone reports and error. It's a requirement in our ISSUES reporting to attach a logcat WHEREVER possible. Logcat is a rotating log of messages that Android produces. It's a very useful tool for programmers to work out what exactly is going on if someone reports and error. It's a requirement in our Issues reporting to attach a logcat wherever possible. |
|
| 3. |
Where's Php? |
|
Answer» There is a PHP INTERPRETER, which is a SEPARATE project. The PHP INSTALLER and interpreter can be FOUND there. There is a PHP interpreter, which is a separate project. The PHP installer and interpreter can be found there. |
|
| 4. |
Where's Javascript? |
|
Answer» JAVASCRIPT is implemented using the Mozilla Rhino PROJECT and V8. Look for "Rhino" in the INTERPRETER downloads. Or, write an HTML script to use V8. JavaScript is implemented using the Mozilla Rhino project and V8. Look for "Rhino" in the interpreter downloads. Or, write an HTML script to use V8. |
|
| 5. |
What Usage Information Does Sl4a Collect? |
|
Answer» If you enable "Usage Tracking", the application will collect ANONYMOUS usage INFORMATION through GOOGLE ANALYTICS. If you enable "Usage Tracking", the application will collect anonymous usage information through Google Analytics. |
|
| 6. |
Can I Use Sl4a For Ui Automation? |
|
Answer» No. For security reasons, it is only POSSIBLE for the shell USER to INJECT UI events into arbitrary applications. See UI/Application Excersier in the Android documentation. No. For security reasons, it is only possible for the shell user to inject UI events into arbitrary applications. See UI/Application Excersier in the Android documentation. |
|
| 7. |
My Script Stops Working When The Screen Turns Off! Wtf? |
|
Answer» Your phone turns the screen off, among other things, when it GOES to sleep. If an application doesn't request that it keep RUNNING when the phone is asleep, it will stop running until the phone wakes up again (i.e. you turn the screen back on). Requesting that the device remain on while your application is running is called a wake lock. SL4A provides APIs for acquiring and releasing wake locks. It is important to note that wake locks SIGNIFICANTLY impact battery life. You should always RELEASE a wake lock as soon as possible. Instead of using a wake lock, you can also enable the "Stay awake" system setting. From your home screen tap Menu, Applications, Development, and CHECK Stay awake. With that enabled, your phone will never sleep while charging. This does affect the amount of time it takes to charge your phone, however. Your phone turns the screen off, among other things, when it goes to sleep. If an application doesn't request that it keep running when the phone is asleep, it will stop running until the phone wakes up again (i.e. you turn the screen back on). Requesting that the device remain on while your application is running is called a wake lock. SL4A provides APIs for acquiring and releasing wake locks. It is important to note that wake locks significantly impact battery life. You should always release a wake lock as soon as possible. Instead of using a wake lock, you can also enable the "Stay awake" system setting. From your home screen tap Menu, Applications, Development, and check Stay awake. With that enabled, your phone will never sleep while charging. This does affect the amount of time it takes to charge your phone, however. |
|
| 8. |
Can I Run An Sl4a Script From My Application? |
|
Answer» Yes. See IntentBuilders.java. |
|
| 9. |
Will Sl4a Work On My Android Device That's Not Built On Arm (e.g. X86)? |
|
Answer» Yes and no. All CROSS compiled interpreters are compiled for ARM. JAVA BASED interpreters like JRUBY, BEANSHELL, and Rhino will work. Yes and no. All cross compiled interpreters are compiled for ARM. Java based interpreters like JRuby, BeanShell, and Rhino will work. |
|
| 10. |
Will Sl4a Work On An Android Emulator? |
|
Answer» YES. USE ADB INSTALL sl4a_rnn.apk to install it to the EMULATOR. Yes. Use adb install sl4a_rnn.apk to install it to the emulator. |
|
| 11. |
Can I Use Sl4a To Write A Real Android Application Or Embed Sl4a Scripts In My Application? |
|
Answer» Yes! You can EMBED your SCRIPT in a (mostly) stand ALONE APK. Yes! You can embed your script in a (mostly) stand alone APK. |
|
| 12. |
How Do I Install Sl4a? |
Answer»
|
|
| 13. |
Can I Run Scripts As Root? |
|
Answer» If you have a rooted phone, you MAY be INTERESTED in doing so. At the moment, SL4A does not SUPPORT this directly. If you have a rooted phone, you may be interested in doing so. At the moment, SL4A does not support this directly. |
|
| 14. |
Where Are The Sample Scripts And Other Interpreters? |
|
Answer» As of RELEASE 0.8 ALPHA, INTERPRETERS and sample scripts are distributed separately. Please READ InstallingInterpreters for directions on how to ADD them. As of release 0.8 alpha, interpreters and sample scripts are distributed separately. Please read InstallingInterpreters for directions on how to add them. |
|
| 15. |
What Do I Do With All These Barcodes? |
|
Answer» Barcodes are a EASY way to access a web link on your phone (e.g. to download SL4A). Barcodes are a easy way to access a web link on your phone (e.g. to download SL4A). |
|
| 16. |
Is This A Complete Api Bridge, Or Are There Restrictions? |
|
Answer» BeanShell, JRuby, and Rhino basically give you a COMPLETE API bridge (you can invoke Java calls directly). See the documentation for those interpreters for instruction on how to accomplish this. CROSS compiled languages like Lua are more RESTRICTED. They only have access to the APIS EXPOSED through the RPC layer. BeanShell, JRuby, and Rhino basically give you a complete API bridge (you can invoke Java calls directly). See the documentation for those interpreters for instruction on how to accomplish this. Cross compiled languages like Lua are more restricted. They only have access to the APIs exposed through the RPC layer. |
|
| 17. |
Are Scripts First-class Apps From The Point Of View Of The System? |
|
Answer» Yes, mostly. You can invoke arbitrary intents and there are also plans to support broadcast RECEIVER scripts. That is, you could write an APP that CONSUMES photos and shows up in the list of apps when the user presses Share in the Camera app. It is not currently possible to write a SCRIPT that will exit with a result (e.g. another Android activity starts your activity for result). Yes, mostly. You can invoke arbitrary intents and there are also plans to support broadcast receiver scripts. That is, you could write an app that consumes photos and shows up in the list of apps when the user presses Share in the Camera app. It is not currently possible to write a script that will exit with a result (e.g. another Android activity starts your activity for result). |
|
| 18. |
Does Sl4a Compile The Supported Languages To Dex Bytecode Or Is There An Additional Layer Of Interpretation? |
|
Answer» It depends on the language a BIT. BeanShell is run in the JVM and has an additional layer of interpretation. Lua, Python, and Perl are actually the C versions running natively. All INTERACTION with Android is over RPC CHANNELS. Still, the RPC API is compiled to dex so there's no additional interpretation in Java (other than reflection). It depends on the language a bit. BeanShell is run in the JVM and has an additional layer of interpretation. Lua, Python, and Perl are actually the C versions running natively. All interaction with Android is over RPC channels. Still, the RPC API is compiled to dex so there's no additional interpretation in Java (other than reflection). |
|
| 19. |
How Does Sl4a Work? |
|
Answer» SL4A provides Android facades which MAKE APIS available via JSON RPC CALLS. Only the parts of Android's APIs which has been wrapped by facades are available to INTERPRETERS. SL4A provides Android facades which make APIs available via JSON RPC calls. Only the parts of Android's APIs which has been wrapped by facades are available to interpreters. |
|
| 20. |
Why Sl4a? Android Programs Are Easy Enough To Write.? |
|
Answer» That's very true. Android's development environment does make life pretty easy. But, you're tied to a computer to do your WORK. SL4A lets you TRY out an idea now, in the SITUATION where you need it, QUICKLY. That's very true. Android's development environment does make life pretty easy. But, you're tied to a computer to do your work. SL4A lets you try out an idea now, in the situation where you need it, quickly. |
|
| 21. |
What Is Scripting Layer For Android (sl4a) For? |
|
Answer» SL4A makes it possible to quickly prototype APPLICATIONS for Android on the DEVICE itself using high-level SCRIPTING languages. These scripts have ACCESS to many of the APIs available to full-fledged Android applications, but with a greatly simplified interface. SL4A makes it possible to quickly prototype applications for Android on the device itself using high-level scripting languages. These scripts have access to many of the APIs available to full-fledged Android applications, but with a greatly simplified interface. |
|