John.Wiley.and.Sons.Rapid.Mobile.Enterprise.Development.for.Symbian.OS.An.Introduction.to.OPL.Application.Design.and.Programming.May.2005.eBook-LinG (779881), страница 23
Текст из файла (страница 23)
In small applications, this cansometimes be just enough to get people to register. For example, in PROCInit: you can add a simple IF statement around an information dialog:...IF KRegistered%=0dINIT "Please Register"dTEXT "","This version of "+KAppName$+" is",2dTEXT "","not registered. Please visit",2dTEXT "","http://www.yourwebsite.com/",2BUTTONS "OK",KdBUTTONEnter%DIALOGENDIF...118PUBLISHING YOUR OPL APPLICATIONCripplingThere may be one or two features in your application that aren’t vital tothe running of the application, but are useful – for example, the Undofeature in a game. This is a good way to put in a crippled feature. Whensomeone tries to use a feature in the demonstration version that youwant to cripple (i.e.
make the user aware that if they buy the full versionthey can have this feature), an IF statement and the constant come intoplay again:PROC UndoLastMove:IF KRegistered%=0dINIT "Disabled Feature"dTEXT "","This version of "+KAppName$+" is",2dTEXT "","not registered. Please visit",2dTEXT "","http://www.yourwebsite.com/",2BUTTONS "OK",KdBUTTONEnter%DIALOGRETURNENDIF...ENDPAlways take care when using crippled functionality in an application.The end user must be able to judge the program fairly. There’s no pointin creating a great Notepad application, then crippling it by only lettingthe user save two notes.
This means there’s no way the user can judgethe application before getting frustrated.Maintaining a Single VersionAnother approach to unlocking demonstration versions is to provide onlya single program file, but make it respond to a registration code. Theapproach is very similar to the one outlined above, but instead of a CONST,you’d make KRegistered% a GLOBAL variable called Registered%,which is set to zero by default. You then offer the user a registration menuoption which takes a code based on some set formula chosen by youand, if the correct code is entered, sets Registered% to 1 and persiststhis value in the INI file for future program launches.
For example, acommon approach is to generate a code based on the user’s name tomake it specific to them. Implementing this in code is too complex to gointo here, but there are several examples available on the web, and manyexisting OPL authors are happy to offer you advice.
See below for somelinks to websites with appropriate discussion forums.When a user registers, you simply generate the appropriate code usingthe appropriate algorithm and send this to them – they can then unlockthe version of the program already on their phone.PROMOTION – TELL EVERYONE IT’S AVAILABLE119Warez and PiratesA quick note about Warez – this is the practice of providing full versionsof other people’s applications for free. There’s not much you can do tostop this, so the best advice I can give is to put some effort into protectingyour application, but don’t kill yourself over it – someone is going to passthe full version around at some point in time. As long as you make it veryeasy to find your demonstration version, and make it easy to purchase,you’ll still gather registrations.7.4 Promotion – Tell Everyone it’s Available7.4.1 Symbian Themed WebsitesOnce you release your application, you need to let people know that it isavailable.
There are two main websites you should approach and get intouch with, both of which will help promote your site and application.My-Symbian (http://mysymbian.com/)Primarily a site for software, My-Symbian aims to host or link to everySymbian-based application out there. Contact details are shown on thefront page, and generally your application will be posted in the front pagenews section, and in the main database after a few days of notifying themof its existence.All About Symbian (www.allaboutsymbian.com/)Mainly news articles and community information, All About Symbiando post news on applications, but do not post every application to thefront page.
They rely heavily on Handango to pass over details to theirdedicated software section. Again, contact details are available on thefront page.HandangoIf you are signed up with Handango, there are a number of Symbiansites on the Internet that will automatically pick up on the new andupdated applications Handango host (for example, All About Symbianas mentioned above). This is a great way of getting your product out tomore places.Symbian GearAnother online store, similar to Handango. Recently launched and therefore not as well known, as of the writing of this book. They have a hugeamount of experience with their Palm OS and Microsoft Pocket PC stores.120PUBLISHING YOUR OPL APPLICATION7.4.2 Newsgroups and ForumsMost of the main websites (see above) have forums and bulletin boards.A short, polite note on these boards saying you have a new applicationwill do wonders for your visibility to both users and other developers inthe community.7.5 SummaryNow you know about programming applications, this chapter took youthrough some common sense advice on distributing your applications.We looked at the things you need to consider when distributing yourapplication, namely:• test your program thoroughly• make sure the first 20 seconds of use are perfect for a new user• use a SIS file, and package the ZIP with everything required• listen to feedback from your users and reply to everything.We looked at registration fees and the best way to collect them if youdecide to make your programs.
You also need to think about how youwill limit any demonstration application and how this works in yoursource code.Finally, we talked about where you can go to host your program onthe Internet, and the best places to promote your application.8Creating Applications and InstallersIt’s all well and good using file managers and Bluetooth to transfer filesand run your OPL programs while developing your application, but whenit comes to other people using them in the real world, there are moreissues to consider.
The two we will look at in this chapter are how theywill get the application and all the files onto their phone in the correctplace (installing it), and how they will run it when it is installed.Symbian OS and OPL offer facilities to do both of these with verylittle work.8.1 Creating an OPL ApplicationThere are two considerations you need to have when making an OPLprogram (a .opo file) into a full application that is easy for users to installand run, without doing any of the manual file copying you as a developerhave been doing so far. The first is to make sure your application behavesresponsibly, and responds to all the requests from the phone. This hasbeen taken care of already in our Event Core (where we talk about systemcommands and messages), so as long as you follow that method, thenyou do not need to worry about interacting with the system as a bonafide application.The second is that you will need to uniquely identify your applicationin the Symbian OS environment, using a so-called ‘UID’.
This enablesSymbian OS to keep track of your application individually, distinct fromall the rest.8.1.1UID NumbersThe UID (unique identifier) number is a number that you obtain fromthe Symbian Developer Network. If you email uid@symbiandevnet.comand request a UID, you will be issued a UID at no cost, and this isyour number forever, nobody else will be issued with it. Note that UIDnumbers less than 0x10000000 are never issued, and can be used as a122CREATING APPLICATIONS AND INSTALLERStemporary stop-gap when testing or developing your application on yourown phone.When you do release your application, always double-check you usethe official UID you have applied for, and not one of the low-numberedtest UIDs.8.1.2 Creating an Application from OPL Source CodeWe create an OPL application (as opposed to a compiled .opo file) byadding in a new command at the very start of your code (before anyINCLUDEs or CONST declarations).
Here’s what Event Core would haveat the start:APP Core,270488647ENDAThe two elements following the APP command give the title of theapplication as it will appear in any Task Manager listings, and then theUID number. You can specify this in decimal (as above) or hex (usingthe standard OPL Hex format of &10000000). We then show we arefinished defining the application with the ENDA command. Note the UIDnumber here is Event Core’s UID number, and you should change itbefore releasing your own applications.When you compile OPL source code to an .opo file, the resulting.opo file is produced in the same directory as the source code.
If youhave added the APP...ENDA commands, then the compiled files willnot appear in the same directory as the source code. They will be placedin the C:\ directory of your phone (or in the SDK Emulator File Structureif you are using OPLTran on the PC). The rule of thumb is that thecompiled OPL application will always be placed in the correct place tobe run. It will also create two files, rather than a single .opo file as before.Continuing to use Event Core as an example, on our phone (either inthe emulator or on the device) you will find the following two files havebeen created:C:\System\Apps\Core\Core.appC:\System\Apps\Core\Core.aifThe actual compiled code is in the .app (APP.lication) file and is directlyequivalent to any .opo code the same source code would generatewithout the APP...ENDA construct at the start.The .aif is the application information file, and contains the UID, thecaption for display on the system screen, and the details of the programicon that is shown on the system screen.SYMBIAN INSTALLATION SYSTEM – SIS FILES123Figure 8.1 Graphic icon and mask8.1.3 Creating an Icon for your ApplicationIn the next chapter you’ll see how to create a graphical file called an MBM(multiple bitmap file).
You can create an application icon to be shownon the system screen by using the ICON command in the APP...ENDAstructure:APP Core,270488647ICON "CoreIcon.mbm"ENDAEach icon will need to have a graphic, and be accompanied by a mask,which is a computer graphics term for a silhouette. An icon and its maskare illustrated in Figure 8.1.You’ll also know that there are various zoom levels on the systemscreen. You will need to have an icon for each zoom level as appropriatefor the phone you’re targeting.Under the UIQ interface, the icon sizes are 20 × 16 pixels and 32 × 32pixels. The Standard UIQ color depth is 8 bits (256 colors), so use the /c8(8-bit color) switch when creating your mbm file. Series 60 uses two sizes(44 × 44 for the large icon and 42 × 23) and Series 80 uses another twosizes (64 × 50 and 25 × 20 respectively).