当前位置: 首页>>代码示例>>Java>>正文


Java CommunicationManager类代码示例

本文整理汇总了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);
}
 
开发者ID:gimbalinc,项目名称:hello-gimbal-android,代码行数:28,代码来源:AppService.java

示例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...");
}
 
开发者ID:damouse,项目名称:Bandela,代码行数:70,代码来源:ViewMap.java


注:本文中的com.gimbal.android.CommunicationManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。