2012. 8. 27. 09:14
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);
   }
  });
        

 
    }
}

'2019년 이전 정리 > GPS' 카테고리의 다른 글

WM에서의 GPS 구동 원리 설명(GPSGate 등의 사용, XTRA, SNTP)  (0) 2012.08.27
GPS 아이콘 BroadcastReceiver  (0) 2012.08.27
GPS 아이콘을 변경 예제  (0) 2012.08.27
GPS Architecture 분석 1  (0) 2011.01.28
GPS Architecture 정리중....  (0) 2011.01.27
XTRA ?  (0) 2011.01.27
Posted by hoonihoon85 hoonihoon

댓글을 달아 주세요