├── AndroidStudioSample ├── .gitignore ├── .idea │ ├── gradle.xml │ ├── misc.xml │ └── modules.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── libs │ │ ├── BRTSDK_5.1.0.jar │ │ └── commons-codec-1.8.jar │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── brtbeacon │ │ │ └── sdk │ │ │ └── demo │ │ │ ├── BleApplication.java │ │ │ ├── DeviceAdjustActivity.java │ │ │ ├── DeviceConfigActivity.java │ │ │ ├── DeviceMenuActivity.java │ │ │ ├── DeviceMonitorActivity.java │ │ │ ├── DeviceScanActivity.java │ │ │ ├── DeviceScanActivityV2.java │ │ │ ├── DeviceSimulateActivity.java │ │ │ ├── ParameterInfo.java │ │ │ ├── ParameterListDialogFragment.java │ │ │ ├── SampleMainActivity.java │ │ │ └── adapter │ │ │ ├── BeaconViewAdapter.java │ │ │ └── BeaconViewHolder.java │ │ └── res │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ │ ├── layout │ │ ├── actionbar_indeterminate_progress.xml │ │ ├── activity_characteristic.xml │ │ ├── activity_device_adjust.xml │ │ ├── activity_device_config.xml │ │ ├── activity_device_menu.xml │ │ ├── activity_device_monitor.xml │ │ ├── activity_device_scan.xml │ │ ├── activity_device_scan_v2.xml │ │ ├── activity_device_simulate.xml │ │ ├── activity_gatt_services_characteristics.xml │ │ ├── activity_main.xml │ │ ├── activity_sample_main.xml │ │ ├── activity_test_config.xml │ │ ├── dialog_parameter_list.xml │ │ ├── gatt_services_characteristics.xml │ │ ├── item_device_info.xml │ │ └── listitem_device.xml │ │ ├── menu │ │ ├── characteristic.xml │ │ ├── device_adjust.xml │ │ ├── device_config.xml │ │ ├── device_menu.xml │ │ ├── device_monitor.xml │ │ ├── device_simulate.xml │ │ ├── gatt_services.xml │ │ ├── main.xml │ │ └── sample_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── BRTSDK_5.1.0.jar ├── README.md ├── doc ├── allclasses-frame.html ├── allclasses-noframe.html ├── com │ └── brtbeacon │ │ └── sdk │ │ ├── BRTAdvertiseData.html │ │ ├── BRTBeacon.html │ │ ├── BRTBeaconConfig.html │ │ ├── BRTBeaconConnection.html │ │ ├── BRTBeaconConnectionV2.html │ │ ├── BRTBeaconManager.html │ │ ├── BRTBeaconPower.html │ │ ├── BRTMonitor.html │ │ ├── BRTRegion.State.html │ │ ├── BRTRegion.html │ │ ├── BRTThrowable.html │ │ ├── BeaconScanner.html │ │ ├── IBle.html │ │ ├── Proximity.html │ │ ├── SDKVersion.html │ │ ├── Utils.RestartCompletedListener.html │ │ ├── Utils.html │ │ ├── Version.html │ │ ├── callback │ │ ├── BRTBeaconAdvertiseListener.html │ │ ├── BRTBeaconConnectionListener.html │ │ ├── BRTBeaconFirmWareUpdateListener.html │ │ ├── BRTBeaconManagerListener.html │ │ ├── BRTBeaconMonitorListener.html │ │ ├── BRTBeaconUpdateListener.html │ │ ├── WriteCallback.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html ├── constant-values.html ├── deprecated-list.html ├── help-doc.html ├── index-files │ ├── index-1.html │ ├── index-10.html │ ├── index-11.html │ ├── index-12.html │ ├── index-13.html │ ├── index-14.html │ ├── index-15.html │ ├── index-16.html │ ├── index-17.html │ ├── index-18.html │ ├── index-19.html │ ├── index-2.html │ ├── index-20.html │ ├── index-21.html │ ├── index-3.html │ ├── index-4.html │ ├── index-5.html │ ├── index-6.html │ ├── index-7.html │ ├── index-8.html │ └── index-9.html ├── index.html ├── overview-frame.html ├── overview-summary.html ├── overview-tree.html ├── package-list ├── script.js └── stylesheet.css └── 智石科技Beacon扫描SDK集成说明.pdf /AndroidStudioSample/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | .idea 11 | gradle 12 | -------------------------------------------------------------------------------- /AndroidStudioSample/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /AndroidStudioSample/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 34 | 51 | 52 | 53 | 54 | 55 | 56 | 58 | -------------------------------------------------------------------------------- /AndroidStudioSample/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 31 5 | buildToolsVersion '31.0.0' 6 | defaultConfig { 7 | applicationId "com.brightbeacon.sdk.androidstudiosample" 8 | minSdk 23 9 | targetSdk 31 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | productFlavors { 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(include: ['*.jar'], dir: 'libs') 26 | implementation files('libs\\BRTSDK_5.1.0.jar') 27 | androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', { 28 | exclude group: 'com.android.support', module: 'support-annotations' 29 | }) 30 | implementation 'androidx.appcompat:appcompat:1.4.1' 31 | implementation 'com.google.android.material:material:1.5.0' 32 | implementation 'androidx.recyclerview:recyclerview:1.2.1' 33 | testImplementation 'junit:junit:4.13.2' 34 | } 35 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/libs/BRTSDK_5.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_Android_SDK/f38163cb351255e96deccaf06837c4d31f6aff30/AndroidStudioSample/app/libs/BRTSDK_5.1.0.jar -------------------------------------------------------------------------------- /AndroidStudioSample/app/libs/commons-codec-1.8.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_Android_SDK/f38163cb351255e96deccaf06837c4d31f6aff30/AndroidStudioSample/app/libs/commons-codec-1.8.jar -------------------------------------------------------------------------------- /AndroidStudioSample/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\android\android-sdks/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | 36 | 37 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 51 | 52 | 53 | 56 | 57 | 60 | 61 | 64 | 65 | 68 | 69 | 72 | 73 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/BleApplication.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import com.brtbeacon.sdk.BRTBeaconManager; 4 | import com.brtbeacon.sdk.IBle; 5 | import com.brtbeacon.sdk.utils.L; 6 | import android.app.Application; 7 | 8 | public class BleApplication extends Application { 9 | 10 | private BRTBeaconManager beaconManager; 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | // 开启log打印 16 | L.enableDebugLogging(true); 17 | // 单例 18 | beaconManager = BRTBeaconManager.getInstance(this); 19 | // 注册应用 APPKEY申请地址 http://brtbeacon.com/main/index.shtml 20 | beaconManager.registerApp("00000000000000000000000000000000"); 21 | // 开启Beacon扫描服务 22 | //beaconManager.startService(); 23 | 24 | } 25 | 26 | public void stopService() { 27 | //beaconManager.stopService(); 28 | } 29 | 30 | /** 31 | * 创建Beacon连接需要传递此参数 32 | * @return IBle 33 | */ 34 | public IBle getIBle() { 35 | return beaconManager.getIBle(); 36 | } 37 | 38 | /** 39 | * 获取Beacon管理对象 40 | * @return BRTBeaconManager 41 | */ 42 | public BRTBeaconManager getBRTBeaconManager() { 43 | return beaconManager; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/DeviceMenuActivity.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import com.brtbeacon.sdk.BRTBeacon; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.os.Bundle; 8 | import android.widget.Toast; 9 | 10 | public class DeviceMenuActivity extends Activity { 11 | 12 | public final static String KEY_BEACON_OBJ = "key_beacon_obj"; 13 | 14 | private BRTBeacon beacon; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_device_menu); 20 | 21 | beacon = getIntent().getParcelableExtra(KEY_BEACON_OBJ); 22 | if(beacon == null) { 23 | Toast.makeText(this, "请选择Beacon后重试!", Toast.LENGTH_SHORT).show(); 24 | finish(); 25 | } 26 | 27 | } 28 | 29 | public static void startActivity(Context context, BRTBeacon beacon) { 30 | Intent intent = new Intent(context, DeviceMenuActivity.class); 31 | intent.putExtra(KEY_BEACON_OBJ, beacon); 32 | context.startActivity(intent); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/DeviceMonitorActivity.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import com.brtbeacon.sdk.BRTBeacon; 4 | import com.brtbeacon.sdk.BRTBeaconManager; 5 | import com.brtbeacon.sdk.BRTMonitor; 6 | import com.brtbeacon.sdk.BRTRegion; 7 | import com.brtbeacon.sdk.callback.BRTBeaconMonitorListener; 8 | import android.app.Activity; 9 | import android.content.Context; 10 | import android.content.Intent; 11 | import android.os.Bundle; 12 | import android.view.View; 13 | import android.view.View.OnClickListener; 14 | import android.widget.CheckBox; 15 | import android.widget.CompoundButton; 16 | import android.widget.Toast; 17 | import android.widget.CompoundButton.OnCheckedChangeListener; 18 | 19 | public class DeviceMonitorActivity extends Activity implements OnClickListener, OnCheckedChangeListener { 20 | 21 | public final static String KEY_BEACON_OBJ = "key_beacon_obj"; 22 | 23 | private BRTBeacon mBeacon; 24 | private BRTBeaconManager beaconManager; 25 | private BRTMonitor monitor; 26 | 27 | private CheckBox cbox_notify_inside; 28 | private CheckBox cbox_notify_outside; 29 | 30 | 31 | @Override 32 | protected void onCreate(Bundle savedInstanceState) { 33 | super.onCreate(savedInstanceState); 34 | setContentView(R.layout.activity_device_monitor); 35 | 36 | mBeacon = getIntent().getParcelableExtra(KEY_BEACON_OBJ); 37 | if(mBeacon == null) { 38 | Toast.makeText(this, "请选择Beacon设备!", Toast.LENGTH_SHORT).show(); 39 | finish(); 40 | } 41 | 42 | 43 | beaconManager = BRTBeaconManager.getInstance(this); 44 | beaconManager.setPowerMode(BRTBeaconManager.POWER_MODE_LOW_POWER); 45 | 46 | cbox_notify_inside = (CheckBox)findViewById(R.id.cbox_notify_inside); 47 | cbox_notify_outside = (CheckBox)findViewById(R.id.cbox_notify_outside); 48 | 49 | cbox_notify_inside.setOnCheckedChangeListener(this); 50 | cbox_notify_outside.setOnCheckedChangeListener(this); 51 | findViewById(R.id.btn_stop_all).setOnClickListener(this); 52 | 53 | } 54 | 55 | @Override 56 | public void onClick(View view) { 57 | 58 | switch (view.getId()) { 59 | case R.id.btn_stop_all: { 60 | beaconManager.removeAllMonitor(); 61 | break; 62 | } 63 | 64 | default: 65 | break; 66 | } 67 | 68 | } 69 | 70 | @Override 71 | public void onCheckedChanged(CompoundButton button, boolean isChecked) { 72 | beaconManager.removeMonitor(monitor); 73 | if(cbox_notify_inside.isChecked() || cbox_notify_outside.isChecked()) { 74 | monitor = new BRTMonitor(mBeacon.getMacAddress(), null, null, null, true, true); 75 | beaconManager.addMonitor(monitor); 76 | } 77 | } 78 | 79 | @Override 80 | protected void onResume() { 81 | super.onResume(); 82 | beaconManager.setBeaconMonitorListener(monitorListener); 83 | beaconManager.startMonitoring(); 84 | } 85 | 86 | @Override 87 | protected void onPause() { 88 | super.onPause(); 89 | beaconManager.stopMonitoring(); 90 | beaconManager.setBeaconMonitorListener(null); 91 | } 92 | 93 | @Override 94 | protected void onDestroy() { 95 | super.onDestroy(); 96 | beaconManager.removeAllMonitor(); 97 | } 98 | 99 | private BRTBeaconMonitorListener monitorListener = new BRTBeaconMonitorListener() { 100 | @Override 101 | public void onRegion(BRTBeacon beacon, BRTRegion region, int state) { 102 | 103 | System.out.println("监听通知!"); 104 | 105 | String toastMsg; 106 | if(state == 0) { 107 | toastMsg = "离开Beacon所在区域!"; 108 | } else { 109 | toastMsg = "进入Beacon所在区域!"; 110 | } 111 | Toast.makeText(DeviceMonitorActivity.this, toastMsg, Toast.LENGTH_SHORT).show(); 112 | } 113 | }; 114 | 115 | public static void startActivity(Context context, BRTBeacon beacon) { 116 | Intent intent = new Intent(context, DeviceMonitorActivity.class); 117 | intent.putExtra(KEY_BEACON_OBJ, beacon); 118 | context.startActivity(intent); 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/DeviceScanActivity.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import android.app.AlertDialog; 4 | import android.bluetooth.BluetoothAdapter; 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.content.DialogInterface.OnClickListener; 8 | import android.content.Intent; 9 | import android.os.Bundle; 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.widget.AdapterView; 14 | import android.widget.AdapterView.OnItemClickListener; 15 | import android.widget.ArrayAdapter; 16 | import android.widget.ListView; 17 | import android.widget.TextView; 18 | 19 | import com.brtbeacon.sdk.BRTBeacon; 20 | import com.brtbeacon.sdk.BRTBeaconManager; 21 | import com.brtbeacon.sdk.BRTThrowable; 22 | import com.brtbeacon.sdk.callback.BRTBeaconManagerListener; 23 | 24 | import java.util.ArrayList; 25 | import java.util.Calendar; 26 | import java.util.List; 27 | 28 | public class DeviceScanActivity extends AppCompatActivity implements OnItemClickListener, View.OnClickListener { 29 | 30 | public final static String KEY_ACTION_TYPE = "key_action_type"; 31 | // Beacon参数配置 32 | public final static int ACTION_EDIT = 1; 33 | // Beacon距离校准 34 | public final static int ACTION_ADJUST = 2; 35 | // Beacon通知 36 | public final static int ACTION_NOTIFY = 3; 37 | 38 | private ListView listView; 39 | 40 | private List beaconList = new ArrayList(); 41 | private ArrayAdapter beaconAdapter = null; 42 | private BRTBeaconManager beaconManager = null; 43 | 44 | private int clickAction = 0; 45 | 46 | @Override 47 | protected void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | setContentView(R.layout.activity_device_scan); 50 | 51 | clickAction = getIntent().getIntExtra(KEY_ACTION_TYPE, 0); 52 | listView = (ListView)findViewById(R.id.listView); 53 | 54 | beaconAdapter = new ArrayAdapter(this, R.layout.item_device_info, android.R.id.text1, beaconList){ 55 | @Override 56 | public View getView(int position, View convertView, ViewGroup parent) { 57 | View view = super.getView(position, convertView, parent); 58 | TextView tvRssi = (TextView)view.findViewById(R.id.device_rssi); 59 | TextView tvName = (TextView)view.findViewById(R.id.device_name); 60 | TextView tvAddr = (TextView)view.findViewById(R.id.device_address); 61 | TextView tvMajor = (TextView)view.findViewById(R.id.tv_major); 62 | TextView tvMinor = (TextView) view.findViewById(R.id.tv_minor); 63 | TextView tvUuid = (TextView) view.findViewById(R.id.tv_uuid); 64 | TextView tvUserData = (TextView) view.findViewById(R.id.tv_userdata); 65 | 66 | BRTBeacon beacon = getItem(position); 67 | 68 | tvRssi.setText(String.valueOf(beacon.getRssi())); 69 | tvName.setText(String.valueOf(beacon.getName())); 70 | tvAddr.setText(beacon.getMacAddress()); 71 | tvMajor.setText(String.valueOf(beacon.getMajor())); 72 | tvMinor.setText(String.valueOf(beacon.getMinor())); 73 | tvUuid.setText(beacon.getUuid()); 74 | //tvUserData.setText(String.valueOf(Hex.encodeHex(beacon.getUserData())).toUpperCase()); 75 | 76 | return view; 77 | } 78 | }; 79 | 80 | listView.setAdapter(beaconAdapter); 81 | listView.setOnItemClickListener(this); 82 | 83 | findViewById(R.id.btn_refresh).setOnClickListener(this); 84 | 85 | TextView tvIntro = (TextView) findViewById(R.id.tv_intro); 86 | if(clickAction == ACTION_ADJUST) { 87 | tvIntro.setText("请点击Beacon设备,进行距离校准!"); 88 | } else if(clickAction == ACTION_EDIT) { 89 | tvIntro.setText("请点击Beacon设备,进行参数配置!"); 90 | } else if(clickAction == ACTION_NOTIFY){ 91 | tvIntro.setText("请点击Beacon设备,进行通知测试!"); 92 | } else { 93 | tvIntro.setVisibility(View.GONE); 94 | } 95 | 96 | checkBluetoothValid(); 97 | 98 | beaconManager = BRTBeaconManager.getInstance(this); 99 | beaconManager.setPowerMode(BRTBeaconManager.POWER_MODE_LOW_POWER); 100 | } 101 | 102 | @Override 103 | protected void onResume() { 104 | super.onResume(); 105 | startScan(); 106 | } 107 | 108 | @Override 109 | protected void onPause() { 110 | super.onPause(); 111 | stopScan(); 112 | } 113 | 114 | private void startScan() { 115 | beaconManager.setBRTBeaconManagerListener(scanListener); 116 | beaconManager.startRanging(); 117 | } 118 | 119 | private void stopScan() { 120 | beaconManager.stopRanging(); 121 | beaconManager.setBRTBeaconManagerListener(null); 122 | } 123 | 124 | private void checkBluetoothValid() { 125 | final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 126 | if(adapter == null) { 127 | AlertDialog dialog = new AlertDialog.Builder(this).setTitle("错误").setMessage("你的设备不具备蓝牙功能!").create(); 128 | dialog.show(); 129 | return; 130 | } 131 | 132 | if(!adapter.isEnabled()) { 133 | AlertDialog dialog = new AlertDialog.Builder(this).setTitle("提示") 134 | .setMessage("蓝牙设备未打开,请开启此功能后重试!") 135 | .setPositiveButton("确认", new OnClickListener() { 136 | @Override 137 | public void onClick(DialogInterface arg0, int arg1) { 138 | Intent mIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); 139 | startActivityForResult(mIntent, 1); 140 | } 141 | }) 142 | .create(); 143 | dialog.show(); 144 | } 145 | } 146 | 147 | @Override 148 | public void onItemClick(AdapterView parent, View view, int position, long id) { 149 | BRTBeacon beacon = (BRTBeacon)parent.getItemAtPosition(position); 150 | switch(clickAction) { 151 | case ACTION_EDIT: { 152 | DeviceConfigActivity.startActivity(this, beacon); 153 | break; 154 | } 155 | 156 | case ACTION_ADJUST: { 157 | DeviceAdjustActivity.startActivity(this, beacon); 158 | break; 159 | } 160 | 161 | case ACTION_NOTIFY: { 162 | DeviceMonitorActivity.startActivity(this, beacon); 163 | break; 164 | } 165 | 166 | } 167 | } 168 | 169 | private BRTBeaconManagerListener scanListener = new BRTBeaconManagerListener() { 170 | 171 | @Override 172 | public void onUpdateBeacon(final ArrayList arg0) { 173 | 174 | runOnUiThread(new Runnable() { 175 | 176 | @Override 177 | public void run() { 178 | beaconList.clear(); 179 | beaconList.addAll(arg0); 180 | beaconAdapter.notifyDataSetChanged(); 181 | System.out.println(Calendar.getInstance().getTimeInMillis()); 182 | } 183 | }); 184 | 185 | } 186 | 187 | @Override 188 | public void onNewBeacon(BRTBeacon arg0) { 189 | 190 | } 191 | 192 | @Override 193 | public void onGoneBeacon(BRTBeacon arg0) { 194 | 195 | } 196 | 197 | @Override 198 | public void onError(BRTThrowable arg0) { 199 | 200 | } 201 | }; 202 | 203 | public static void startActivity(Context context, int clickType) { 204 | Intent intent = new Intent(context, DeviceScanActivity.class); 205 | intent.putExtra(KEY_ACTION_TYPE, clickType); 206 | context.startActivity(intent); 207 | } 208 | 209 | @Override 210 | public void onClick(View view) { 211 | switch(view.getId()) { 212 | case R.id.btn_refresh: { 213 | stopScan(); 214 | beaconList.clear(); 215 | beaconAdapter.notifyDataSetChanged(); 216 | startScan(); 217 | break; 218 | } 219 | } 220 | 221 | } 222 | 223 | } 224 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/DeviceScanActivityV2.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import android.app.AlertDialog; 4 | import android.bluetooth.BluetoothAdapter; 5 | import android.content.Context; 6 | import android.content.DialogInterface; 7 | import android.content.DialogInterface.OnClickListener; 8 | import android.content.Intent; 9 | import android.os.Bundle; 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import androidx.recyclerview.widget.LinearLayoutManager; 12 | import androidx.recyclerview.widget.RecyclerView; 13 | 14 | import android.view.View; 15 | import android.widget.TextView; 16 | 17 | import com.brtbeacon.sdk.BRTBeacon; 18 | import com.brtbeacon.sdk.BRTBeaconManager; 19 | import com.brtbeacon.sdk.BRTThrowable; 20 | import com.brtbeacon.sdk.callback.BRTBeaconManagerListener; 21 | import com.brtbeacon.sdk.demo.adapter.BeaconViewAdapter; 22 | 23 | import java.util.ArrayList; 24 | 25 | public class DeviceScanActivityV2 extends AppCompatActivity implements View.OnClickListener { 26 | 27 | private RecyclerView beaconListView = null; 28 | private BeaconViewAdapter beaconViewAdapter = null; 29 | private BRTBeaconManager beaconManager = null; 30 | private TextView tvIntro = null; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.activity_device_scan_v2); 36 | tvIntro = findViewById(R.id.tv_intro); 37 | 38 | beaconListView = findViewById(R.id.listView); 39 | findViewById(R.id.btn_refresh).setOnClickListener(this); 40 | checkBluetoothValid(); 41 | 42 | beaconManager = BRTBeaconManager.getInstance(this); 43 | beaconManager.setPowerMode(BRTBeaconManager.POWER_MODE_LOW_POWER); 44 | 45 | beaconViewAdapter = new BeaconViewAdapter(); 46 | beaconListView.setAdapter(beaconViewAdapter); 47 | beaconListView.setLayoutManager(new LinearLayoutManager(this)); 48 | } 49 | 50 | @Override 51 | protected void onResume() { 52 | super.onResume(); 53 | startScan(); 54 | } 55 | 56 | @Override 57 | protected void onPause() { 58 | super.onPause(); 59 | stopScan(); 60 | } 61 | 62 | private void startScan() { 63 | beaconManager.setBRTBeaconManagerListener(scanListener); 64 | beaconManager.startRanging(); 65 | } 66 | 67 | private void stopScan() { 68 | beaconManager.stopRanging(); 69 | beaconManager.setBRTBeaconManagerListener(null); 70 | } 71 | 72 | private void checkBluetoothValid() { 73 | final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 74 | if(adapter == null) { 75 | AlertDialog dialog = new AlertDialog.Builder(this).setTitle("错误").setMessage("你的设备不具备蓝牙功能!").create(); 76 | dialog.show(); 77 | return; 78 | } 79 | 80 | if(!adapter.isEnabled()) { 81 | AlertDialog dialog = new AlertDialog.Builder(this).setTitle("提示") 82 | .setMessage("蓝牙设备未打开,请开启此功能后重试!") 83 | .setPositiveButton("确认", new OnClickListener() { 84 | @Override 85 | public void onClick(DialogInterface arg0, int arg1) { 86 | Intent mIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); 87 | startActivityForResult(mIntent, 1); 88 | } 89 | }) 90 | .create(); 91 | dialog.show(); 92 | } 93 | } 94 | 95 | private BRTBeaconManagerListener scanListener = new BRTBeaconManagerListener() { 96 | 97 | @Override 98 | public void onUpdateBeacon(final ArrayList arg0) { 99 | beaconViewAdapter.replaceAll(arg0); 100 | tvIntro.setText("周边设备数量:" + beaconViewAdapter.getItemCount()); 101 | } 102 | 103 | @Override 104 | public void onNewBeacon(BRTBeacon arg0) { 105 | 106 | } 107 | 108 | @Override 109 | public void onGoneBeacon(BRTBeacon arg0) { 110 | 111 | } 112 | 113 | @Override 114 | public void onError(BRTThrowable arg0) { 115 | 116 | } 117 | }; 118 | 119 | public static void startActivity(Context context) { 120 | Intent intent = new Intent(context, DeviceScanActivityV2.class); 121 | context.startActivity(intent); 122 | } 123 | 124 | @Override 125 | public void onClick(View view) { 126 | switch(view.getId()) { 127 | case R.id.btn_refresh: { 128 | stopScan(); 129 | beaconViewAdapter.replaceAll(null); 130 | tvIntro.setText(""); 131 | startScan(); 132 | break; 133 | } 134 | } 135 | 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/DeviceSimulateActivity.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import com.brtbeacon.sdk.BRTAdvertiseData; 4 | import com.brtbeacon.sdk.BRTBeaconManager; 5 | import com.brtbeacon.sdk.BRTThrowable; 6 | import com.brtbeacon.sdk.callback.BRTBeaconAdvertiseListener; 7 | import android.app.Activity; 8 | import android.content.Context; 9 | import android.content.Intent; 10 | import android.os.Bundle; 11 | import android.view.View; 12 | import android.view.View.OnClickListener; 13 | import android.widget.Button; 14 | import android.widget.EditText; 15 | import android.widget.Toast; 16 | 17 | public class DeviceSimulateActivity extends Activity implements OnClickListener { 18 | 19 | private BRTBeaconManager beaconManager; 20 | 21 | private EditText editMajor; 22 | private EditText editMinor; 23 | private EditText editUUID; 24 | private Button btnStart; 25 | 26 | private boolean mAdvFlag = false; 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_device_simulate); 32 | beaconManager = BRTBeaconManager.getInstance(this); 33 | initView(); 34 | } 35 | 36 | private void initView() { 37 | editMajor = (EditText)findViewById(R.id.edit_major); 38 | editMinor = (EditText)findViewById(R.id.edit_minor); 39 | editUUID = (EditText)findViewById(R.id.edit_uuid); 40 | 41 | btnStart = (Button) findViewById(R.id.btn_start); 42 | findViewById(R.id.btn_start).setOnClickListener(this); 43 | } 44 | 45 | private void startAdvertise() { 46 | 47 | String uuid = editUUID.getText().toString().replace("-", "").trim(); 48 | int uuidLen = uuid.length(); 49 | if(uuidLen != 32) { 50 | showToast("UUID长度不对,请输入32个16进制字符"); 51 | return; 52 | } 53 | 54 | String major = editMajor.getText().toString(); 55 | int nMajor = -1; 56 | try { 57 | nMajor = Integer.parseInt(major); 58 | } catch(Exception e) {} 59 | if(nMajor < 0 || nMajor > 65535) { 60 | showToast("Major为无效数字, 范围为0-65535"); 61 | return; 62 | } 63 | 64 | String minor = editMinor.getText().toString(); 65 | int nMinor = -1; 66 | try { 67 | nMinor = Integer.parseInt(minor); 68 | } catch(Exception e) {} 69 | if(nMinor < 0 || nMinor > 65535) { 70 | showToast("Minor为无效数字, 范围为0-65535"); 71 | return; 72 | } 73 | 74 | BRTAdvertiseData data = new BRTAdvertiseData(uuid, nMajor, nMinor); 75 | beaconManager.startAdvertising(data, advertiseListener); 76 | } 77 | 78 | private void stopAdvertise() { 79 | beaconManager.stopAdvertising(); 80 | } 81 | 82 | @Override 83 | protected void onDestroy() { 84 | // TODO Auto-generated method stub 85 | super.onDestroy(); 86 | stopAdvertise(); 87 | } 88 | 89 | @Override 90 | public void onClick(View view) { 91 | switch(view.getId()) { 92 | case R.id.btn_start: { 93 | 94 | if(!mAdvFlag) { 95 | btnStart.setText("停止"); 96 | btnStart.setEnabled(false); 97 | startAdvertise(); 98 | 99 | } else { 100 | btnStart.setText("开始"); 101 | stopAdvertise(); 102 | } 103 | 104 | mAdvFlag = !mAdvFlag; 105 | 106 | break; 107 | } 108 | } 109 | 110 | } 111 | 112 | private void showToast(String message) { 113 | Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); 114 | } 115 | 116 | public static void startActivity(Context context) { 117 | Intent intent = new Intent(context, DeviceSimulateActivity.class); 118 | context.startActivity(intent); 119 | } 120 | 121 | private BRTBeaconAdvertiseListener advertiseListener = new BRTBeaconAdvertiseListener() { 122 | 123 | @Override 124 | public void onStartSuccess() { 125 | runOnUiThread(new Runnable() { 126 | @Override 127 | public void run() { 128 | btnStart.setEnabled(true); 129 | showToast("广播开启成功!"); 130 | } 131 | }); 132 | } 133 | 134 | @Override 135 | public void onStartFailure(final BRTThrowable arg0) { 136 | runOnUiThread(new Runnable() { 137 | @Override 138 | public void run() { 139 | btnStart.setEnabled(true); 140 | showToast("广播开启出错:" + arg0.getError()); 141 | } 142 | }); 143 | } 144 | }; 145 | 146 | } 147 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/ParameterInfo.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | public class ParameterInfo implements Parcelable { 7 | public String name; 8 | public String text; 9 | public int number; 10 | 11 | public ParameterInfo(String name, String text, int number) { 12 | this.name = name; 13 | this.text = text; 14 | this.number = number; 15 | } 16 | 17 | @Override 18 | public int describeContents() { 19 | return 0; 20 | } 21 | 22 | @Override 23 | public void writeToParcel(Parcel dest, int flags) { 24 | dest.writeString(this.name); 25 | dest.writeString(this.text); 26 | dest.writeInt(this.number); 27 | } 28 | 29 | public ParameterInfo() { 30 | } 31 | 32 | protected ParameterInfo(Parcel in) { 33 | this.name = in.readString(); 34 | this.text = in.readString(); 35 | this.number = in.readInt(); 36 | } 37 | 38 | @Override 39 | public String toString() { 40 | return this.name; 41 | } 42 | 43 | public static final Creator CREATOR = new Creator() { 44 | @Override 45 | public ParameterInfo createFromParcel(Parcel source) { 46 | return new ParameterInfo(source); 47 | } 48 | 49 | @Override 50 | public ParameterInfo[] newArray(int size) { 51 | return new ParameterInfo[size]; 52 | } 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/ParameterListDialogFragment.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import android.app.DialogFragment; 4 | import android.os.Bundle; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.AdapterView; 9 | import android.widget.AdapterView.OnItemClickListener; 10 | import android.widget.ArrayAdapter; 11 | import android.widget.ListView; 12 | 13 | public class ParameterListDialogFragment extends DialogFragment implements OnItemClickListener { 14 | 15 | public interface ParameterListener { 16 | void onParameterSelected(DialogFragment fragment, ParameterInfo param); 17 | } 18 | 19 | public final static String KEY_TITLE = "key_title"; 20 | public final static String KEY_PARAM_ARRAY = "key_param_array"; 21 | 22 | private ListView listView; 23 | private String title; 24 | //private ArrayList paramList; 25 | private ParameterInfo[] paramArray; 26 | 27 | @Override 28 | public void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | title = getArguments().getString(KEY_TITLE, "参数选择"); 31 | paramArray = (ParameterInfo[]) getArguments().getParcelableArray(KEY_PARAM_ARRAY); 32 | 33 | /* 34 | paramList = getArguments().getParcelableArrayList(KEY_PARAM_ARRAY); 35 | if(paramList == null) { 36 | paramList = new ArrayList(); 37 | } 38 | */ 39 | 40 | } 41 | 42 | @Override 43 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 44 | Bundle savedInstanceState) { 45 | getDialog().setTitle(title); 46 | View view = inflater.inflate(R.layout.dialog_parameter_list, container, false); 47 | listView = (ListView) view.findViewById(R.id.listView); 48 | listView.setAdapter(new ArrayAdapter(getActivity(), 49 | android.R.layout.simple_list_item_1, 50 | paramArray)); 51 | listView.setOnItemClickListener(this); 52 | return view; 53 | } 54 | 55 | public static ParameterListDialogFragment newInstance(String title, ParameterInfo[] params) { 56 | ParameterListDialogFragment fragment = new ParameterListDialogFragment(); 57 | Bundle args = new Bundle(); 58 | args.putString(KEY_TITLE, title); 59 | args.putParcelableArray(KEY_PARAM_ARRAY, params); 60 | fragment.setArguments(args); 61 | return fragment; 62 | } 63 | 64 | @Override 65 | public void onItemClick(AdapterView arg0, View arg1, int arg2, long arg3) { 66 | if(getActivity() instanceof ParameterListener) { 67 | ParameterListener listener = (ParameterListener)getActivity(); 68 | listener.onParameterSelected(this, (ParameterInfo)arg0.getItemAtPosition(arg2)); 69 | } 70 | dismiss(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/SampleMainActivity.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo; 2 | 3 | import android.Manifest; 4 | import android.content.pm.PackageManager; 5 | import android.os.Build; 6 | import android.os.Bundle; 7 | import androidx.annotation.NonNull; 8 | import androidx.core.app.ActivityCompat; 9 | import androidx.appcompat.app.AppCompatActivity; 10 | import android.view.View; 11 | import android.view.View.OnClickListener; 12 | import android.widget.Toast; 13 | 14 | import java.util.ArrayList; 15 | import java.util.LinkedList; 16 | import java.util.List; 17 | 18 | public class SampleMainActivity extends AppCompatActivity implements OnClickListener { 19 | 20 | private static final int BRTMAP_PERMISSION_CODE = 100; 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_sample_main); 26 | 27 | findViewById(R.id.btn_device_scan).setOnClickListener(this); 28 | findViewById(R.id.btn_device_config).setOnClickListener(this); 29 | findViewById(R.id.btn_device_notify).setOnClickListener(this); 30 | findViewById(R.id.btn_device_adjust).setOnClickListener(this); 31 | findViewById(R.id.btn_device_simluate).setOnClickListener(this); 32 | 33 | checkPermission(); 34 | } 35 | 36 | @Override 37 | public void onClick(View view) { 38 | 39 | switch(view.getId()) { 40 | 41 | case R.id.btn_device_scan: { 42 | //DeviceScanActivity.startActivity(this, 0); 43 | DeviceScanActivityV2.startActivity(this); 44 | break; 45 | } 46 | 47 | case R.id.btn_device_config: { 48 | DeviceScanActivity.startActivity(this, DeviceScanActivity.ACTION_EDIT); 49 | break; 50 | } 51 | 52 | case R.id.btn_device_notify: { 53 | DeviceScanActivity.startActivity(this, DeviceScanActivity.ACTION_NOTIFY); 54 | break; 55 | } 56 | 57 | case R.id.btn_device_adjust: { 58 | DeviceScanActivity.startActivity(this, DeviceScanActivity.ACTION_ADJUST); 59 | break; 60 | } 61 | 62 | case R.id.btn_device_simluate: { 63 | DeviceSimulateActivity.startActivity(this); 64 | break; 65 | } 66 | } 67 | 68 | } 69 | 70 | private void checkPermission() { 71 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//判断当前系统的SDK版本是否大于23 72 | List permissionNeedRequest = new LinkedList<>(); 73 | 74 | List permissions = new ArrayList<>(); 75 | 76 | permissions.add(Manifest.permission.ACCESS_FINE_LOCATION); 77 | permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION); 78 | 79 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { 80 | // 安卓12及以上版本需要申请的相关权限 81 | permissions.add(Manifest.permission.BLUETOOTH_CONNECT); 82 | permissions.add(Manifest.permission.BLUETOOTH_SCAN); 83 | permissions.add(Manifest.permission.BLUETOOTH_ADVERTISE); 84 | } 85 | 86 | for (String permssion: permissions) { 87 | if(ActivityCompat.checkSelfPermission(this, permssion) != PackageManager.PERMISSION_GRANTED) { 88 | permissionNeedRequest.add(permssion); 89 | } 90 | } 91 | if (permissionNeedRequest.isEmpty()) { 92 | return; 93 | } 94 | 95 | ActivityCompat.requestPermissions(this, permissionNeedRequest.toArray(new String[0]), BRTMAP_PERMISSION_CODE); 96 | } 97 | } 98 | 99 | @Override 100 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { 101 | super.onRequestPermissionsResult(requestCode, permissions, grantResults); 102 | switch (requestCode) { 103 | // requestCode即所声明的权限获取码,在requestPermissions时传入 104 | case BRTMAP_PERMISSION_CODE: 105 | boolean isAllGrant = true; 106 | for (int grantResult: grantResults) { 107 | if (grantResult != PackageManager.PERMISSION_GRANTED) { 108 | isAllGrant = false; 109 | break; 110 | } 111 | } 112 | if (!isAllGrant) { 113 | Toast.makeText(getApplicationContext(), "获取位置权限失败,请手动前往设置开启", Toast.LENGTH_SHORT).show(); 114 | } 115 | break; 116 | default: 117 | break; 118 | } 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/adapter/BeaconViewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo.adapter; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.recyclerview.widget.RecyclerView; 5 | 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.brtbeacon.sdk.BRTBeacon; 11 | import com.brtbeacon.sdk.demo.R; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | public class BeaconViewAdapter extends RecyclerView.Adapter { 17 | 18 | private List beaconList = new ArrayList<>(); 19 | 20 | @NonNull 21 | @Override 22 | public BeaconViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 23 | LayoutInflater inflater = LayoutInflater.from(parent.getContext()); 24 | View itemView = inflater.inflate(R.layout.item_device_info, parent, false); 25 | return new BeaconViewHolder(itemView); 26 | } 27 | 28 | @Override 29 | public void onBindViewHolder(@NonNull BeaconViewHolder holder, int position) { 30 | BRTBeacon beacon = beaconList.get(position); 31 | holder.bind(beacon); 32 | } 33 | 34 | @Override 35 | public int getItemCount() { 36 | return beaconList.size(); 37 | } 38 | 39 | public void replaceAll(List beacons) { 40 | beaconList.clear(); 41 | if (beacons != null) { 42 | beaconList.addAll(beacons); 43 | } 44 | notifyDataSetChanged(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/java/com/brtbeacon/sdk/demo/adapter/BeaconViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.brtbeacon.sdk.demo.adapter; 2 | 3 | import android.view.View; 4 | import android.widget.TextView; 5 | 6 | import androidx.recyclerview.widget.RecyclerView; 7 | 8 | import com.brtbeacon.sdk.BRTBeacon; 9 | import com.brtbeacon.sdk.demo.R; 10 | 11 | public class BeaconViewHolder extends RecyclerView.ViewHolder { 12 | 13 | private BRTBeacon beacon; 14 | 15 | TextView tvRssi; 16 | TextView tvName; 17 | TextView tvAddr; 18 | TextView tvMajor; 19 | TextView tvMinor; 20 | TextView tvUuid; 21 | 22 | public BeaconViewHolder(View itemView) { 23 | super(itemView); 24 | tvRssi = itemView.findViewById(R.id.device_rssi); 25 | tvName = itemView.findViewById(R.id.device_name); 26 | tvAddr = itemView.findViewById(R.id.device_address); 27 | tvMajor = itemView.findViewById(R.id.tv_major); 28 | tvMinor = itemView.findViewById(R.id.tv_minor); 29 | tvUuid = itemView.findViewById(R.id.tv_uuid); 30 | } 31 | 32 | public void bind(BRTBeacon beacon) { 33 | this.beacon = beacon; 34 | updateView(); 35 | } 36 | 37 | private void updateView() { 38 | if (beacon == null) 39 | return; 40 | tvRssi.setText(String.valueOf(beacon.getRssi())); 41 | tvName.setText(String.valueOf(beacon.getName())); 42 | tvAddr.setText(beacon.getMacAddress()); 43 | tvMajor.setText(String.valueOf(beacon.getMajor())); 44 | tvMinor.setText(String.valueOf(beacon.getMinor())); 45 | tvUuid.setText(beacon.getUuid()); 46 | } 47 | 48 | 49 | 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_Android_SDK/f38163cb351255e96deccaf06837c4d31f6aff30/AndroidStudioSample/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_Android_SDK/f38163cb351255e96deccaf06837c4d31f6aff30/AndroidStudioSample/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_Android_SDK/f38163cb351255e96deccaf06837c4d31f6aff30/AndroidStudioSample/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_Android_SDK/f38163cb351255e96deccaf06837c4d31f6aff30/AndroidStudioSample/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/res/layout/actionbar_indeterminate_progress.xml: -------------------------------------------------------------------------------- 1 | 16 | 20 | 23 | 24 | -------------------------------------------------------------------------------- /AndroidStudioSample/app/src/main/res/layout/activity_characteristic.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 20 | 21 | 24 | 25 | 30 | 31 | 36 | 37 | 38 | 41 | 42 | 47 | 48 | 53 | 54 | 55 | 58 | 59 |