Process_Globals variables are always available. You can make the variables private to improve your code encapsulation. However for this variable you will need to make it public.
This would be fine except that if Main Activity_Create which assigns the value to test_1 is not run first then the Service mod main.test_1 never would get a value assigned to it by lc.SetVariableAndValue(test_1, "256").
This would happen if someone were to access a widget created by the service mod before the Main Activity is ever run as an app. There would be no value to pass on to the service mod.
If I have lc.SetVariableAndValue(main.test_1, "256") included in Service_Create it crashes the service with errors. I've also tried putting
Dim lc As LicenseChecker in the Main Activity Process_Globals
and,
included the following in Service_Create. Probably not correct but thought I would try it.
Main.lc.Initialize("lc", GetDeviceId, publicKey, "abcdefg".GetBytes("UTF8"))
Main.lc.SetVariableAndValue(Main.test_1, "256")
Main.lc.CheckAccess
This just crashes the service also.
What do you think can be done here?
I was wondering if there is a way to not allow a service mod from running from within the Main Activity? As if the license check fails in the Main activity then no widget is displayed in the widget listings.
Thanks,
Bryan