• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RangeNotifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.radiusnetworks.ibeacon.RangeNotifier的典型用法代码示例。如果您正苦于以下问题:Java RangeNotifier类的具体用法?Java RangeNotifier怎么用?Java RangeNotifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RangeNotifier类属于com.radiusnetworks.ibeacon包,在下文中一共展示了RangeNotifier类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onIBeaconServiceConnect

import com.radiusnetworks.ibeacon.RangeNotifier; //导入依赖的package包/类
@Override
public void onIBeaconServiceConnect() {
    iBeaconManager.setRangeNotifier(new RangeNotifier() {
    @Override 
    public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
        if (iBeacons.size() > 0) {
        	EditText editText = (EditText)RangingActivity.this
		.findViewById(R.id.rangingText);
        	IBeacon aBeacon = iBeacons.iterator().next();
        	logToDisplay("Num Beacons:" + iBeacons.size() + " The first iBeacon I see is about "+ aBeacon.getAccuracy()+" meters away. " + aBeacon.getProximityUuid());            	
        }
    }

    });

    try {
        iBeaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
    } catch (RemoteException e) {   }
}
 
开发者ID:skylight1,项目名称:beaconscan,代码行数:20,代码来源:RangingActivity.java


示例2: createRangingCallbacks

import com.radiusnetworks.ibeacon.RangeNotifier; //导入依赖的package包/类
private void createRangingCallbacks(final CallbackContext callbackContext) {
	
      iBeaconManager.setRangeNotifier(new RangeNotifier() {
        @Override 
        public void didRangeBeaconsInRegion(final Collection<IBeacon> iBeacons, final Region region) {
           	
        	threadPoolExecutor.execute(new Runnable() {
                   public void run() {
                   	
                   	try {
                   		JSONObject data = new JSONObject();
                   		JSONArray beaconData = new JSONArray();
                   		for (IBeacon beacon : iBeacons) {
                   			beaconData.put(mapOfBeacon(beacon));
                   		}
                   		data.put("eventType", "didRangeBeaconsInRegion");
                   		data.put("region", mapOfRegion(region));
       					data.put("beacons", beaconData);
       					
       					debugLog("didRangeBeacons: "+ data.toString());
       					
       					//send and keep reference to callback 
       					PluginResult result = new PluginResult(PluginResult.Status.OK,data);
       					result.setKeepCallback(true);
       					callbackContext.sendPluginResult(result);
       					
          				} catch (Exception e) {
       					Log.e(TAG, "'rangingBeaconsDidFailForRegion' exception "+e.getCause());
       					beaconServiceNotifier.rangingBeaconsDidFailForRegion(region, e);
       				}
                   }
               });
        }
        
    });

}
 
开发者ID:KillerCodeMonkey,项目名称:iBeacon-nfc,代码行数:38,代码来源:LocationManager.java


示例3: onIBeaconServiceConnect

import com.radiusnetworks.ibeacon.RangeNotifier; //导入依赖的package包/类
@Override
public void onIBeaconServiceConnect() {
    iBeaconManager.setRangeNotifier(new RangeNotifier() {
    @Override 
    public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
    	if(iBeacons != null) {
    		if (iBeacons.size() > 0) {
    			// iterate through each beacon found
    			range.clear();
    			for (IBeacon i : iBeacons) {
    				Log.d(TAG,"UUID:" + i.getProximityUuid() + " dist " + i.getAccuracy());
    				if(i.getProximityUuid().equals(Beacon1_UUID)) {
    					range.add(i.getAccuracy());
    				}
    			}

    			if(range.size() > 0) {
    				setDisplay(range);
    			}
    		}
    	}
    }

    });

    try {
        iBeaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
    } catch (RemoteException e) {   }
}
 
开发者ID:skylight1,项目名称:beaconscan,代码行数:30,代码来源:RangingDemoActivity.java


示例4: onIBeaconServiceConnect

import com.radiusnetworks.ibeacon.RangeNotifier; //导入依赖的package包/类
@Override
public void onIBeaconServiceConnect() {
    final HashMap<Integer, String> names = new HashMap<>();
    names.put(IBeacon.PROXIMITY_IMMEDIATE, "IMMEDIATE");
    names.put(IBeacon.PROXIMITY_NEAR, "NEAR");
    names.put(IBeacon.PROXIMITY_FAR, "FAR");
    names.put(IBeacon.PROXIMITY_UNKNOWN, "UNKNOWN");

    mIBeaconManager.setRangeNotifier(new RangeNotifier() {
        @Override
        public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
            L.v("[" + iBeacons.size() + "] iBeacons:");
            for (IBeacon iBeacon : iBeacons) {
                L.v(iBeacon.getProximityUuid() + "-" + iBeacon.getMajor() + "-" + iBeacon
                        .getMinor());
                L.v("accuracy: " + iBeacon.getAccuracy());
                L.v("proximity: " + names.get(iBeacon.getProximity()));
            }

            mLocationManager.updateLocation(iBeacons);
            Puck location = mLocationManager.getCurrentLocation();
            L.v("Current location: " + location);
        }

    });

    try {
        mIBeaconManager.startRangingBeaconsInRegion(
            new Region("puckcentral", "E20A39F473F54BC4A12F17D1AD07A961", 0x1337, null));
    } catch (RemoteException e) {
        L.e(e);
    }
}
 
开发者ID:NordicPlayground,项目名称:puck-central-android,代码行数:34,代码来源:LocationRangeMonitorService.java


示例5: onIBeaconServiceConnect

import com.radiusnetworks.ibeacon.RangeNotifier; //导入依赖的package包/类
@Override
public void onIBeaconServiceConnect() {
    iBeaconManager.setRangeNotifier(new RangeNotifier() {
     @Override 
     public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
     	if (iBeacons.size() > 0) {
      	for (IBeacon iBeacon: iBeacons) {
      		int index = getIndexByUUID(iBeacon.getProximityUuid());
      		if (index ==  -1){
      			IBeaconInfo tempIbeacon = new IBeaconInfo (iBeacon.getProximityUuid(),iBeacon.getMajor(),iBeacon.getMinor());
      			myList.add(tempIbeacon);
       		index = getIndexByUUID(iBeacon.getProximityUuid());
      		}
      		IBeaconInfo myIBeaconInfo = myList.get(index);
      		myIBeaconInfo.iBeacon_proximity_sum+= iBeacon.getProximity();  	
      		myIBeaconInfo.iBeacon_proximity = iBeacon.getProximity();  	
      		myIBeaconInfo.iBeacon_accuracy = iBeacon.getAccuracy();
     			if (myIBeaconInfo.iBeacon_count>=myConstants.COUNT){
      			myIBeaconInfo.iBeacon_proximity_sum=myIBeaconInfo.iBeacon_proximity_sum/myConstants.COUNT;
      			myIBeaconInfo.parsediBeacon_proximity = (int)myIBeaconInfo.iBeacon_proximity_sum;	
      			if (myIBeaconInfo.parsediBeacon_proximity != myIBeaconInfo.iBeacon_last_proximity && myIBeaconInfo.iBeacon_last_proximity!= 0){
      				String last = "";
      				if (myIBeaconInfo.iBeacon_last_proximity == 1) last = "IMMEDIATE";
      				else if (myIBeaconInfo.iBeacon_last_proximity == 2) last = "NEAR";
      				else if (myIBeaconInfo.iBeacon_last_proximity == 3) last = "FAR";

      				String actual = "";
      				if (myIBeaconInfo.parsediBeacon_proximity == 1) actual = "IMMEDIATE";
      				else if (myIBeaconInfo.parsediBeacon_proximity == 2) actual = "NEAR";
      				else if (myIBeaconInfo.parsediBeacon_proximity == 3) actual = "FAR";
      				
      				String matchphrase2 = myIBeaconInfo.getUUID() + "-" + myIBeaconInfo.getMajor() + "-"  + myIBeaconInfo.getMinor() +"-from-"  + last + "-to-" + actual;
             	    	
      				AsyncTaskRunner runner = new AsyncTaskRunner();
             			
      				logToRequest("Calling Conducttr - " + matchphrase2);
      				runner.execute(matchphrase2);
             			myIBeaconInfo.iBeacon_last_proximity = myIBeaconInfo.parsediBeacon_proximity ;
      			}
      			else if( myIBeaconInfo.iBeacon_last_proximity == 0){
             	    	myIBeaconInfo.iBeacon_last_proximity = myIBeaconInfo.parsediBeacon_proximity ;
      			}
      			myIBeaconInfo.iBeacon_proximity_sum = 0;
      			myIBeaconInfo.iBeacon_count = 0;
         		}	
      		myIBeaconInfo.iBeacon_count++;
      		myList.set(index, myIBeaconInfo);
       	runOnUiThread(new Runnable() {
               public void run() {
   				adapter.notifyDataSetChanged();
               }
           });
      	}
      }	
     }
    });
    try {
        iBeaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
    } catch (RemoteException e) {   }
}
 
开发者ID:Conducttr,项目名称:SkunkWrx,代码行数:61,代码来源:RangingActivity.java


示例6: onIBeaconServiceConnect

import com.radiusnetworks.ibeacon.RangeNotifier; //导入依赖的package包/类
@Override
	public void onIBeaconServiceConnect() {
		
        iBeaconManager.setRangeNotifier(new RangeNotifier() {
	        @Override 
	        public void didRangeBeaconsInRegion(Collection<IBeacon> iBeacons, Region region) {
	        	if(iBeacons != null) {
	        		if (iBeacons.size() > 0) {
	        			// iterate through each beacon found
	        			range.clear();
	        			for (IBeacon i : iBeacons) {
	        				Log.d(TAG,"UUID:" + i.getProximityUuid() + " dist " + i.getAccuracy());
	        				if(i.getProximityUuid().equals(Beacon1_UUID)) {
	        					range.add(i.getAccuracy());
	        				}
	        			}	
	        			if(range.size() > 0) {
	        				setDisplay(range);
	        			}
	        		}
	        	}
	        }
        });
/*
        iBeaconManager.setMonitorNotifier(new MonitorNotifier() {
	        @Override
	        public void didEnterRegion(Region region) {
	          String data = "I just saw an iBeacon for the first time!";
	          Log.e(TAG,data);
	          mLiveCard.navigate();
	        }
	
	        @Override
	        public void didExitRegion(Region region) {
	        	Log.e(TAG,"I no longer see an iBeacon");
    	        //TODO: send intent with data
	        }
	
	        @Override
	        public void didDetermineStateForRegion(int state, Region region) {
	        	Log.e(TAG,"I have just switched from seeing/not seeing iBeacons: "+state);     
    	        //TODO: send intent with data
	        }
        });
*/
        try {
            iBeaconManager.startRangingBeaconsInRegion(new Region("myMonitoringUniqueId", null, null, null));
        } catch (RemoteException e) {   }		
	}
 
开发者ID:skylight1,项目名称:beaconscan,代码行数:50,代码来源:GlassService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FragmentTestUtil类代码示例发布时间:2022-05-23
下一篇:
Java StatusLineLayoutData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap