|
@@ -0,0 +1,25 @@
|
|
|
+package org.iotivity.bridge.homeserver;
|
|
|
+
|
|
|
+import android.content.BroadcastReceiver;
|
|
|
+import android.content.Context;
|
|
|
+import android.content.Intent;
|
|
|
+import android.os.Build;
|
|
|
+import android.util.Log;
|
|
|
+
|
|
|
+public class BootCompletedReceiver extends BroadcastReceiver {
|
|
|
+
|
|
|
+ final static String TAG = BootCompletedReceiver.class.getName();
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onReceive(Context context, Intent intent) {
|
|
|
+
|
|
|
+ Log.w(TAG, "onReceive() called");
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
+ Intent in = new Intent(context, BridgeService.class);
|
|
|
+ context.startForegroundService(in);
|
|
|
+ } else {
|
|
|
+ Intent in = new Intent(context, BridgeService.class);
|
|
|
+ context.startService(in);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|