BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   Configure Autostart at runtime? (http://www.blackberryforums.com/showthread.php?t=134713)

arunk 06-12-2008 02:36 AM

Configure Autostart at runtime?
 
is it possible to configure autostart at runtime?

At present Using JDE I am able to Autostart my application..

I want to give the user an option for autostart, with which he can make it true or false.. is it possible to do like this?

simon.hain 06-12-2008 03:25 AM

have your autostart part check a persistant value

arunk 06-12-2008 04:09 AM

Sorry..I didnt get what you mean?

simon.hain 06-12-2008 06:34 AM

your autostart part reads a persistant store. in the store you save a Boolean with the values autostart (true) or no autostart (false). if the value is set to false the autostart part terminates.
in the settings the user can save the persistant value.

arunk 06-12-2008 06:41 AM

I have a field called Autostart (0/1);

In My application by default Autostart will be true (Through JDE settings)

But when I change and save the autostart field , The autostart flag of the application should change or reset..


And as you said the value of the autostart field will be stored in Persistence store....

arunk 06-25-2008 06:59 AM

Help?

simon.hain 06-25-2008 07:20 AM

here is a simple construction using alternate entry points

Code:

if (args.length > 0 && "autostartup".equals(args[0])) {
//check persistant value, if true call constructor, otherwise do nothing
} else {
//normal startup -> user clicks icon
}


Jayaseelan 06-25-2008 07:26 AM

Quote:

Originally Posted by simon.hain (Post 986401)
here is a simple construction using alternate entry points

Code:

if (args.length > 0 && "autostartup".equals(args[0])) {
//check persistant value, if true call constructor, otherwise do nothing
} else {
//normal startup -> user clicks icon
}


Hi Simon,

Is it possible to start an application automatically each time the mobile is swithced On?

And i want to start the app automatically after Installation finished..

How to do both?

shraddha294 06-25-2008 07:27 AM

:? Can something similar be done to integrate MIDlet and CLDC application...?

Say something like invoking CLDC application from a MIDlet? ???

arunk 06-25-2008 09:50 AM

Ok.. simon.hain

Actually I am loading the persistent store value while loading the main screen

So I have to load it in the beginning and before calling the main screen I have to do this check.. right?

simon.hain 06-25-2008 10:37 AM

to answer the thread hijackers:
autostart midlet
autostart with JDE

yes, you should check the value before you call the constructor of your application

arunk 06-25-2008 11:47 PM

Thanks simon ....

arunk 06-26-2008 04:03 AM

I tried this method...

But the problem is I always get args.length as 0. But auto start is happening.

Is there any problem in handling the arguments in main method?

Code:


 public static void main(String[] args) {
         
            writeToLogFile("Args : "+args.length);           
            System.out.println("Args : "+args.length);
           
            if (args.length > 0 && "autostartup".equals(args[0])) {
                System.out.println(" Inside args");
                }
            }
 }


simon.hain 06-26-2008 04:30 AM

did you create the autorun project as an Alternate CLDC Application Entry Point?
did you put autostartup into the 'arguments passed to...' field in the project properties?

did you at least read the link i posted?

arunk 06-26-2008 04:47 AM

I went through the link, but I didn't get properly.

I have MyApplication and MyAppAEP

MyAppAEP is the Alternate Entry point App.

in that I specified my application name and variable as "autostartup".



But MyAppAEP is just a project without any files..

is there any mistake here?

arunk 06-26-2008 05:07 AM

Hi simon,

I was doing the same which you suggested... But there was a misunderstanding.

I thought this AEP will execute when the Application starts automatically...

But it gets executed when we invoke by clicking the icon....

Anyway its working fine now....

Thanks a lot for your support... :smile:

arunk 06-26-2008 09:28 AM

Now The problem is I am getting two Application icon While switching the application.....

simon.hain 06-26-2008 10:09 AM

your AEP application does not need an icon, you have to mark it as system module/autorun at startup. it calls the main method of your application.

arunk 06-27-2008 12:47 AM

2 Attachment(s)
Still I am getting two icons. When I didnt give an icon for AEP it comes with a default black icon.

At startup the AEP will get executed. Whenever the user invoke the app with icone, it will invoke the main application.

My problem is two different instances are existing at the same time.

I have attached the properties settings along with this post.

is there any way by which we can make sure that only one instance will exist at a time?


Attachment 11958

Attachment 11959


All times are GMT -5. The time now is 01:03 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.