I am experiencing a mass amount of battery consumption on one of my Android apps, and I believe it is due to the GPS being turned on, but never being turned off when a new activity starts. I am working with a code base that I inherited from someone else. Please let me know if you have a solution to this problem.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Start the tracker in manual dispatch mode...
GoogleAnalyticsTracker.getInstance().startNewSession(sessionCode, this);
//Get url to get survey and tags
urlSurveyFilter = Global.getInstance().getUrlStringForRequest(R.string.jsonsurveys, this);
urlJsonTag = Global.getInstance().getUrlStringForRequest(R.string.jsontagrequest,this);
//to use the KinseyAppActivity.this like a global variable
_this = this;
//set the layout from my xml
setContentView(R.layout.main1);
Global.getInstance().locatePosition(MapViewActivity.this);
// button to choice the filter
Button filterButton = (Button) findViewById(R.id.filterButton);
filterButton.setOnClickListener(new View.OnClickListener() {
@SuppressWarnings("deprecation")
@Override
public void onClick(View v) {
sendTrackingEvents("Click Filter Button", "Open the filter", "clicked", 1, "/MapActivity");
showDialog(0);
}
});