0
Android 앱 중 하나에서 배터리 소모량이 많습니다. GPS가 켜져 있기 때문에 발생한다고 생각되지만 새로운 활동이 시작되면 절대로 꺼지지 않습니다. 시작됩니다. 나는 다른 사람으로부터 물려받은 코드 기반으로 작업하고있다. 이 문제에 대한 해결책이 있으면 알려주십시오.활동이 변경 될 때 Android GPS가 꺼지지 않는 경우
@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);
}
});
내 솔루션이 효과가 있습니까? – alicanbatur
내가 네에게 말할 수있는 것부터, GPS가 켜져 있는지 여부를 확인하는 방법을 알려줄 수 있습니까? 나는 그것이 작동하고 있음을 보장하기 위해 로그 고양이에 몇 가지 것을 인쇄하고 싶다. 감사! –
"(provider.contains ("gps ")"조건이 원하는 것일 경우, 그렇 겠지. – alicanbatur