Skip to content

Commit

Permalink
OnBootReceiver: use Extras to convey info to MainService
Browse files Browse the repository at this point in the history
  • Loading branch information
bk138 committed Aug 14, 2022
1 parent 29f598a commit 9f51719
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public void onReceive(Context context, Intent arg1)
Log.i(TAG, "onReceive: configured to start");
Intent intent = new Intent(context, MainService.class);
intent.setAction(MainService.ACTION_START);
intent.putExtra(MainService.EXTRA_PASSWORD, prefs.getString(Constants.PREFS_KEY_SETTINGS_PASSWORD, Constants.DEFAULT_PASSWORD));
intent.putExtra(MainService.EXTRA_SCALING, prefs.getFloat(Constants.PREFS_KEY_SETTINGS_SCALING, Constants.DEFAULT_SCALING));
intent.putExtra(MainService.EXTRA_FILE_TRANSFER, prefs.getBoolean(Constants.PREFS_KEY_SETTINGS_FILE_TRANSFER, Constants.DEFAULT_FILE_TRANSFER));
intent.putExtra(MainService.EXTRA_VIEW_ONLY, prefs.getBoolean(Constants.PREFS_KEY_SETTINGS_VIEW_ONLY, Constants.DEFAULT_VIEW_ONLY));
intent.putExtra(MainService.EXTRA_LISTEN_PORT, prefs.getInt(Constants.PREFS_KEY_SETTINGS_PORT_LISTEN, Constants.DEFAULT_PORT_LISTEN));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(intent);
} else {
Expand Down

0 comments on commit 9f51719

Please sign in to comment.