Skip to content

Commit 6e18fbc

Browse files
Merge pull request #668 from TakayukiHoshi1984/modify_background_activity
Systemプロファイルの挙動改善
2 parents b2bb727 + 3ea691b commit 6e18fbc

44 files changed

Lines changed: 170 additions & 59 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dConnectDevicePlugin/dConnectDeviceAndroidWear/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
dependencies {
1010
implementation fileTree(include: '*.jar', dir: 'libs')
11-
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.3'
11+
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.4'
1212
implementation 'androidx.multidex:multidex:2.0.1'
1313
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
1414

dConnectDevicePlugin/dConnectDeviceChromeCast/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ repositories {
6363

6464
dependencies {
6565
implementation fileTree(include: '*.jar', dir: 'libs')
66-
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.3'
66+
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.4'
6767
implementation 'com.google.android.gms:play-services-cast-framework:17.1.0'
6868
}
6969

dConnectDevicePlugin/dConnectDeviceFaBo/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ repositories {
5656

5757
dependencies {
5858
implementation fileTree(include: '*.jar', dir: 'libs')
59-
api 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.3'
59+
api 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.4'
6060
testImplementation 'junit:junit:4.12'
6161
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
6262
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

dConnectDevicePlugin/dConnectDeviceHOGP/plugin/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
dependencies {
44
implementation fileTree(include: '*.jar', dir: 'libs')
5-
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.3'
5+
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.4'
66
}
77

88
repositories {

dConnectDevicePlugin/dConnectDeviceHeartRate/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ repositories {
6464

6565
dependencies {
6666
implementation fileTree(include: '*.jar', dir: 'libs')
67-
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.3'
67+
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.4'
6868
testImplementation 'junit:junit:4.12'
6969
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
7070
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

dConnectDevicePlugin/dConnectDeviceHost/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ dependencies {
7575
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
7676
implementation "androidx.preference:preference:1.1.0"
7777
implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:1.6.7'
78-
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.3'
78+
implementation 'org.deviceconnect:dconnect-device-plugin-sdk:2.8.4'
7979
implementation project(':dconnect-demo-lib')
8080
}
8181

dConnectDevicePlugin/dConnectDeviceHost/app/src/main/java/org/deviceconnect/android/deviceplugin/host/mediaplayer/HostMediaPlayerManager.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.deviceconnect.android.deviceplugin.host.BuildConfig;
3030
import org.deviceconnect.android.deviceplugin.host.HostDeviceApplication;
3131
import org.deviceconnect.android.deviceplugin.host.HostDevicePlugin;
32+
import org.deviceconnect.android.deviceplugin.host.R;
3233
import org.deviceconnect.android.event.Event;
3334
import org.deviceconnect.android.event.EventManager;
3435
import org.deviceconnect.android.message.DevicePluginContext;
@@ -171,9 +172,6 @@ public class HostMediaPlayerManager {
171172
/** Notification Id */
172173
private final int NOTIFICATION_ID = 3539;
173174

174-
/** Notification Content */
175-
private final String NOTIFICATION_CONTENT = "Host Media Player Profileからの起動要求";
176-
177175
/** ロガー. */
178176
private final Logger mLogger = Logger.getLogger("host.dplugin");
179177

@@ -511,7 +509,8 @@ public int playMedia(final Intent response) {
511509
sendOnStatusChangeEvent("play");
512510
} else {
513511
NotificationUtils.createNotificationChannel(getContext());
514-
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, mIntent, NOTIFICATION_CONTENT);
512+
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, mIntent,
513+
getContext().getString(R.string.host_notification_mediaplayer_warnning));
515514
}
516515
}
517516

dConnectDevicePlugin/dConnectDeviceHost/app/src/main/java/org/deviceconnect/android/deviceplugin/host/profile/HostCanvasProfile.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
1414

1515
import org.deviceconnect.android.deviceplugin.host.HostDeviceApplication;
16+
import org.deviceconnect.android.deviceplugin.host.R;
1617
import org.deviceconnect.android.deviceplugin.host.activity.CanvasProfileActivity;
1718
import org.deviceconnect.android.deviceplugin.host.canvas.CanvasDrawImageObject;
1819
import org.deviceconnect.android.message.MessageUtils;
@@ -50,9 +51,6 @@ public class HostCanvasProfile extends CanvasProfile {
5051
/** Notification Id */
5152
private final int NOTIFICATION_ID = 3517;
5253

53-
/** Notification Content */
54-
private final String NOTIFICATION_CONTENT = "Host Canvas Profileからの起動要求";
55-
5654
private final DConnectApi mDrawImageApi = new PostApi() {
5755

5856
@Override
@@ -177,7 +175,8 @@ private void drawImage(Intent response, String uri, CanvasDrawImageObject.Mode e
177175
getContext().startActivity(intent);
178176
} else {
179177
NotificationUtils.createNotificationChannel(getContext());
180-
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, intent, NOTIFICATION_CONTENT);
178+
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, intent,
179+
getContext().getString(R.string.host_notification_canvas_warnning));
181180
}
182181
}
183182

dConnectDevicePlugin/dConnectDeviceHost/app/src/main/java/org/deviceconnect/android/deviceplugin/host/profile/HostConnectionProfile.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import android.util.Log;
1818

1919
import org.deviceconnect.android.deviceplugin.host.BuildConfig;
20+
import org.deviceconnect.android.deviceplugin.host.R;
2021
import org.deviceconnect.android.deviceplugin.host.activity.BluetoothManageActivity;
2122
import org.deviceconnect.android.event.EventError;
2223
import org.deviceconnect.android.event.EventManager;
@@ -26,6 +27,7 @@
2627
import org.deviceconnect.android.profile.api.DeleteApi;
2728
import org.deviceconnect.android.profile.api.GetApi;
2829
import org.deviceconnect.android.profile.api.PutApi;
30+
import org.deviceconnect.android.util.NotificationUtils;
2931
import org.deviceconnect.message.DConnectMessage;
3032
import org.deviceconnect.message.intent.message.IntentDConnectMessage;
3133

@@ -41,6 +43,8 @@ public class HostConnectionProfile extends ConnectionProfile {
4143

4244
/** Bluetooth Adapter. */
4345
private BluetoothAdapter mBluetoothAdapter;
46+
/** Notification Id */
47+
private final int NOTIFICATION_ID = 3527;
4448

4549
private final DConnectApi mGetWifiApi = new GetApi() {
4650

@@ -377,7 +381,13 @@ protected void setEnabledBluetooth(final Intent request, final Intent response,
377381
Intent intent = new Intent(request);
378382
intent.setClass(getContext(), BluetoothManageActivity.class);
379383
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
380-
getContext().startActivity(intent);
384+
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
385+
this.getContext().startActivity(intent);
386+
} else {
387+
NotificationUtils.createNotificationChannel(getContext());
388+
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, intent,
389+
getContext().getString(R.string.host_notification_connection_warnning));
390+
}
381391

382392
setResult(response, IntentDConnectMessage.RESULT_OK);
383393
} else {

dConnectDevicePlugin/dConnectDeviceHost/app/src/main/java/org/deviceconnect/android/deviceplugin/host/profile/HostGeolocationProfile.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import androidx.core.app.ActivityCompat;
2323

2424
import org.deviceconnect.android.activity.PermissionUtility;
25+
import org.deviceconnect.android.deviceplugin.host.R;
2526
import org.deviceconnect.android.deviceplugin.host.activity.GeolocationAlertDialogActivity;
2627
import org.deviceconnect.android.event.Event;
2728
import org.deviceconnect.android.event.EventError;
@@ -61,9 +62,6 @@ public class HostGeolocationProfile extends GeolocationProfile implements Locati
6162
/** Notification Id */
6263
private final int NOTIFICATION_ID = 3533;
6364

64-
/** Notification Content */
65-
private final String NOTIFICATION_CONTENT = "Host Geolocation Profileからの起動要求";
66-
6765
/**
6866
* Constructor.
6967
*/
@@ -214,7 +212,8 @@ private LocationManager getLocationManager(final Intent response) {
214212
getContext().startActivity(intent);
215213
} else {
216214
NotificationUtils.createNotificationChannel(getContext());
217-
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, intent, NOTIFICATION_CONTENT);
215+
NotificationUtils.notify(getContext(), NOTIFICATION_ID, 0, intent,
216+
getContext().getString(R.string.host_notification_geolocation_warnning));
218217
}
219218
}
220219
return mLocationManager;

0 commit comments

Comments
 (0)