[key注册地址](http://sdk.aicare.net.cn) | [key注册地址](http://sdk.aicare.net.cn) | ||||
[English documentation](README.md) | |||||
minSdkVersion 19 | minSdkVersion 19 | ||||
targetSdkVersion 29 | targetSdkVersion 29 | ||||
versionCode 2 | versionCode 2 | ||||
versionName "1.2.9" | |||||
versionName "1.3.0" | |||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||||
} | } | ||||
buildTypes { | buildTypes { | ||||
implementation 'androidx.appcompat:appcompat:1.1.0' | implementation 'androidx.appcompat:appcompat:1.1.0' | ||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' | ||||
testImplementation 'junit:junit:4.12' | testImplementation 'junit:junit:4.12' | ||||
implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.2.9' | |||||
implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.2.9' | |||||
implementation 'com.github.elinkthings:AILinkSDKRepositoryAndroid:1.4.5' | |||||
implementation 'com.github.elinkthings:AILinkSDKParsingLibraryAndroid:1.3.0' | |||||
} | } |
*/ | */ | ||||
protected void startScanBle(long timeOut){ | protected void startScanBle(long timeOut){ | ||||
if (mBluetoothService!=null){ | if (mBluetoothService!=null){ | ||||
mBluetoothService.scanLeDevice(timeOut, BleConfig.SERVER_UUID); | |||||
mBluetoothService.scanLeDevice(timeOut, BleConfig.UUID_SERVER); | |||||
} | } | ||||
} | } | ||||
@Override | @Override | ||||
protected void onCreate(Bundle savedInstanceState) { | protected void onCreate(Bundle savedInstanceState) { | ||||
super.onCreate(savedInstanceState); | super.onCreate(savedInstanceState); | ||||
AILinkSDK.getInstance().init(this,"",""); | |||||
AILinkSDK.getInstance().init(this,"28307eb356debd69","00deaab8ea81acba686e725a2b"); | |||||
setContentView(R.layout.activity_main); | setContentView(R.layout.activity_main); | ||||
BleLog.init("", "", BuildConfig.DEBUG); | BleLog.init("", "", BuildConfig.DEBUG); | ||||
String version=getString(R.string.version)+":"+BuildConfig.VERSION_NAME; | String version=getString(R.string.version)+":"+BuildConfig.VERSION_NAME; | ||||
*/ | */ | ||||
private void initPermissions() { | private void initPermissions() { | ||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||||
ActivityCompat.requestPermissions(this, | |||||
new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1); | |||||
// ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 1); | |||||
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1); | |||||
} | } | ||||
} | } | ||||
public void onClick(View v) { | public void onClick(View v) { | ||||
if (mBluetoothService != null) { | if (mBluetoothService != null) { | ||||
BleLog.i(TAG, "搜索设备"); | BleLog.i(TAG, "搜索设备"); | ||||
mBluetoothService.scanLeDevice(0, BleConfig.SERVER_UUID); | |||||
mBluetoothService.scanLeDevice(0, BleConfig.UUID_SERVER); | |||||
mList.clear(); | mList.clear(); | ||||
listAdapter.notifyDataSetChanged(); | listAdapter.notifyDataSetChanged(); | ||||
} | } |