starting the application on startup

Login to reply to this topic.
Wed, 2006-04-26 22:16
Joined: 2005-10-13
Forum posts: 32
Hi,
  I need to make my application start when the mobile starts up, because the application listens to incoming sms's and makes some scheduled actions.
i am testing on series 60 fp2 specially 6630.
the application has a GUI but i don't want the GUI to be opened on start up, i just want the active objects only to start on start up and i want to allow the user to open the GUI from the application icon in the menu at any time.
i read about recognizers, sending application to background, but i am so confused what to use exactly?
what does sending the application to the background does exactly?

Thu, 2006-04-27 02:44
Joined: 2004-05-31
Forum posts: 51
Re: starting the application on startup
The reccomended approach to do this is:

1) write a server application (.exe) to do the monitoring etc.
2) write a client application (.app) to talk to the server and display a user interface
3) write a recogniser to start the server on boot-up.

To find out how to do 1 and 2 above, read "Symbian OS C++ for Mobile Phones" by Richard Harrison, it has a complete working example and lots of hints and advise.  To write a recognisr, check out the EzBoot example on this site (http://www.newlc.com/EzBoot.html).
Thu, 2006-04-27 11:42
Joined: 2003-10-21
Forum posts: 40
Re: starting the application on startup
Hi everybody.
I have a question on the same subject. I've managed to implement a recognizer to start my application on boot and installation. However, my application doesn't start on boot when installed on one of my 6600 device. I think that is because some resource that my app need are not loaded. I used a 20 seconds delay as a work-around but I wonder how I can know whar resources are needed and how I can check if they're loaded.

Thanks in advance,
Imzadi
Thu, 2006-04-27 20:43
Joined: 2005-10-13
Forum posts: 32
Re: starting the application on startup
Hi,
  Does this mean that i have to make a server? can't i just make a recognizer to solve my problem?
Thu, 2006-04-27 21:11
Guest (not verified)
Forum posts: 2043
Re: starting the application on startup
Questions to think about and find the answer to are:
- if the recognizer can start your app, can it also start it in the background?

- if an app is in the background can its active objects wait for event, and when those events trigger can the app remain in the background while it deals with those events?

- you want your app to start at machine start because it is listening and making some scheduled actions, therefore presumably you also want these actions to continue happening? So what happens if the app starts at machine launch, the user selects the application icon and then quits the application? If you don't want them to quit are you going to disable the quit option and thus break the UI standards? If its ok for them to quit the app and thus stop the sms listening then why is it important to launch at boot up? (after all the user could quit your app 5 seconds after the machine has booted).
Fri, 2006-04-28 02:02
Joined: 2004-05-31
Forum posts: 51
Re: starting the application on startup
I use the following code in my recogniser to ensure the device is in a stable state...

  TRequestStatus status(KRequestPending);
  RSystemAgent agent;
  agent.Connect();

  RTimer timer;
  timer.CreateLocal();
  TTimeIntervalMicroSeconds32 time(5000000);
  TInt trycount = 0;
      
  while ((agent.GetState(KUidSIMStatus) != ESASimOk) && (trycount++ < KMaxTries))   
  {
    timer.After(status,time);
    User::WaitForRequest(status);
  }
  timer.Close();
  agent.Close();

It seems to work fine for Nokia devices, Sony Ericsson devices never return ESASimOk, so that's why the KMaxTries is there.
Fri, 2006-04-28 08:10
Joined: 2003-10-21
Forum posts: 40
Re: starting the application on startup
Guest,

Quote
if the recognizer can start your app, can it also start it in the background?
The recognizer can start the app and the app can put itself in the background. However, this will show your app for a short period. You can use launch=KAppLaunchInBackground in your aif rss file but that only cause your application not to go to the FG when the user launch it. For some reason, the recognizer will cause your app to go to the FG on boot and after installation.

Quote
if an app is in the background can its active objects wait for event, and when those events trigger can the app remain in the background while it deals with those events?

Yes.

As you for your last question. I'm not sure what you mean, but I don't recommend breaking the UI standard. If the user wants to quit, let him. It's his responsibilty.


BRoberts, maybe you could help me. I'm developing a dialer application. Do you know what states I should look for in my recognizer before launching my app?

regards,
Imzadi
Fri, 2006-04-28 11:21
Joined: 2005-10-13
Forum posts: 32
Re: starting the application on startup
about the quit button, i think the user should know that if he quit then he doesn't need to use the application.

Quote
However, this will show your app for a short period. You can use launch=KAppLaunchInBackground in your aif rss file but that only cause your application not to go to the FG when the user launch it. For some reason, the recognizer will cause your app to go to the FG on boot and after installation.
I don't understand this part, what i know now that i should implement a recognizer and put my application in the background.
I wrote a function that sends the application to the background, but i don't know where should it be called because it is not working, or may be it won't work before i make the application autostart?
Fri, 2006-04-28 16:46
Joined: 2006-04-05
Forum posts: 104
Re: starting the application on startup
Hi imzadi_il,

you mention:

"I've managed to implement a recognizer to start my application on boot and installation. However, my application doesn't start on boot when installed on one of my 6600 device"

one quick thing to check...  make sure recogniser comes after your app in the pkg file.  otherwise when you copy the recogniser onto the phone the app won't be there to launch

why does this only happen on older devices eg 6600?

good question.  i don't know, i could guess but that just ain't the same as knowin'   Wink

PL


Sat, 2006-04-29 08:13
Joined: 2003-10-21
Forum posts: 40
Re: starting the application on startup
Hi petxolobo,

My recognizer is indeed come after my app in the pkg file. The recognizer works well and actually, on a different 6600 phone, I don't need to put the timeout in the it. The same is true for a 6630 phone.
So, I'm guessing that on the problematic 6600 phone, some resources are not loaded when the recognizer launch my app and this causes my application to quit.
Problem is I don't know what those resources are.

Imzadi
Sat, 2006-04-29 23:36
Joined: 2005-10-13
Forum posts: 32
Re: starting the application on startup
Hi,
I saw recognizer example posted on forum nokia, but i didn't know where exactly (in which lines) i should change to make the recognizer recognize my application?
Sun, 2006-04-30 08:36
Joined: 2006-04-05
Forum posts: 104
Re: starting the application on startup
Hi Marwa_fci,

I think that there is some confusion here.

I see many people asking the question "how can i start my app at install and device boot?"  and the answer comes swiftly back "use a recogniser"

this has lead to FALSE belief that recognisers are for starting apps at install and device boot.

What recognisers are REALLY designed for is detecting the use of a file of a particular MIME type and launching the appropriate application to deal with it.  an example of this that will be familar to all would be that there is a recogniser that detects the use of the proprietory .sis file format and launches the installer. 

Now, in order for a recogniser to do it's job it must be run by the system at boot time. Here we can take advantage of this to "mis-use" the recogniser concept to launch our app when the recogniser gets booted.

So basically what you do is write a dummy recogniser that isn't really looking for any meaningfull MIME type but that runs your app when it, the recogniser, is constructed.

there is a health warnings here:

things like recognisers, notifiers etc are all run up by the system, you don't control them.  So if they panic or behave badly you can have all sorts of rather nasty problems.  be carefull.

Happily there is a easy route, you could try using ezBoot.  this is a kind of configurable recogniser that has been created for the purpose of booting apps. 

http://www.newlc.com/EzBoot.html?var_recherche=ezboot

Best regards

PL
Sun, 2006-04-30 20:42
Joined: 2005-10-13
Forum posts: 32
Re: starting the application on startup
thanks for your clarrification, this link contains a .sis of the ezBoot, but i want a source code to use or to be a guide for me to build my recognizer.
 I already found some codes and i wrote the .mmp, .cpp and .h for the recognizer as i found here: http://discussion.forum.nokia.com/forum/showthread.php?t=71272&goto=nextnewest,
but nothing happens when i run.
what else should i do? is there something i should write in the application that i want to autostart or in the recognizer? should i write something in the .pkg of the application?
Mon, 2006-05-01 09:16
Joined: 2003-10-21
Forum posts: 40
Re: starting the application on startup
Hi marwa_fci,

If you liked the EzBoot idea, why not have a look at the source code? here http://www.newlc.com/Writing-a-recognizer-The-EZBoot.html
Imzadi
Wed, 2006-05-03 13:41
NewLC AdministratorSymbian AccreditedForum Nokia Champion
Joined: 2003-01-14
Forum posts: 2009
Re: starting the application on startup
Note that this is the code of EzBoot recognizer only. The recognizer starts a server which is then responsible of starting the various apps under its control.

This kind of architecture looks mandatory if you want to start an app which has a GUI. But note that the server may not need to be a server as defined by Symbian OS (i.e. it does not need to derive from a CServer class): it may only be an exe which runs on background and decide when the GUI application shall be launched.

Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant

Mon, 2007-07-16 08:10
Joined: 2007-07-15
Forum posts: 1
Re: starting the application on startup

HI first of let me thank the whole team for the information on moving the app to boot up.

I want this application which i have moved to the boot up to run in the background so that the user doesnt know its running. Please can anyone suggest the best way to do this

many thanks

  • Login to reply to this topic.