本文整理匯總了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...");
}