RSS

Category Archives: How-to

2 HowTo: GPS Android App

The GPS functionality now available in HAC apps allows a location determining app to be built that can run continuously either in the foreground or background. The ability of HAC apps to run continuously in the background makes developing such a GPS app quite easy. All it needs is an Android device with either GPS hardware or access to a mobile network that can provide location data.
This post gives a basic overview of GPS location finding and shows the major parts of making your own GPS app with HAC. Fuller details are in the GPS example project included with the HAC installer. There is also both a project and a ready built demo of the GPS app on our Projects web page. The GPS demo app can be installed on an Android device from this link:-
http://www.hypernextandroid.com/binaries/apks/GPS%20Satellite.apk

GPS and Locations
Location finding refers to determining one’s latitude and longitude and is usually simply referred to as GPS.  There are two forms of location finding, GPS using satellites and Assisted GPS where the location information comes from a Mobile Network.
Satellite GPS is much more accurate than Mobile Network assisted GPS and if several satellites are in view then a fix can be accurate down to a few metres. It takes 3 satellites to give a fix for latitude longitude but 4 satellites to give an altitude fix. However, there are a number of drawbacks with satellite GPS. It can take several minutes to give the first fix and also if the sky is obscured by buildings or rock then the device may fail to see a satellite.
Mobile network or assisted GPS is fast and can usually work indoors. Its drawbacks include network charges plus low accuracy, perhaps few hundred meters, depending upon the location of the mobile network towers.

GPS Usage
There are three main steps in getting location information, Firstly to specify the location provider, GPS or Mobile Network. Secondly to specify when location events should be available. Thirdly responding when a location event occurs and processing the information provided.

GPS Demo
The demo included with HAC and on our website has three screens, for Network, GPS, and both Network GPS. Below is a screenshot of it running on an Android G1 phone. The green text is a count of how many fixes it has received.
.
GPS screenshot on Android G1
.
Scripting GPS Demo
As mentioned above there are three steps to acquiring location data and shortened versions of the scripts are shown below. The card displays location values of accuracy, latitude, longitude, altitude and speed using five text controls as shown in the above screenshot. The three scripts are:

1) Specify the location providers, here using both Network and Satellite.
Location Providers

2) Start the location service and request it send update at least very 10000mS and change of 1m.
null

3) Respond to a GPS data event and process it. The event values indicating a fix is available are 4 for first fix, 5 for location changed and 6 for time changed. This script resides in the GPS event hander.
GPS events

Conclusions
It is quite easy to make a basic GPS app with HAC as it provides all the basic functionality required. It also provides functions for converting from numeric values of latitude & longitude to degree, minute and second values, plus functions for handling bearings from one location to another.
The best way to understand how this all fits together is to run the GPS project and play around with it. You can also test it to see if the app can truly work while in the background – once you have installed the GPS app, started it and have some location data returning then send it to the back for a while and then later look at the green fix count – it should have increased.
The GPS app demo is here:-http://www.hypernextandroid.com/binaries/apks/GPS%20Satellite.apk
A word of caution though as not all Android devices are equal and the results can depend upon the device hardware and your mobile network.

 
Leave a comment

Posted by on 20/12/2011 in How-to

 

1 How to: Making Android Apps

This is the start of a series on making Android apps using HAC. It helps if you have already run HAC and have tried to make the Hello World program described here:-
http://www.hypernextandroid.com/hnfiles/progfirst.html

Here is a video http://www.youtube.com/watch?v=lPDb0VcKF1U

However if you are very new to HAC then the links on our HAC website are a good place to start as they cover Installing HAC and building the Hello World program. Writing your first program is very important to understanding this series because it makes you use the HAC designer, introduces you to the layout of a typical HAC android app and gets you to run it on an Emulator or Android device.

Note, if you come here after writing apps in Java and using the Android SDK then you might get a suprise as we don’t cover any of that low-level stuff here because HAC users don’t need to know it. HAC and its screen designer wraps most of that up into simple commands so allowing users to be more productive. HAC doesn’t do everything that the Java and Android SDK can offer but its getting better with every release.

Installing HAC
Installing HAC itself takes just a few minutes but the prerequisite helper programs can take an hour to download with most of the time being spent by the Android SDK updating itself.
The install steps are very simple and are described here:-
http://www.hypernextandroid.com/hnfiles/proginstall.html

HAC Help
There is quite a bit of info around on HAC and its HyperNext programming language. We have two forums covering different aspects of HyperNext. Our HyperNext Studio forum covers using the HyperNext Language and building apps for both Windows and OS X desktop PCs. Our HAC forums are aimed at developings apps for Android devices.  The core HyperNext programming language is almost identical across the various platforms so if you can’t find your answer in one forum it might be in the other.

1. HAC Built in help
HAC comes with built in help that is available from the Guide Menu and Overview option:-Help Memu

2. Help PDF
This is a PDF version of HAC’s built in help and can be searched.
http://www.hypernextandroid.com/binaries/HAC_help.pdf

3. Quickstart PDF
The Quickstart PDF is really meant for HyperNext Studio users but still has a lot in common with HAC.
http://www.tigabyte.com/docs/QuickStart.pdf

4. Language Reference PDF
The Language Reference PDF is meant for HyperNext Studio users but much of the content also applies to HAC programs.
http://www.tigabyte.com/docs/LanguageReference.pdf

Hello World Program
This describes how to create an Hello World program and also has a link to our YouTube Hello World video:-
http://www.hypernextandroid.com/hnfiles/progfirst.html

If you haven’t already done so then please try this because then you will see how easy it is to create an Android app with HAC.

 
3 Comments

Posted by on 19/09/2011 in HAC, How-to