package com.lge.gps.notification;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class GPSnotification extends Activity {
/** Called when the activity is first created. */
public static final String GPS_FIX_CHANGE_ACTION =
"android.location.GPS_FIX_CHANGE";
public static final String EXTRA_ENABLED = "enabled";
public static final String GPS_ENABLED_CHANGE_ACTION =
"android.location.GPS_ENABLED_CHANGE";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button gps1 = (Button)findViewById(R.id.Button01);
Button gps2 = (Button)findViewById(R.id.Button02);
Button gps3 = (Button)findViewById(R.id.Button03);
gps1.setOnClickListener(new OnClickListener() { //fix
@Override
public void onClick(View v) {
// send an intent to notify that the GPS is no longer receiving fixes.
Intent intent = new Intent(GPS_FIX_CHANGE_ACTION);
intent.putExtra(EXTRA_ENABLED, true);
sendBroadcast(intent);
}
});
gps2.setOnClickListener(new OnClickListener() { //icon 없앰
@Override
public void onClick(View v) {
Intent intent = new Intent(GPS_ENABLED_CHANGE_ACTION);
intent.putExtra(EXTRA_ENABLED, false);
sendBroadcast(intent);
}
});
gps3.setOnClickListener(new OnClickListener() { //gps on 깜박깜박
@Override
public void onClick(View v) {
Intent intent = new Intent(GPS_FIX_CHANGE_ACTION);
intent.putExtra(EXTRA_ENABLED, false);
sendBroadcast(intent);
}
});
}
}