diff --git a/app/app.iml b/app/app.iml index 7865538ae..a5482ec17 100644 --- a/app/app.iml +++ b/app/app.iml @@ -85,12 +85,12 @@ + - - - + + diff --git a/app/build.gradle b/app/build.gradle index d47ddaf30..cc59358c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,13 +2,13 @@ apply plugin: 'com.android.application' android { compileSdkVersion 22 - buildToolsVersion '22.0.0' + buildToolsVersion '22.0.1' defaultConfig { applicationId "no.nordicsemi.android.nrftoolbox" minSdkVersion 18 targetSdkVersion 22 - versionCode 31 - versionName "1.13.0" + versionCode 32 + versionName "1.13.1" } buildTypes { release { @@ -20,7 +20,7 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.0.0' + compile 'com.android.support:appcompat-v7:22.1.1' compile project(':..:DFULibrary:dfu') compile files('libs/achartengine-1.1.0.jar') compile files('libs/nrf-logger-v2.0.jar') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4383534bf..2547c9ff1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,8 +23,8 @@ + android:versionCode="32" + android:versionName="1.13.1" > initializeManager() { public void onCreate() { super.onCreate(); - final IntentFilter filter = new IntentFilter(); - filter.addAction(ACTION_DISCONNECT); - registerReceiver(mDisconnectActionBroadcastReceiver, filter); + registerReceiver(mDisconnectActionBroadcastReceiver, new IntentFilter(ACTION_DISCONNECT)); + registerReceiver(mIntentBroadcastReceiver, new IntentFilter(ACTION_SEND)); } @Override @@ -89,6 +93,7 @@ public void onDestroy() { // when user has disconnected from the sensor, we have to cancel the notification that we've created some milliseconds before using unbindService cancelNotification(); unregisterReceiver(mDisconnectActionBroadcastReceiver); + unregisterReceiver(mIntentBroadcastReceiver); super.onDestroy(); } @@ -118,10 +123,15 @@ public void onDataReceived(final String data) { final Intent broadcast = new Intent(BROADCAST_UART_RX); broadcast.putExtra(EXTRA_DATA, data); LocalBroadcastManager.getInstance(this).sendBroadcast(broadcast); + + // send the data received to other apps, e.g. the Tasker + final Intent globalBroadcast = new Intent(ACTION_RECEIVE); + globalBroadcast.putExtra(Intent.EXTRA_TEXT, data); + sendBroadcast(globalBroadcast); } @Override - public void onDataSent(String data) { + public void onDataSent(final String data) { Logger.a(getLogSession(), "\"" + data + "\" sent"); final Intent broadcast = new Intent(BROADCAST_UART_TX); @@ -181,4 +191,16 @@ public void onReceive(final Context context, final Intent intent) { } }; + /** + * Broadcast receiver that listens for {@link #ACTION_SEND} from other apps. Sends the String content of the {@link Intent#EXTRA_TEXT} extra to the remote device. + */ + private BroadcastReceiver mIntentBroadcastReceiver = new BroadcastReceiver() { + @Override + public void onReceive(final Context context, final Intent intent) { + Logger.i(getLogSession(), "[Broadcast] Disconnect action pressed"); + final String message = intent.getStringExtra(Intent.EXTRA_TEXT); + mManager.send(message); + } + }; + }