<whew> Done with work fo…

<whew> Done with work for now.   I learn something new every time I compile a new APK version.  Time to relax for a bit!

Getting ADB to work with my Captivate

When I first developed a few APKs, it wasn’t too difficult to get everything to work without the ADB (that’s the Android Developer Bridge) but it was a bit cumbersome and time consuming. I couldn’t get ADB to recognize my phone when it was plugged in. Every site I ever went to had the same simple steps:

  • Install the Android SDK
  • Make sure the phone is set to USB debugging mode before you plug it in
That seems pretty simple, right?  Unfortunately with “simple” also comes the inability to really troubleshoot much because everyone expects it to “just work”.  Sort of like a Mac.  :)
Anyway, I finally did get my Samsung Captivate (SGH-i897) to run with ADB and here are the steps that I took to get it to work.  Note that I’m using Windows 7 x64.
  1. Install the Android SDK from here: http://developer.android.com/sdk/index.html
  2. Once installed, follow the guide here to add the Android repository to the Android SDK :http://developer.android.com/sdk/installing.html
  3. Once you have the Android repository, look for the “Google USB Driver package”.
  4. Alternatively, you can look here for more details: http://developer.android.com/sdk/win-usb.html just keep in mind that the only way to actually download it is through the SDK.
  5. Once the USB drivers are installed, you can plug your phone in (make sure USB debugging mode is enabled)
  6. Open the control panel and go to System (you might need to show all control panel items to see it)
  7. In System, open the Device Manager
  8. You should see your phone by “Other Devices”, but it’ll probably have a yellow exclamation point next to it meaning that Windows doesn’t recognize the drivers
  9. Right-click on your phone and choose Update Driver Software
  10. Browse to the location of the USB drivers that you just downloaded through the SDK.  For me, this was C:\Program Files (x86)\Android\android-sdk\extras\google\usb_driver
You should now be able to use ADB with your phone!  To test this, open a command prompt and type in adb devices.
A few things of note that I should mention are that for one, I do not have the Samsung Captivate drivers from Samsung installed.  I tried getting them to work, but it didn’t fix my problem.   The reason it didn’t is because the system is looking for the ADB drivers for the USB connection and not the phone drivers.   Another thing that is noteworthy is that Google’s page that talks about the USB drivers (found here) have the following statement:
The Google USB Driver is only for Android Developer Phones (ADP), Nexus One, and Nexus S. If you’re using a different Android-powered device, then you need to get a USB driver from the device OEM. For help finding the appropriate driver, see the list of OEM USB Drivers.
I’m not sure if they consider my phone magically an ADP once I start using it for development, but I know they have phones for sale that are specifically development phones so as a result this statement is either inaccurate or misleading.  In either case, enjoy running ADB!

Just beat Battlefield: Bad Com…

Just beat Battlefield: Bad Company 2.  So…is Battlefield 3 going to be the Alaskan invasion, or is that for Bad Company 3 later on?

Tasker Auto-Respond to SMS

I’ve used Tasker for a while, but just recently I decided to try out some profiles from others.   One cool profile that I found is the profile to automatically reply to an SMS message when driving.   But it requires a little bit of work to get it to actually function.   So here’s the steps I took to get it to work.  Keep in mind that I’m currently running the Cyanogen mod, so some of these steps may work out of the box for you if you’re running a stock ROM.

  1. Download the profile from the Tasker Wiki here: http://tasker.wikidot.com/autorespondwhiledriving
  2. Notice that this profile is looking for a task called “Convert_LOCSPD_MPH”.  This task basically sets the variable that converts the speed to MPH.  So we’ll have to create that.
  3. Click “Tasks”
  4. Click “New Task +”
  5. Give your task a name.  For mine, I used “ConvertMPH” just because it’s simple to know that’s what it does.
  6. Click the “+” in the task to add a new action.
  7. Click “Variable”
  8. Click “Variable Set”
  9. In the “Name” field, type %LOCSPDMPH
  10. In the “To” field, type %LOCSPD * 2.23693629
  11. Check the “Do Maths” checkbox
  12. Click “Done” to save changes to the action
  13. Click “Done” to save your task
  14. OK, now the task is created.  Let’s go plug it into the profile.
  15. Open the “Received Text” profile
  16. Click the “Auto Respond (If Driving)” task
  17. Click “Edit”
  18. For whatever reason, simply re-linking the “Perform Task” action didn’t work for me.  I kept getting an error that said the task doesn’t exist when trying to test it.  So I had to delete it and re-create it to get it to work.
  19. Long-click on the “Perform Task” with the name “Convert_LOCSPD_MPH” and then drag it to the trash can.   This will delete that action, but we’ll want to recreate it.
  20. Click the “+” icon to add a new action.
  21. Click “Tasker”
  22. Click “Perform Task”
  23. Above the “Name” field you’ll see a magnifying glass.  Click this and then choose the task you just created a little bit ago.   For me, it was the “ConvertMPH” task.
  24. Click “Done” to save your action.
  25. Now long-click on the “Perform Task” action and then move it above the “Send SMS” actions.
  26. So the final order of the actions are: 1) Goto Action 2) GPS 3) Get Location 4) Perform Task 5) Send SMS
  27. Click “Done” to save your task

OK so the task is all set up.  Now to test it.  How can you test it without actually driving, though?  Well, we can actually take out the variable that checks the speed to test it.  Before you do this, though, send yourself a text message because this task will automatically reply to whomever the last person who text’d you.  So if you don’t send yourself a text message then whomever sent you a text message last will get an auto-reply from you.
Once you’ve sent yourself a text message, go back to Tasker and open up the “Auto Respond (If Driving)” task under the “Received Text” profile.

Open up the “Send SMS” action (should be number 5).  Scroll down and you’ll find an IF statement that says %LOCSPDMPH > 5.  Basically that means that this will only send an SMS if the GPS reports that you’re going greater than 5 MPH.  So to test this, simply uncheck the checkbox to the right of “If” to turn off that if statement.   Note: In here is where you can choose to store the SMS in your messaging app (if you want to see it in your sent folder of your SMS application as well as change the text of the actual SMS message as well.  But if you’re running a test, don’t make any changes yet.  Make sure it works first and then come back and change the text if that’s what you want to do.

Once the “If” statement is disabled, click “Done” to save the action.  Then click the “Test” button on the task.  Once you click “Test” you’ll notice a “Kill All” button that shows up to the left of “Test”.  That means Tasker is working to run the task.   Wait for the “Kill All” button to go away.  Once it goes away, click “Cancel” to close out of the task.   If you click “Done” it will save your changes and you’ll have to go back in to add the if statement again.
That’s it!  You should now have a new text message that says something to the effect of:

(Auto) Texting and driving is dangerous.  I’m currently driving (at 0 MPH).  Will respond to you when I can safely.

By the way, the 0 MPH isn’t anything to worry about since this is just a test and quite obviously as you’re testing this you’re not going to be actually driving.  :)