views:

246

answers:

1

Android:

public class LocationService extends Service {

@Override
    public void onStart(Intent intent, int startId) {
        super.onStart(intent, startId);
                startActivity(new Intent(this, activity.class));
        }
}

I launched this service from activity

In activity

if condition satisfies start

startService(new Intent(WozzonActivity.this, LocationService.class));

from my location service mentioned above could not launch activity, how can i get context of current running activity in service class

A: 
Intent dialogIntent = new Intent(getBaseContext(), myActivity.class);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplication().startActivity(dialogIntent);
Faisal khan