Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void onResponse(PNPublishResult result, PNStatus status) {
if (!status.isError()) {
Log.v(TAG, "publish(" + JsonUtil.asJson(result) + ")");
} else {
Log.v(TAG, "publishErr(" + JsonUtil.asJson(status) + ")");
Log.v(TAG, "publishErr(" + status.toString() + ")");
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public void locationUpdated(final Map<String, String> newLocation) {
} else {
Log.w(TAG, "message ignored: " + newLocation.toString());
}

}

private void doUiUpdate(final LatLng location) {
Expand All @@ -46,7 +45,6 @@ public void run() {
}

map.moveCamera(CameraUpdateFactory.newLatLng(location));

}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

public class LocationPublishPnCallback extends SubscribeCallback {
private static final String TAG = LocationPublishPnCallback.class.getName();
private LocationSubscribeMapAdapter locationMapAdapter;
private LocationPublishMapAdapter locationMapAdapter;
private String watchChannel;

public LocationPublishPnCallback(LocationSubscribeMapAdapter locationMapAdapter, String watchChannel) {
public LocationPublishPnCallback(LocationPublishMapAdapter locationMapAdapter, String watchChannel) {
this.locationMapAdapter = locationMapAdapter;
this.watchChannel = watchChannel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void setPubNub(PubNub pubNub) {
public void onMapReady(GoogleMap map) {
this.map = map;

this.pubNub.addListener(new LocationSubscribePnCallback(new LocationSubscribeMapAdapter((Activity) this.getContext(), map), Constants.PUBLISH_CHANNEL_NAME));
this.pubNub.addListener(new LocationPublishPnCallback(new LocationPublishMapAdapter((Activity) this.getContext(), map), Constants.PUBLISH_CHANNEL_NAME));
this.pubNub.subscribe().channels(Arrays.asList(Constants.PUBLISH_CHANNEL_NAME)).execute();

this.locationHelper = new LocationHelper((Activity) this.getContext(), this);
Expand All @@ -78,7 +78,7 @@ public void onResponse(PNPublishResult result, PNStatus status) {
if (!status.isError()) {
Log.v(TAG, "publish(" + JsonUtil.asJson(result) + ")");
} else {
Log.v(TAG, "publishErr(" + JsonUtil.asJson(status) + ")");
Log.v(TAG, "publishErr(" + status.toString() + ")");
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public LocationSubscribePnCallback(LocationSubscribeMapAdapter locationMapAdapte

@Override
public void status(PubNub pubnub, PNStatus status) {
Log.d(TAG + "/PN_STATUS", "status: " + status.toString());
Log.d(TAG, "status: " + status.toString());
}

@Override
Expand All @@ -34,7 +34,7 @@ public void message(PubNub pubnub, PNMessageResult message) {
}

try {
Log.d(TAG + "/PN_MESSAGE", "message: " + message.toString());
Log.d(TAG, "message: " + message.toString());

Map<String, String> newLocation = JsonUtil.fromJson(message.getMessage().toString(), LinkedHashMap.class);
locationMapAdapter.locationUpdated(newLocation);
Expand All @@ -45,6 +45,10 @@ public void message(PubNub pubnub, PNMessageResult message) {

@Override
public void presence(PubNub pubnub, PNPresenceEventResult presence) {
Log.d(TAG + "/PN_PRESENCE", "presence: " + presence.toString());
if (!presence.getChannel().equals(watchChannel)) {
return;
}

Log.d(TAG, "presence: " + presence.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void onResponse(PNPublishResult result, PNStatus status) {
if (!status.isError()) {
Log.v(TAG, "publish(" + JsonUtil.asJson(result) + ")");
} else {
Log.v(TAG, "publishErr(" + JsonUtil.asJson(status) + ")");
Log.v(TAG, "publishErr(" + status.toString() + ")");
}
} catch (Exception e) {
e.printStackTrace();
Expand Down