本文整理汇总了Java中com.gimbal.android.CommunicationManager类的典型用法代码示例。如果您正苦于以下问题:Java CommunicationManager类的具体用法?Java CommunicationManager怎么用?Java CommunicationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommunicationManager类属于com.gimbal.android包,在下文中一共展示了CommunicationManager类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupGimbalCommunicationManager
import com.gimbal.android.CommunicationManager; //导入依赖的package包/类
private void setupGimbalCommunicationManager() {
communicationListener = new CommunicationListener() {
@Override
public Notification.Builder prepareCommunicationForDisplay(Communication communication, Visit visit, int notificationId) {
addEvent(String.format( "Communication Delivered : %s", communication.getTitle()));
// If you want a custom notification create and return it here
return null;
}
@Override
public Notification.Builder prepareCommunicationForDisplay(Communication communication, Push push, int notificationId) {
addEvent(String.format( "Push Communication Delivered : %s", communication.getTitle()));
// If you want a custom notification create and return it here
return null;
}
@Override
public void onNotificationClicked(List<Communication> communications) {
for (Communication communication : communications) {
if(communication != null) {
addEvent("Communication Clicked");
}
}
}
};
CommunicationManager.getInstance().addListener(communicationListener);
}
示例2: onCreate
import com.gimbal.android.CommunicationManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
//layout = (RelativeLayout)findViewById(R.id.mapView);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_map);
Gimbal.setApiKey(this.getApplication(), "41238e20-69b3-48f7-b5b5-9648d9ba4dfb"); //"## PLACE YOUR API KEY HERE ##"
beaconSightingListener = new BeaconEventListener() {
@Override
public void onBeaconSighting(BeaconSighting sighting) {
Log.v("test", "enter onBeaconSighting");
if(sighting.getBeacon().getName().equals("beacon 1")) {
rssi1 = Math.abs(sighting.getRSSI());
}else if(sighting.getBeacon().getName().equals("beacon 2")) {
rssi2 = Math.abs(sighting.getRSSI());
}else if(sighting.getBeacon().getName().equals("beacon 3")) {
rssi3 = Math.abs(sighting.getRSSI());
}else if(sighting.getBeacon().getName().equals("beacon 4")) {
rssi4 = Math.abs(sighting.getRSSI());
}else if(sighting.getBeacon().getName().equals("beacon 5")) {
rssi5 = Math.abs(sighting.getRSSI());
}
//if one beacon is not zero find minimum
if((rssi1 | rssi2 | rssi3 | rssi4 | rssi5) != 0){
//rssi1 is closest
if(rssi1 != 0 && rssi1 < CUTOFF){
RelativeLayout mainLayout=(RelativeLayout)findViewById(R.id.mapView);
mainLayout.setBackgroundResource(R.drawable.highlight1);
beaconDetectorTextView.setText(String.format("Beacon 1 loudest, has RSSI %d", sighting.getRSSI()));
} else if(rssi2 != 0 && rssi2 < CUTOFF){
RelativeLayout mainLayout=(RelativeLayout)findViewById(R.id.mapView);
mainLayout.setBackgroundResource(R.drawable.highlight2);
beaconDetectorTextView.setText(String.format("Beacon 2 loudest, has RSSI %d", sighting.getRSSI()));
} else if(rssi3 != 0 && rssi3 < CUTOFF){
RelativeLayout mainLayout=(RelativeLayout)findViewById(R.id.mapView);
mainLayout.setBackgroundResource(R.drawable.highlight3);
beaconDetectorTextView.setText(String.format("Beacon 3 loudest, has RSSI %d", sighting.getRSSI()));
} else if(rssi4 != 0 && rssi4 < CUTOFF){
RelativeLayout mainLayout=(RelativeLayout)findViewById(R.id.mapView);
mainLayout.setBackgroundResource(R.drawable.highlight4);
beaconDetectorTextView.setText(String.format("Beacon 4 loudest, has RSSI %d", sighting.getRSSI()));
} else if(rssi5 != 0 && rssi5 < CUTOFF){
//layout.setBackgroundResource(R.drawable.blueprint);
beaconDetectorTextView.setText(String.format("Beacon 5 loudest, has RSSI %d", sighting.getRSSI()));
}
}
}
};
beaconManager = new BeaconManager();
beaconManager.addListener(beaconSightingListener);
beaconManager.startListening();
CommunicationManager.getInstance().startReceivingCommunications();
rssi1 = 0;
rssi2 = 0;
rssi3 = 0;
rssi4 = 0;
rssi5 = 0;
beaconDetectorTextView = (TextView) findViewById(R.id.beaconDetectorTextView);
beaconDetectorTextView.setText("Initializing...");
}