0

Possible Duplicate:
How to start an Activity from a Service?

I have service, which checks app versions and if there is new, it should prompt my fully functioning installation intent. My question is - how to start intent on actual screen from service?

Edit: I have thought of int status, i will compare actual version installed and version on the web. If there is newer version, I will set status=1. And for each intent in my app i add if clause:

If(status==1){
// prompt installation intent
}

but how to get this "status" which is declared and inicialized in service class?

Thanks

Community
  • 1
  • 1
Waypoint
  • 15,705
  • 36
  • 110
  • 167

1 Answers1

2

You ask two questions.

  1. It seems possible to launch an Activity from a service. android start activity from service

    However I would strongly recommend you used the Alert mechanism to inform the user an update was ready, rather than 'pulling the rug' with a complete change of context.

  2. Regarding your 'status' variable, you may consider storing this in SharedPreferences which will be accessible in both the service and the activities.

    http://developer.android.com/reference/android/content/SharedPreferences.html

Community
  • 1
  • 1
Jim Blackler
  • 21,883
  • 11
  • 82
  • 100