Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
完善基础构架,逐步完善Server,Activity,Notification,BroadcastReceiver
  • Loading branch information
dolphinboy committed Jul 17, 2012
1 parent dca32fb commit 141e348
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 20 deletions.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/BirdwayActivity$1.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/BirdwayActivity$2.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/BirdwayActivity$3.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/BirdwayActivity.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/entity/GPSData.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/service/GPSService$1.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/service/GPSService$2.class
Binary file not shown.
Binary file modified bin/classes/org/dolphinboy/birdway/service/GPSService.class
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
8 changes: 0 additions & 8 deletions src/org/dolphinboy/birdway/BirdwayActivity.java
Expand Up @@ -15,7 +15,6 @@
public class BirdwayActivity extends Activity {
private Button enterbut = null;
private Button loginbut = null;

private Context context = this;

@Override
Expand All @@ -31,7 +30,6 @@ public void onCreate(Bundle savedInstanceState) {
}



@Override
protected void onStart() {
super.onStart();
Expand All @@ -52,8 +50,6 @@ public void onClick(View v) {
}
};



private OnClickListener onclicklistener = new OnClickListener() {
public void onClick(View v) {
int id = v.getId();
Expand All @@ -66,10 +62,6 @@ public void onClick(View v) {
break;
}
//Toast.makeText(BirdwayActivity.this, "click the button!", Toast.LENGTH_LONG).show();


}

};
}

6 changes: 3 additions & 3 deletions src/org/dolphinboy/birdway/entity/GPSData.java
Expand Up @@ -9,7 +9,7 @@ public class GPSData implements Serializable {
public double longitude; //经度
public double altitude; //海拔
public float bear; //偏离正北方的度数
public double speed; //速度
public float speed; //速度
public String gpstime; //GPS时间

public int getDatatype() {
Expand Down Expand Up @@ -42,10 +42,10 @@ public float getBear() {
public void setBear(float bear) {
this.bear = bear;
}
public double getSpeed() {
public float getSpeed() {
return speed;
}
public void setSpeed(double speed) {
public void setSpeed(float speed) {
this.speed = speed;
}
public String getGpstime() {
Expand Down
25 changes: 16 additions & 9 deletions src/org/dolphinboy/birdway/service/GPSService.java
Expand Up @@ -4,7 +4,7 @@
import java.util.Iterator;

import org.birdway.mobile.R;
import org.dolphinboy.birdway.BirdwayActivity;
import org.dolphinboy.birdway.activity.ShowInfoActivity;
import org.dolphinboy.birdway.entity.GPSData;

import android.app.IntentService;
Expand Down Expand Up @@ -44,8 +44,6 @@ public class GPSService extends IntentService {
private Location location;
private GpsStatus gpsstatus;



private Context context = this;


Expand All @@ -59,13 +57,18 @@ public GPSService() {
protected void onHandleIntent(Intent intent) {
Log.i(TAG, "GPSService's onHandleIntent!");
initLocation();
int ontime = (int)gpsdata.getSpeed();
shwoNotification(Color.RED, ontime, 2);
// int ontime = 0;
// if (gpsdata != null) {
// ontime = (int)gpsdata.getSpeed();
// }

// shwoNotification(Color.RED, ontime, 2);
}

private void shwoNotification(int color, int ontime, int offtime) {
Log.i(TAG, "shwoNotification start!");
notification = new Notification(R.drawable.ic_launcher, "GPS for Birdway……", System.currentTimeMillis());
Intent intent = new Intent(this, BirdwayActivity.class);
Intent intent = new Intent(this, ShowInfoActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(this, "BirdwayService", "经度:"+gpsdata.getLongitude()+"纬度:"+gpsdata.getLatitude(), contentIntent);
nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Expand Down Expand Up @@ -135,18 +138,19 @@ public void onLocationChanged(Location location) {
* GPS禁用时触发
*/
public void onProviderDisabled(String provider) {

Log.i(TAG, "onProviderDisabled!");
}
/**
* GPS开启时触发
*/
public void onProviderEnabled(String provider) {

Log.i(TAG, "onProviderEnabled!");
}
/**
* GPS状态变化时触发
*/
public void onStatusChanged(String provider, int status, Bundle extras) {
Log.i(TAG, "onStatusChanged!");
switch (status) {
//GPS状态为可见时
case LocationProvider.AVAILABLE:
Expand All @@ -161,7 +165,7 @@ public void onStatusChanged(String provider, int status, Bundle extras) {
Log.i(TAG, "当前GPS状态为暂停服务状态");
break;
}
updateToNewLocation(null);
// updateToNewLocation(null);
}
};
//卫星状态监听
Expand Down Expand Up @@ -225,6 +229,9 @@ private void updateToNewLocation(Location location) {
gpsdata.setGpstime(DateFormat.format("yyyy-MM-dd kk:mm:ss", date).toString());
date = null;

//更新状态条
shwoNotification(Color.RED, (int)gpsdata.getSpeed(), 2);

//发送GPS数据广播
Intent intent = new Intent();
intent.setAction("birdway.gpsreceiver");
Expand Down

0 comments on commit 141e348

Please sign in to comment.