use of sugar.free.sightparser.handling.SightServiceConnector in project SightRemote by TebbeUbben.
the class SightRemote method onCreate.
@Override
public void onCreate() {
super.onCreate();
instance = this;
Fabric.with(this, new Crashlytics());
PreferenceManager.setDefaultValues(this, R.xml.settings, true);
NotificationCenter.setupUpChannels();
serviceConnector = new SightServiceConnector(this);
serviceConnector.connectToService();
ContextCompat.startForegroundService(this, new Intent(this, OngoingNotificationService.class));
startService(new Intent(this, SightService.class));
startService(new Intent(this, HistorySyncService.class));
startService(new Intent(this, AlertService.class));
if (Preferences.getBooleanPref(Preferences.PREF_BOOLEAN_AUTO_ADJUST_TIME))
startService(new Intent(this, TimeSynchronizationService.class));
}
use of sugar.free.sightparser.handling.SightServiceConnector in project SightRemote by TebbeUbben.
the class ACLReceiver method onReceive.
@Override
public void onReceive(Context context, Intent intent) {
String mac = ((BluetoothDevice) intent.getParcelableExtra("android.bluetooth.device.extra.DEVICE")).getAddress();
SightServiceConnector serviceConnector = SightRemote.getInstance().getServiceConnector();
if (serviceConnector.isConnectedToService())
serviceConnector.aclDisconnect(mac);
}
use of sugar.free.sightparser.handling.SightServiceConnector in project SightRemote by TebbeUbben.
the class HistorySyncService method onStartCommand.
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
powerManager = (PowerManager) getSystemService(POWER_SERVICE);
alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
if (pendingIntent == null)
PendingIntent.getBroadcast(this, 0, new Intent(HistoryBroadcast.ACTION_START_SYNC), 0);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "HistorySyncService");
connector = new SightServiceConnector(this);
connector.addStatusCallback(this);
connector.setConnectionCallback(this);
final IntentFilter intentFilter = new IntentFilter(HistoryBroadcast.ACTION_START_SYNC);
intentFilter.addAction(HistoryBroadcast.ACTION_START_RESYNC);
getApplicationContext().registerReceiver(broadcastReceiver, intentFilter);
if (pendingIntent != null)
alarmManager.cancel(pendingIntent);
if (getBooleanPref(PREF_BOOLEAN_BACKGROUND_SYNC_ENABLED)) {
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, AlarmManager.INTERVAL_FIFTEEN_MINUTES, AlarmManager.INTERVAL_FIFTEEN_MINUTES, pendingIntent);
}
return START_STICKY;
}
use of sugar.free.sightparser.handling.SightServiceConnector in project SightRemote by TebbeUbben.
the class OngoingNotificationService method onCreate.
@Override
public void onCreate() {
serviceConnector = new SightServiceConnector(this);
serviceConnector.setConnectionCallback(new ServiceConnectionCallback() {
@Override
public void onServiceConnected() {
statusChanged(serviceConnector.getStatus());
}
@Override
public void onServiceDisconnected() {
statusChanged(Status.DISCONNECTED);
}
});
serviceConnector.addStatusCallback(this::statusChanged);
serviceConnector.connectToService();
}
use of sugar.free.sightparser.handling.SightServiceConnector in project SightRemote by TebbeUbben.
the class SightActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getRootLayout());
setupToolbar();
drawerLayout = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.navigation_view);
contentFrame = findViewById(R.id.content_frame);
if (useNavigationDrawer() && drawerLayout != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.open_navigation, R.string.close_navigation);
drawerLayout.addDrawerListener(actionBarDrawerToggle);
navigationView.setNavigationItemSelectedListener(this);
if (getSelectedNavItemID() != 0)
navigationView.getMenu().findItem(getSelectedNavItemID()).setChecked(true);
} else if (drawerLayout != null)
drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
hideOverlay();
sightServiceConnector = new SightServiceConnector(this);
sightServiceConnector.setConnectionCallback(connectionCallback);
sightServiceConnector.addStatusCallback(statusCallback);
}
Aggregations