I was looking all over for an SDK (or API) to launch the wonderful new Google 
Maps for Palm application (free). It would be great to be able to have your 
application launch the Google Maps application, and show the map of a 
particular site.
Therefore, in the true Palm developer spirit, I decided to hack the Find and 
Goto launch codes of Google Maps, so that the developer can simulate a goto 
launch. It wasn't too hard, and following is the code.
Please note: Since this is undocumented from Google, it might break in future 
releases. The best thing would be for Google to release a SDK with custom 
launch codes. Even better would be, if they would register it as a helper 
application, thus allowing the end-user do decide which map application (if 
there will be any others) to use. I would suggest in future versions, that the 
launch-helper notification should a value for the calling application's 
creatorID and some data, so that the map application could have a "Return to 
<Application>" button. If you want to keep this thread alive, just add 
suggestions, maybe they will get back to Google. :-)

And here is the code:

#define googleMapCreatorID              'GLM.'
#define googleMapPreferenceID           1
#define googleMapPreferenceVersion      1

typedef enum
{
        googleMapFindLocation = 0,
        googleMapFindBusiness = 1,
        googleMapDirectionsTo = 2,
        googleMapDirectionsFrom = 3
}googleMapFindType;

Boolean LaunchGoogleMap(const Char * findStr, googleMapFindType findType);

Boolean LaunchGoogleMap(const Char * findStr, googleMapFindType findType)
{
        UInt16 cardNo;
        LocalID dbID = 0;
        DmSearchStateType stateInfo;
        if (errNone == DmGetNextDatabaseByTypeCreator(true, &stateInfo,  
sysFileTApplication, googleMapCreatorID, false, &cardNo, &dbID) && dbID)
        {
                GoToParamsType * cmdPBP = (GoToParamsType 
*)MemPtrNew(sizeof(GoToParamsType));
                MemPtrSetOwner(cmdPBP, 0);
                MemSet(cmdPBP, sizeof(GoToParamsType), 0);
                cmdPBP->recordNum = findType;     
                PrefSetAppPreferences(googleMapCreatorID, 
googleMapPreferenceID, googleMapPreferenceVersion, findStr, StrLen(findStr), 
false);
                SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdGoTo, cmdPBP);
                return true;
        }
        return false;
}


-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to