mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-23 01:14:26 +01:00
Added support for Android Wear 2.0 and wear synchronization in China
This commit is contained in:
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "no.nordicsemi.android.nrftoolbox"
|
applicationId "no.nordicsemi.android.nrftoolbox"
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 56
|
versionCode 57
|
||||||
versionName "2.2.1"
|
versionName "2.2.2"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -19,8 +19,8 @@ android {
|
|||||||
}
|
}
|
||||||
productFlavors {
|
productFlavors {
|
||||||
fastBuild {
|
fastBuild {
|
||||||
// Switching the flavor to fastBuild accelerates te build speed (works only with Android 5+ devices)
|
// Switching the flavor to fastBuild accelerates te build speed (works only with Android 7+ devices)
|
||||||
minSdkVersion 21
|
minSdkVersion 25
|
||||||
versionName "Instant Run"
|
versionName "Instant Run"
|
||||||
}
|
}
|
||||||
releaseBuild {
|
releaseBuild {
|
||||||
@@ -31,7 +31,6 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.google.android.gms:play-services-wearable:9.2.0'
|
|
||||||
compile 'com.android.support:appcompat-v7:25.0.1'
|
compile 'com.android.support:appcompat-v7:25.0.1'
|
||||||
compile 'com.android.support:design:25.0.1'
|
compile 'com.android.support:design:25.0.1'
|
||||||
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
|
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
|
||||||
@@ -42,10 +41,12 @@ dependencies {
|
|||||||
}
|
}
|
||||||
compile files('libs/achartengine-1.1.0.jar')
|
compile files('libs/achartengine-1.1.0.jar')
|
||||||
compile project(':common')
|
compile project(':common')
|
||||||
wearApp project(':wear')
|
wearApp project(path: ':wear', configuration: 'wear1Release')
|
||||||
|
// nRF Toolbox is using Play Service 7.8.87 in order to make the app working in China:
|
||||||
|
// https://developer.android.com/training/wearables/apps/creating-app-china.html#ChinaSDK
|
||||||
|
compile 'com.google.android.gms:play-services-wearable:7.8.87'
|
||||||
|
|
||||||
// The DFU Library is imported automatically from jcenter.
|
// The DFU Library is imported automatically from jcenter.
|
||||||
compile 'no.nordicsemi.android:dfu:1.1.1'
|
|
||||||
compile 'no.nordicsemi.android:dfu:1.2.0'
|
compile 'no.nordicsemi.android:dfu:1.2.0'
|
||||||
// If you want to make some changes in the DFU Library, clone the https://github.com/NordicSemiconductor/Android-DFU-Library project into DFULibrary folder,
|
// If you want to make some changes in the DFU Library, clone the https://github.com/NordicSemiconductor/Android-DFU-Library project into DFULibrary folder,
|
||||||
// add it as a module in Project Structure and uncomment the following line:
|
// add it as a module in Project Structure and uncomment the following line:
|
||||||
|
|||||||
@@ -183,6 +183,10 @@ public class UARTActivity extends BleProfileServiceReadyActivity<UARTService.UAR
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onConnected(final Bundle bundle) {
|
public void onConnected(final Bundle bundle) {
|
||||||
|
// Ensure the Wearable API was connected
|
||||||
|
if (!mWearableSynchronizer.hasConnectedApi())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!mPreferences.getBoolean(PREFS_WEAR_SYNCED, false)) {
|
if (!mPreferences.getBoolean(PREFS_WEAR_SYNCED, false)) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class UARTConfigurationSynchronizer {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mGoogleApiClient = new GoogleApiClient.Builder(context)
|
mGoogleApiClient = new GoogleApiClient.Builder(context)
|
||||||
.addApi(Wearable.API)
|
.addApiIfAvailable(Wearable.API)
|
||||||
.addConnectionCallbacks(listener)
|
.addConnectionCallbacks(listener)
|
||||||
.build();
|
.build();
|
||||||
mGoogleApiClient.connect();
|
mGoogleApiClient.connect();
|
||||||
@@ -82,13 +82,20 @@ public class UARTConfigurationSynchronizer {
|
|||||||
mGoogleApiClient = null;
|
mGoogleApiClient = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if Wearable API has been connected.
|
||||||
|
*/
|
||||||
|
public boolean hasConnectedApi() {
|
||||||
|
return mGoogleApiClient != null && mGoogleApiClient.isConnected() && mGoogleApiClient.hasConnectedApi(Wearable.API);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronizes the UART configurations between handheld and wearables.
|
* Synchronizes the UART configurations between handheld and wearables.
|
||||||
* Call this when configuration has been created or altered.
|
* Call this when configuration has been created or altered.
|
||||||
* @return pending result
|
* @return pending result
|
||||||
*/
|
*/
|
||||||
public PendingResult<DataApi.DataItemResult> onConfigurationAddedOrEdited(final long id, final UartConfiguration configuration) {
|
public PendingResult<DataApi.DataItemResult> onConfigurationAddedOrEdited(final long id, final UartConfiguration configuration) {
|
||||||
if (mGoogleApiClient == null || !mGoogleApiClient.isConnected())
|
if (!hasConnectedApi())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
final PutDataMapRequest mapRequest = PutDataMapRequest.create(Constants.UART.CONFIGURATIONS + "/" + id);
|
final PutDataMapRequest mapRequest = PutDataMapRequest.create(Constants.UART.CONFIGURATIONS + "/" + id);
|
||||||
@@ -115,7 +122,7 @@ public class UARTConfigurationSynchronizer {
|
|||||||
* @return pending result
|
* @return pending result
|
||||||
*/
|
*/
|
||||||
public PendingResult<DataApi.DeleteDataItemsResult> onConfigurationDeleted(final long id) {
|
public PendingResult<DataApi.DeleteDataItemsResult> onConfigurationDeleted(final long id) {
|
||||||
if (mGoogleApiClient == null || !mGoogleApiClient.isConnected())
|
if (!hasConnectedApi())
|
||||||
return null;
|
return null;
|
||||||
return Wearable.DataApi.deleteDataItems(mGoogleApiClient, id2Uri(id));
|
return Wearable.DataApi.deleteDataItems(mGoogleApiClient, id2Uri(id));
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
c9033445b4f085cf0aa953926eb31139
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
a78311711a9c6d69d1f611b177d75912cc27207c
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services-base</artifactId>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
<packaging>aar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.android.support</groupId>
|
||||||
|
<artifactId>support-v4</artifactId>
|
||||||
|
<version>22.2.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<type>aar</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
842db4d478652b1e85e3b360c59f2eca
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
388990307bd2886d0a7db78ccad136ba3b60b51b
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services-base</artifactId>
|
||||||
|
<versioning>
|
||||||
|
<release>7.8.87</release>
|
||||||
|
<versions>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20160122142403</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
b9f5ee764168532d755f67199a04e464
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
a6b3c7a460e1cf0a42c1f752f0bbbf5053d2b326
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
83504530d93744fb864de4bbee4d86bb
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
ca0adc50643f55dab199cb7167ca05372543e12e
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services-wearable</artifactId>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
<packaging>aar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services-base</artifactId>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<type>aar</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
739994909dc5fd30a4082102a31a0a5e
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
6741fa53e09bf4b40fd982c87c6820bba5788df8
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services-wearable</artifactId>
|
||||||
|
<versioning>
|
||||||
|
<release>7.8.87</release>
|
||||||
|
<versions>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20160122142522</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
5149ad6a0417933eed9b55741c144282
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
778c562ea8f51095b26d0e0d2ce20d79a320505d
|
||||||
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
679957fdc9da2dce6111ac417fcd3238
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
243d1a6ba16f2a4c1ccd19e3526e393584647e32
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services</artifactId>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
<packaging>aar</packaging>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.android.support</groupId>
|
||||||
|
<artifactId>support-v4</artifactId>
|
||||||
|
<version>22.2.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<type>aar</type>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
9db9c9711eeef4286913c78eca1654fc
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
6d34bc667647052417927ef361176a1288f629ab
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<groupId>com.google.android.gms</groupId>
|
||||||
|
<artifactId>play-services</artifactId>
|
||||||
|
<versioning>
|
||||||
|
<release>7.8.87</release>
|
||||||
|
<versions>
|
||||||
|
<version>7.8.87</version>
|
||||||
|
</versions>
|
||||||
|
<lastUpdated>20160122142802</lastUpdated>
|
||||||
|
</versioning>
|
||||||
|
</metadata>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
eb2e8c0689b46bfbd05bff7431559569
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
9ca5b558fcb911cf330b71ab7b0ea83843fc9a6c
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
publishNonDefault true
|
||||||
compileSdkVersion 25
|
compileSdkVersion 25
|
||||||
buildToolsVersion "25.0.1"
|
buildToolsVersion "25.0.1"
|
||||||
|
|
||||||
@@ -8,8 +9,8 @@ android {
|
|||||||
applicationId "no.nordicsemi.android.nrftoolbox"
|
applicationId "no.nordicsemi.android.nrftoolbox"
|
||||||
minSdkVersion 20
|
minSdkVersion 20
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 56
|
versionCode 202225700 // target: 25, version: 2.2.2, build: 57, multi-APK: 01
|
||||||
versionName "2.2.1"
|
versionName "2.2.2"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -17,12 +18,23 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
productFlavors {
|
||||||
|
wear1 {
|
||||||
|
// Use the defaultConfig value
|
||||||
|
}
|
||||||
|
wear2 {
|
||||||
|
minSdkVersion 25
|
||||||
|
versionCode 252225701 // target: 25, version: 2.2.2, build: 57, multi-APK: 01
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.google.android.support:wearable:1.4.0'
|
compile 'com.google.android.support:wearable:2.0.0'
|
||||||
compile 'com.google.android.gms:play-services-wearable:9.2.0'
|
// nRF Toolbox is using Play Service 7.8.87 in order to make the app working in China:
|
||||||
|
// https://developer.android.com/training/wearables/apps/creating-app-china.html#ChinaSDK
|
||||||
|
compile 'com.google.android.gms:play-services-wearable:7.8.87'
|
||||||
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
|
compile 'no.nordicsemi.android.support.v18:scanner:1.0.0'
|
||||||
compile project(':common')
|
compile project(':common')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,9 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@android:style/Theme.DeviceDefault.Light">
|
android:theme="@android:style/Theme.DeviceDefault.Light">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.android.wearable.standalone"
|
||||||
|
android:value="false" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.gms.version"
|
android:name="com.google.android.gms.version"
|
||||||
android:value="@integer/google_play_services_version" />
|
android:value="@integer/google_play_services_version" />
|
||||||
|
|||||||
Reference in New Issue
Block a user