BUG or Something I am doing wrong....

mrred128

Active Member
Licensed User
Longtime User
I have a service that brought something to my attention....

HTML:
Sub Process_Globals
   Dim Active As Boolean = True
End Sub
Sub Service_Create

End Sub

Sub Service_Start (StartingIntent As Intent)
   If Active = False Then
      ExitApplication
      Return ' I don't know if I need this, but ........
   End If
   Active = False
   StartServiceAt("",DateTime.Now + 300 * 1000,True) ' check every 5 minutes
End Sub

Sub Service_Destroy

End Sub

What this does is check to see if the active flag has been set every 5 minutes. If not, it closes the app.

It works like a charm in debug & release compiles. No go in obfuscated.

So is this a bug or feature? I tracked down a similar problem with a class that uses the HttpUtils2 (JobDone) callback. Exact same scenario.
 

melamoud

Active Member
Licensed User
Longtime User
do you have any other code that change the active flag ?
because if not I'm not sure what the program need to do,
the first time, it run change the flag to false, run it again after 5 min and exit
if within that 5 min, the OS or the user kill the app then you start from scratch, the service create will be called again and the flag will start at True


if you have other code that change the flag, why do you change it right after the service start ?
 
Upvote 0

mrred128

Active Member
Licensed User
Longtime User
This is a perfectly working service, and yes I have code that changes the active flag; that's the purpose. It has to do with how the code get's compiled when obfuscated.

Looking at the compile programs, I don't think dynamic mapping is taken into account. I have a java obfuscator that allows me to unobfuscate certain global symbols, for this reason.

This is just my take on this.

BTW, the active flag is initially set because I just call a startservice and the beginning of my main activity.
 
Upvote 0

mrred128

Active Member
Licensed User
Longtime User
It is set at true from the start.

I call the service on my main activity, expecting the service to take care of the initialization by itself. Starting the service sets the value to false nad then relies of code elsewhere to change the value when needed. That's just a coding style I have had since the beginning of time.
 
Upvote 0

melamoud

Active Member
Licensed User
Longtime User
It means that if the other code wint cgange it within 5 min the servicebwill call exit

If that ok with your logic of the code than great

If you can upload the project I can try to help..
 
Upvote 0

mrred128

Active Member
Licensed User
Longtime User
Exiting on 5 mins of no activity is the purpose of this chunk of code.

There is no need to post my project, as the included code is enough to show the problem.


To any of your projects, make a new service and call it "WatchDog". Paste the above code into it.

In your main module, add the following to your "Activity_Create" of your Main...

StartService(WatchDog)

compile and run with "Debug" and "Release" and your program will exit in 5 minutes.

Compile and run with "Release (obfuscated)" and your program will run forever.
 
Upvote 0

mrred128

Active Member
Licensed User
Longtime User
4.1.1 here (onn). I just reverified the problem, and it is as I described.

I compile with jdk (x86) jdk1.6.0_26 and api 10.
 
Upvote 0
Top