i have a question,
How to Keep public variable when device get into deep sleep?
because every time my device get into deep sleep, all my variable become null.
test2 is an activity variable. Its life cycle is tied to the activity life cycle. However it will never be "null" as you are setting it correctly in Activity_Create.
Rules of thumb:
- All non-ui global variables should be process global variables and set when FirstTime is true.
- All public process globals should be declared in the starter service and set in Service_Create sub.
Is it dangerous to set them everytime the app starts and not only when FirsTime is true?
@marcick : Thanks for keep on digging here
Sometimes i'm just doing things and when there are questions i see that i don't understand what i am doing....
Maybe this is a good topic for a new tutorial written by an expert
I had to rewrite my first app: i distributed variables everywhere with no real plan, so some of them was lost in activity pause and some where retained because declared in services. As I always say: "results are unpredictable" when you code in such a way.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.