Deploying your app via DropBox

Note: The problems that DropBox had which affected this method were fixed on Jan 28, 2013. Everything is working again!

Looking for a way to make your apps available to the world without getting your own website? DropBox could be the answer: best of all, it doesn’t cost anything.

DropBox, if you haven’t used it, lets you put a directory of files from your system in the cloud. To you, it just looks like another directory on your PC or Mac. Behind the scenes, the content of the directory is mirrored on DropBox’s servers. Where it gets really cool is that you can have that same directory on other computers – yours or your friends. Sign up is free, and you’ll get a couple of gigs of storage.
Continue reading “Deploying your app via DropBox”

A change to PhoneGap Splash Screens

PhoneGap have just made a breaking change to their Build process. The result is that splash screens no longer appear on Android devices. Luckily, the fix is easy.

In your Project Properties, open the configxml property. You’ll need to change this line:

<gap:splash src="{splashscreen}" gap:role="default" width="320" height="460"/>

to this

<gap:splash src="{splashscreen}"/>

The next build will make this the default for all new projects. However, you will need to modify on existing projects.

More info here:
https://build.phonegap.com/blog/enhanced-icon-and-splash-support

Ajax Made Simple Part 8: Zip Code Lookup

Ever realize, when getting a user’s address, that knowing the zip code makes asking for the city and state unnecessary?

Here’s some simple code to look up the city and state from a zip code:

zip="90210"

req=Ajax("http://zip.elevenbasetwo.com?zip=" & zip)
If req.status=200 Then 'success
    MsgBox req.responseText
  Else 'failure
    MsgBox "Error: " & req.err.message
End If

The result is

{"country": "US", "state": "CA", "city": "BEVERLY HILLS"}

Using JavaScript in your App

AppStudio lets you code using VB style BASIC or JavaScript. You can even mix the languages in one project: they share the same name spaces, so variables and functions can be freely interchanged.

Why use JavaScript? BASIC is easy and in nearly all cases, all you need to do anything in AppStudio. However, if you already know JavaScript, it works just as well. Plus, there is a huge base of JavaScript code available on the internet. Even if you would rather program in BASIC, you can incorporate this code into your app.

Let’s discuss some of the ways to include JavaScript code into a project.

Continue reading “Using JavaScript in your App”

Sending SMS messages from App Studio

Guest post from Scott Page

Here are screenshots of an app that I made using NSBasic to send out SMS Text alerts to our staff. Most of our employees do not like to carry both pagers and cell phones and prefer to receive messages via SMS on their phones. Our CAD (Computer Aided Dispatch) system does not provide for this functionality. My first attempt was to create email groups with the cell phone number and the carrier (5415551212@vtext.com). This worked but had its own set of problems. Some people would get messages before others and there could be a great delay in between the message being sent and when it was received. I believe this has a great deal to do with how the cell providers handle email submissions. Using this method I had to know each person’s cell provider and if they changed they had to tell me so I could make the changes.

I decided to use SMSified as a SMS provider and used their REST Api to interface with my app. This greatly speeds up the rate at which the text messages are received and provides a consistent phone number that is tied to the alerts we send out (before the messages would be from whoever sent the message).

Continue reading “Sending SMS messages from App Studio”

Ajax made Simple Part 7: Use JSONP to get a stock quote

Working with Ajax, we have run into the Same Origin Policy over and over again. In this post, we’ll show you another way to get around it.

The Same Origin Policy restricts you from loading files from a server not your own. There is an exception: JavaScript (.js) files are allowed.

There are sites on the web where you can request information and have it passed back in JSONP format. The “P” stands for padding: JSONP is JSON with padding. The results are returned as a function call, with the results as parameters. That function can then be called in your program.

Continue reading “Ajax made Simple Part 7: Use JSONP to get a stock quote”

Ajax Made Simple Part 6: Where to put your PHP file

For development, put the PHP files for your project right in your project folder. You can then use any text editor that you have installed on your system to edit them.

Next, add the file names to the manifest in Project Properties. When you do a Full Deploy, they will be copied to the server with the rest of your project.

The result is that your PHP files will be placed on the server, in the same folder as your app. Your app can call a PHP script by just giving the file name – no path name will be needed.

Ajax made Simple Part 5: Asynchronous Calls

In our last Ajax discussion, we discovered that it could take half a second for an Ajax call to complete (actually, due to network latency, it could even be a lot more than that.) How do we do Ajax calls and not make our app look slow?

Easy. We send the Ajax message off, then go do other stuff. When the response comes back, we respond to it. This is called Asynchronous operation.

We do this by adding the name of the function to be called on completion as the 4th parameter of our Ajax call:

req=Ajax("ajax.php/?myText=" + txtSend.value, "", "", done)

Continue reading “Ajax made Simple Part 5: Asynchronous Calls”

Ajax made Simple Part 4: How fast is it?

If your app is going to communicate with your server while it is running, you’ve probably wondered how much your app will slow down when it has to wait for the server.

In this blog post, we’re going to make a program to test this. We’ll construct a little program which sends data to the server as many times as it can. The server will record the information in a log file. Here is what our app will do:

  Do Until SysInfo(10) > limit
    req=Ajax("ajaxLog.php/?myText=" + Now)
    counter=counter+1
  Loop

Continue reading “Ajax made Simple Part 4: How fast is it?”

Using Custom Fonts

It turns out that it is quite easy to use custom fonts in an App Studio project. This is useful if you need a specialized font (not one of the official 13) or want to give your app a unique look. Here’s a step by step guide:

  1. Put the font file in your project directory. It should be in .ttf format.
  2. Drag it from there into your Project Explorer
  3. Add this line to extraheaders in Project CSS:
    @font-face {font-family: sansation; src: url('Sansation_Light.ttf');}
    

    4. Set the fontfamily of your controls to the name of your font face. In this case, it would be ‘sansation’.

    That’s it!

    (See the CustomFont sample in folder 2 to try it out.)