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


Java BCProximity类代码示例

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


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

示例1: onCreate

import com.bluecats.sdk.BCBeacon.BCProximity; //导入依赖的package包/类
@Override
protected void onCreate( Bundle savedInstanceState )
{
	super.onCreate( savedInstanceState );
	mBinding = DataBindingUtil.setContentView( this, R.layout.activity_beacons );

	setSupportActionBar( mBinding.toolbar );

	final ActionBar actionBar = getSupportActionBar();
	actionBar.setDisplayHomeAsUpEnabled( true );

	final Intent intent = getIntent();
	mSite = intent.getParcelableExtra( BlueCatsSDK.EXTRA_SITE );
	setTitle( mSite.getName() );

	final BeaconsTabAdapter tabAdapter = new BeaconsTabAdapter( getSupportFragmentManager(), Arrays.asList(
			BeaconProximityFragment.newInstance( mSite, BCProximity.BC_PROXIMITY_IMMEDIATE ),
			BeaconProximityFragment.newInstance( mSite, BCProximity.BC_PROXIMITY_NEAR ),
			BeaconProximityFragment.newInstance( mSite, BCProximity.BC_PROXIMITY_FAR ),
			BeaconProximityFragment.newInstance( mSite, BCProximity.BC_PROXIMITY_UNKNOWN )
	) );

	mBinding.viewPager.setAdapter( tabAdapter );
	mBinding.tabLayout.setupWithViewPager( mBinding.viewPager );
	mBinding.tabLayout.setTabTextColors( Color.argb( 128, 255, 255, 255 ), Color.WHITE );

	/*
	 * LOCAL NOTIFICATION EXAMPLE
	 */
	final BCLocalNotification localNotification = new BCLocalNotification( NOTIFICATION_ID );

	// can add an optional site to trigger in
	//BCSite site = new BCSite();
	//site.setSiteID("SITE_ID_HERE");
	//site.setName("SITE_NAME_HERE");
	//localNotification.setFireInSite(site);

	// optional time to trigger the event after, eg 10 seconds from now
	localNotification.setFireAfter( new Date( new Date().getTime() + ( 10 * 1000 ) ) );

	// add a category or several categories to trigger the notification
	final BCCategory category = new BCCategory();
	category.setName( "CATEGORY_NAME" );

	final List<BCCategory> categories = new ArrayList<>();
	categories.add( category );

	localNotification.setFireInCategories( categories );

	// can add an optional proximity to trigger event
	localNotification.setFireInProximity( BCProximity.BC_PROXIMITY_IMMEDIATE );

	// set alert title and content
	localNotification.setAlertContentTitle( "ALERT_TITLE" );
	localNotification.setAlertContentText( "ALERT_CONTENT" );

	// launch icon and ringtone are optional. will just default ringtone and app icon for defaults
	localNotification.setAlertSmallIcon( R.mipmap.ic_launcher );
	localNotification.setAlertSound( RingtoneManager.getDefaultUri( RingtoneManager.TYPE_NOTIFICATION ) );

	// this controls where the notification takes you.
	// can also contain a bundle or any extra info that you might want to unpack
	final Intent contentIntent = new Intent( BeaconsActivity.this, SitesActivity.class );
	localNotification.setContentIntent( contentIntent );

	BCLocalNotificationManager.getInstance().scheduleLocalNotification( localNotification );
}
 
开发者ID:bluecats,项目名称:bluecats-scratchingpost-android,代码行数:68,代码来源:BeaconsActivity.java


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