diff --git a/sense-android-library/src/nl/sense_os/platform/SensePlatform.java b/sense-android-library/src/nl/sense_os/platform/SensePlatform.java index e3beb267..69f843f7 100644 --- a/sense-android-library/src/nl/sense_os/platform/SensePlatform.java +++ b/sense-android-library/src/nl/sense_os/platform/SensePlatform.java @@ -198,7 +198,7 @@ public boolean addDataPoint(String sensorName, String displayName, String descri intent.putExtra(DataPoint.VALUE, (String) value); } intent.putExtra(DataPoint.TIMESTAMP, timestamp); - intent.setClass(mContext, nl.sense_os.service.MsgHandler.class); + intent.setPackage(mContext.getPackageName()); ComponentName serviceName = mContext.startService(intent); if (null != serviceName) { @@ -256,7 +256,7 @@ public void close() { public boolean flushData() throws IllegalStateException { checkSenseService(); Intent flush = new Intent(mContext.getString(R.string.action_sense_send_data)); - flush.setClass(mContext, nl.sense_os.service.MsgHandler.class); + flush.setPackage(mContext.getPackageName()); ComponentName started = mContext.startService(flush); return null != started; } diff --git a/sense-android-library/src/nl/sense_os/service/AliveChecker.java b/sense-android-library/src/nl/sense_os/service/AliveChecker.java index 8cc4360c..061286c6 100755 --- a/sense-android-library/src/nl/sense_os/service/AliveChecker.java +++ b/sense-android-library/src/nl/sense_os/service/AliveChecker.java @@ -41,7 +41,7 @@ public void onReceive(Context context, Intent intent) { Log.v(TAG, "Sense should be alive: poke it"); final Intent serviceIntent = new Intent( context.getString(R.string.action_sense_service)); - serviceIntent.setClass(context, nl.sense_os.service.SenseService.class); + serviceIntent.setPackage(context.getPackageName()); if (null == context.startService(serviceIntent)) { Log.w(TAG, "Could not start Sense service!"); } diff --git a/sense-android-library/src/nl/sense_os/service/BootRx.java b/sense-android-library/src/nl/sense_os/service/BootRx.java index 2df228bf..e2c597c3 100755 --- a/sense-android-library/src/nl/sense_os/service/BootRx.java +++ b/sense-android-library/src/nl/sense_os/service/BootRx.java @@ -34,7 +34,7 @@ public void onReceive(Context context, Intent intent) { if (true == autostart) { Log.i(TAG, "Autostart Sense Platform service"); Intent startService = new Intent(context.getString(R.string.action_sense_service)); - startService.setClass(context, nl.sense_os.service.SenseService.class); + startService.setPackage(context.getPackageName()); ComponentName service = context.startService(startService); if (null == service) { Log.w(TAG, "Failed to start Sense Platform service"); diff --git a/sense-android-library/src/nl/sense_os/service/DataTransmitter.java b/sense-android-library/src/nl/sense_os/service/DataTransmitter.java index 82363c67..57a40852 100755 --- a/sense-android-library/src/nl/sense_os/service/DataTransmitter.java +++ b/sense-android-library/src/nl/sense_os/service/DataTransmitter.java @@ -150,7 +150,7 @@ public void stopTransmissions() { public void transmissionService() { Log.v(TAG, "Start transmission"); Intent task = new Intent(mContext.getString(R.string.action_sense_send_data)); - task.setClass(mContext, nl.sense_os.service.MsgHandler.class); + task.setPackage(mContext.getPackageName()); mLastTxTime = SystemClock.elapsedRealtime(); ComponentName service = mContext.startService(task); if (null == service) { diff --git a/sense-android-library/src/nl/sense_os/service/NetworkMonitor.java b/sense-android-library/src/nl/sense_os/service/NetworkMonitor.java index c3ddf6a1..422aeba8 100755 --- a/sense-android-library/src/nl/sense_os/service/NetworkMonitor.java +++ b/sense-android-library/src/nl/sense_os/service/NetworkMonitor.java @@ -37,7 +37,7 @@ public void onReceive(final Context context, Intent intent) { if (false == state.isLoggedIn()) { Log.i(TAG, "Regained connectivity! Try to log in"); Intent i = new Intent(context.getString(R.string.action_sense_service)); - i.setClass(context, nl.sense_os.service.SenseService.class); + i.setPackage(context.getPackageName()); context.startService(i); diff --git a/sense-android-library/src/nl/sense_os/service/SenseService.java b/sense-android-library/src/nl/sense_os/service/SenseService.java index f2aa2160..35df1434 100755 --- a/sense-android-library/src/nl/sense_os/service/SenseService.java +++ b/sense-android-library/src/nl/sense_os/service/SenseService.java @@ -389,10 +389,10 @@ private void onLogOut() { // completely stop the MsgHandler service Intent newDataIntent = new Intent(getString(R.string.action_sense_new_data)); - newDataIntent.setClass(this, nl.sense_os.service.MsgHandler.class); + newDataIntent.setPackage(getPackageName()); stopService(newDataIntent); Intent sendDataIntent = new Intent(getString(R.string.action_sense_send_data)); - sendDataIntent.setClass(this, nl.sense_os.service.MsgHandler.class); + sendDataIntent.setPackage(getPackageName()); stopService(sendDataIntent); } @@ -1196,7 +1196,7 @@ synchronized void toggleMain(boolean active) { // properly start the service to start sensing Log.i(TAG, "Start service"); Intent serviceIntent = new Intent(getString(R.string.action_sense_service)); - serviceIntent.setClass(this, nl.sense_os.service.SenseService.class); + serviceIntent.setPackage(getPackageName()); startService(serviceIntent); } else { diff --git a/sense-android-library/src/nl/sense_os/service/ambience/AutoCalibratedNoiseSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/AutoCalibratedNoiseSensor.java index 16786005..0a2040b4 100644 --- a/sense-android-library/src/nl/sense_os/service/ambience/AutoCalibratedNoiseSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/AutoCalibratedNoiseSensor.java @@ -109,7 +109,7 @@ private void sendSensorValue(double value, long ms) { sensorData.putExtra(DataPoint.VALUE, (float)value); sensorData.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT); sensorData.putExtra(DataPoint.TIMESTAMP, ms); - sensorData.setClass(context, nl.sense_os.service.MsgHandler.class); + sensorData.setPackage(context.getPackageName()); context.startService(sensorData); } } diff --git a/sense-android-library/src/nl/sense_os/service/ambience/CameraLightSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/CameraLightSensor.java index 6d9a4657..9982e9ba 100644 --- a/sense-android-library/src/nl/sense_os/service/ambience/CameraLightSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/CameraLightSensor.java @@ -63,7 +63,7 @@ public void lightValueCallback(float lightValue, int camera_id) { i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensorDescription); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); // Log.e(TAG, "Sent new camera licht values, camera: "+camera_id+" value: "+lightValue); nextUpdate(camera_id); diff --git a/sense-android-library/src/nl/sense_os/service/ambience/HumiditySensor.java b/sense-android-library/src/nl/sense_os/service/ambience/HumiditySensor.java index 35e4580f..ded20353 100755 --- a/sense-android-library/src/nl/sense_os/service/ambience/HumiditySensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/HumiditySensor.java @@ -111,7 +111,7 @@ public void onSensorChanged(SensorEvent event) { i.putExtra(DataPoint.SENSOR_NAME, sensorName); i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensor.getName()); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(mContext, nl.sense_os.service.MsgHandler.class); + i.setPackage(mContext.getPackageName()); mContext.startService(i); // done with sample diff --git a/sense-android-library/src/nl/sense_os/service/ambience/LightSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/LightSensor.java index 49ce6fbf..9194a4f1 100755 --- a/sense-android-library/src/nl/sense_os/service/ambience/LightSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/LightSensor.java @@ -150,7 +150,7 @@ public void onSensorChanged(SensorEvent event) { i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensor.getName()); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, time); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); this.context.startService(i); stopSample(); diff --git a/sense-android-library/src/nl/sense_os/service/ambience/LoudnessSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/LoudnessSensor.java index a7eb659e..6782cf0d 100644 --- a/sense-android-library/src/nl/sense_os/service/ambience/LoudnessSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/LoudnessSensor.java @@ -152,7 +152,7 @@ private void sendSensorValue(double value, long ms) { sensorData.putExtra(DataPoint.VALUE, (float)value); sensorData.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT); sensorData.putExtra(DataPoint.TIMESTAMP, ms); - sensorData.setClass(context, nl.sense_os.service.MsgHandler.class); + sensorData.setPackage(context.getPackageName()); context.startService(sensorData); } } diff --git a/sense-android-library/src/nl/sense_os/service/ambience/MagneticFieldSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/MagneticFieldSensor.java index 32b7edfd..dc64a02a 100644 --- a/sense-android-library/src/nl/sense_os/service/ambience/MagneticFieldSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/MagneticFieldSensor.java @@ -154,7 +154,7 @@ public void onSensorChanged(SensorEvent event) { i.putExtra(DataPoint.DISPLAY_NAME, SENSOR_DISPLAY_NAME); i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensor.getName()); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(mContext, nl.sense_os.service.MsgHandler.class); + i.setPackage(mContext.getPackageName()); mContext.startService(i); // sample is successful: unregister the listener diff --git a/sense-android-library/src/nl/sense_os/service/ambience/NoiseSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/NoiseSensor.java index 12095c1e..75b8c54a 100755 --- a/sense-android-library/src/nl/sense_os/service/ambience/NoiseSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/NoiseSensor.java @@ -300,7 +300,7 @@ public void run() { BigDecimal.valueOf(dB).setScale(2, 0).floatValue()); sensorData.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT); sensorData.putExtra(DataPoint.TIMESTAMP, startTimestamp); - sensorData.setClass(context, nl.sense_os.service.MsgHandler.class); + sensorData.setPackage(context.getPackageName()); context.startService(sensorData); } @@ -334,7 +334,7 @@ else if (spectrum[i] != Double.NaN && spectrum[i] != Double.NEGATIVE_INFINITY) / sensorData.putExtra(DataPoint.VALUE, jsonSpectrum.toString()); sensorData.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); sensorData.putExtra(DataPoint.TIMESTAMP, startTimestamp); - sensorData.setClass(context, nl.sense_os.service.MsgHandler.class); + sensorData.setPackage(context.getPackageName()); context.startService(sensorData); } @@ -520,7 +520,7 @@ public void sendAudio() i.putExtra(DataPoint.VALUE, fileName); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FILE); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } catch (Exception e) { @@ -602,7 +602,7 @@ public void sendData(JSONObject data, long startTimestamp) sensorData.putExtra(DataPoint.VALUE, data.toString()); sensorData.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); sensorData.putExtra(DataPoint.TIMESTAMP, startTimestamp); - sensorData.setClass(context, nl.sense_os.service.MsgHandler.class); + sensorData.setPackage(context.getPackageName()); context.startService(sensorData); } } diff --git a/sense-android-library/src/nl/sense_os/service/ambience/PressureSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/PressureSensor.java index c8bb6073..602b0071 100755 --- a/sense-android-library/src/nl/sense_os/service/ambience/PressureSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/PressureSensor.java @@ -140,7 +140,7 @@ public void onSensorChanged(SensorEvent event) { i.putExtra(DataPoint.SENSOR_NAME, sensorName); i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensor.getName()); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(mContext, nl.sense_os.service.MsgHandler.class); + i.setPackage(mContext.getPackageName()); mContext.startService(i); // sample is successful: unregister the listener diff --git a/sense-android-library/src/nl/sense_os/service/ambience/TemperatureSensor.java b/sense-android-library/src/nl/sense_os/service/ambience/TemperatureSensor.java index 4731a643..a43f6dee 100755 --- a/sense-android-library/src/nl/sense_os/service/ambience/TemperatureSensor.java +++ b/sense-android-library/src/nl/sense_os/service/ambience/TemperatureSensor.java @@ -111,7 +111,7 @@ public void onSensorChanged(SensorEvent event) { i.putExtra(DataPoint.SENSOR_NAME, sensorName); i.putExtra(DataPoint.SENSOR_DESCRIPTION, sensor.getName()); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(mContext, nl.sense_os.service.MsgHandler.class); + i.setPackage(mContext.getPackageName()); mContext.startService(i); // done with sample diff --git a/sense-android-library/src/nl/sense_os/service/commonsense/senddata/BufferTransmitHandler.java b/sense-android-library/src/nl/sense_os/service/commonsense/senddata/BufferTransmitHandler.java index 1f9be81b..0865ef57 100644 --- a/sense-android-library/src/nl/sense_os/service/commonsense/senddata/BufferTransmitHandler.java +++ b/sense-android-library/src/nl/sense_os/service/commonsense/senddata/BufferTransmitHandler.java @@ -329,7 +329,7 @@ private boolean postData(String cookie, JSONObject transmission) throws JSONExce final Intent serviceIntent = new Intent(ctxRef.get().getString( R.string.action_sense_service)); serviceIntent.putExtra(SenseService.EXTRA_RELOGIN, true); - serviceIntent.setClass(ctxRef.get(), nl.sense_os.service.SenseService.class); + serviceIntent.setPackage(ctxRef.get().getPackageName()); ctxRef.get().startService(serviceIntent); } diff --git a/sense-android-library/src/nl/sense_os/service/commonsense/senddata/DataTransmitHandler.java b/sense-android-library/src/nl/sense_os/service/commonsense/senddata/DataTransmitHandler.java index 315269f8..91176876 100644 --- a/sense-android-library/src/nl/sense_os/service/commonsense/senddata/DataTransmitHandler.java +++ b/sense-android-library/src/nl/sense_os/service/commonsense/senddata/DataTransmitHandler.java @@ -94,7 +94,7 @@ public void handleMessage(Message msg) { final Intent serviceIntent = new Intent(ctxRef.get().getString( R.string.action_sense_service)); serviceIntent.putExtra(SenseService.EXTRA_RELOGIN, true); - serviceIntent.setClass(ctxRef.get(), nl.sense_os.service.SenseService.class); + serviceIntent.setPackage(ctxRef.get().getPackageName()); ctxRef.get().startService(serviceIntent); } diff --git a/sense-android-library/src/nl/sense_os/service/configuration/ConfigurationService.java b/sense-android-library/src/nl/sense_os/service/configuration/ConfigurationService.java index 3e5ddf5c..2202f196 100644 --- a/sense-android-library/src/nl/sense_os/service/configuration/ConfigurationService.java +++ b/sense-android-library/src/nl/sense_os/service/configuration/ConfigurationService.java @@ -1074,7 +1074,7 @@ else if (syncRate >= 900) // Eco-mode (30 min) // apply change by starting the service Intent i = new Intent(getString(R.string.action_sense_service)); - i.setClass(this, nl.sense_os.service.SenseService.class); + i.setPackage(getPackageName()); startService(i); } catch (JSONException e) { diff --git a/sense-android-library/src/nl/sense_os/service/deviceprox/BluetoothDeviceProximity.java b/sense-android-library/src/nl/sense_os/service/deviceprox/BluetoothDeviceProximity.java index c689cfcb..647a03ef 100755 --- a/sense-android-library/src/nl/sense_os/service/deviceprox/BluetoothDeviceProximity.java +++ b/sense-android-library/src/nl/sense_os/service/deviceprox/BluetoothDeviceProximity.java @@ -206,7 +206,7 @@ private void onScanFinished() { i.putExtra(DataPoint.VALUE, deviceJson.toString()); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); BluetoothDeviceProximity.this.context.startService(i); } @@ -225,7 +225,7 @@ private void onScanFinished() { i.putExtra(DataPoint.VALUE, nrBluetoothNeighbours); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.INT); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); BluetoothDeviceProximity.this.context.startService(i); Log.v(TAG, "Found " + nrBluetoothNeighbours + " bluetooth neighbours"); diff --git a/sense-android-library/src/nl/sense_os/service/deviceprox/NfcScan.java b/sense-android-library/src/nl/sense_os/service/deviceprox/NfcScan.java index 926e994a..c82f9b10 100755 --- a/sense-android-library/src/nl/sense_os/service/deviceprox/NfcScan.java +++ b/sense-android-library/src/nl/sense_os/service/deviceprox/NfcScan.java @@ -348,7 +348,7 @@ private void submit() { dataPoint.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); dataPoint.putExtra(DataPoint.TIMESTAMP, sensorDataPoint.timeStamp); dataPoint.putExtra(DataPoint.VALUE, value); - dataPoint.setClass(this, nl.sense_os.service.MsgHandler.class); + dataPoint.setPackage(getPackageName()); startService(dataPoint); } } diff --git a/sense-android-library/src/nl/sense_os/service/deviceprox/WIFIDeviceProximity.java b/sense-android-library/src/nl/sense_os/service/deviceprox/WIFIDeviceProximity.java index 209d3766..f93350aa 100755 --- a/sense-android-library/src/nl/sense_os/service/deviceprox/WIFIDeviceProximity.java +++ b/sense-android-library/src/nl/sense_os/service/deviceprox/WIFIDeviceProximity.java @@ -77,7 +77,7 @@ public void onReceive(Context context, Intent intent) { i.putExtra(DataPoint.VALUE, deviceJson.toString()); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); WIFIDeviceProximity.this.context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/external_sensors/NewOBD2DeviceConnector.java b/sense-android-library/src/nl/sense_os/service/external_sensors/NewOBD2DeviceConnector.java index 3e08053e..2ce82feb 100644 --- a/sense-android-library/src/nl/sense_os/service/external_sensors/NewOBD2DeviceConnector.java +++ b/sense-android-library/src/nl/sense_os/service/external_sensors/NewOBD2DeviceConnector.java @@ -676,7 +676,7 @@ private boolean SendDataPoint(String sensorName, String sensorDescription, Objec Log.w(TAG, "Error sending data point: unexpected data type! '" + dataType + "'"); } intent.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - intent.setClass(context, nl.sense_os.service.MsgHandler.class); + intent.setPackage(context.getPackageName()); boolean itemsent = (context.startService(intent) != null); if (!itemsent) Log.e(TAG, "Sending of DataPoint: " + sensorName + " " + value + " " diff --git a/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Dongle.java b/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Dongle.java index f46b21bb..4d5100c8 100755 --- a/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Dongle.java +++ b/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Dongle.java @@ -525,7 +525,7 @@ public void sendIntent(){ i.putExtra(DataPoint.VALUE, getJSON().toString()); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Sensor.java b/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Sensor.java index 75c002f2..d21c4855 100644 --- a/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Sensor.java +++ b/sense-android-library/src/nl/sense_os/service/external_sensors/OBD2Sensor.java @@ -155,7 +155,7 @@ private void sendDemoDataPoint(String description, Object value, Log.w(TAG, "Error sending data point: unexpected data type! '" + dataType + "'"); } intent.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - intent.setClass(context, nl.sense_os.service.MsgHandler.class); + intent.setPackage(context.getPackageName()); context.startService(intent); } @@ -266,7 +266,7 @@ public void sendIntent(){ i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); //TODO: i.putExtra(DataPoint.DEVICE_UUID, ) - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrBioHarness.java b/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrBioHarness.java index 2c4a8ad5..ad9ce0d9 100755 --- a/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrBioHarness.java +++ b/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrBioHarness.java @@ -325,7 +325,7 @@ private void sendDataPoint(String sensorName, String description, Object value, Log.w(TAG, "Error sending data point: unexpected data type! '" + dataType + "'"); } intent.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - intent.setClass(context, nl.sense_os.service.MsgHandler.class); + intent.setPackage(context.getPackageName()); context.startService(intent); } } diff --git a/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrHxM.java b/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrHxM.java index f839eee8..a1adddda 100755 --- a/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrHxM.java +++ b/sense-android-library/src/nl/sense_os/service/external_sensors/ZephyrHxM.java @@ -433,7 +433,7 @@ private void sendDataPoint(String sensorName, String description, Object value, Log.w(TAG, "Error sending data point: unexpected data type! '" + dataType + "'"); } intent.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - intent.setClass(context, nl.sense_os.service.MsgHandler.class); + intent.setPackage(context.getPackageName()); context.startService(intent); } } diff --git a/sense-android-library/src/nl/sense_os/service/location/LocationSensor.java b/sense-android-library/src/nl/sense_os/service/location/LocationSensor.java index c087a019..04c63646 100755 --- a/sense-android-library/src/nl/sense_os/service/location/LocationSensor.java +++ b/sense-android-library/src/nl/sense_os/service/location/LocationSensor.java @@ -102,7 +102,7 @@ public void onLocationChanged(Location fix) { i.putExtra(DataPoint.VALUE, json.toString()); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, timestamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); distanceEstimator.addPoint(fix); @@ -170,7 +170,7 @@ public void onReceive(Context context, Intent intent) { i.putExtra(DataPoint.VALUE, (float) distance); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); // start counting again, from the last location diff --git a/sense-android-library/src/nl/sense_os/service/location/TimeZoneSensor.java b/sense-android-library/src/nl/sense_os/service/location/TimeZoneSensor.java index 3016e300..774076da 100644 --- a/sense-android-library/src/nl/sense_os/service/location/TimeZoneSensor.java +++ b/sense-android-library/src/nl/sense_os/service/location/TimeZoneSensor.java @@ -91,7 +91,7 @@ protected void sendTimeZone() i.putExtra(DataPoint.SENSOR_DESCRIPTION, dataPoint.sensorDescription); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); this.context.startService(i); } catch(Exception e) diff --git a/sense-android-library/src/nl/sense_os/service/motion/EpilepsySensor.java b/sense-android-library/src/nl/sense_os/service/motion/EpilepsySensor.java index 4b4c1fa5..80a07c66 100755 --- a/sense-android-library/src/nl/sense_os/service/motion/EpilepsySensor.java +++ b/sense-android-library/src/nl/sense_os/service/motion/EpilepsySensor.java @@ -108,7 +108,7 @@ private void sendData(Sensor sensor) { i.putExtra(DataPoint.VALUE, value); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON_TIME_SERIES); i.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime() - LOCAL_BUFFER_TIME); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/motion/FallDetector.java b/sense-android-library/src/nl/sense_os/service/motion/FallDetector.java index e3fad6db..3d121d52 100755 --- a/sense-android-library/src/nl/sense_os/service/motion/FallDetector.java +++ b/sense-android-library/src/nl/sense_os/service/motion/FallDetector.java @@ -234,7 +234,7 @@ public void sendFallMessage(boolean fall) { i.putExtra(DataPoint.VALUE, fall); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.BOOL); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/motion/MotionBurstSensor.java b/sense-android-library/src/nl/sense_os/service/motion/MotionBurstSensor.java index bba93b23..d0d8822e 100644 --- a/sense-android-library/src/nl/sense_os/service/motion/MotionBurstSensor.java +++ b/sense-android-library/src/nl/sense_os/service/motion/MotionBurstSensor.java @@ -156,7 +156,7 @@ private void sendData(Sensor sensor) { i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON_TIME_SERIES); i.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime() - burstDuration); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } } diff --git a/sense-android-library/src/nl/sense_os/service/motion/MotionEnergySensor.java b/sense-android-library/src/nl/sense_os/service/motion/MotionEnergySensor.java index 85da6ae4..c4943b78 100755 --- a/sense-android-library/src/nl/sense_os/service/motion/MotionEnergySensor.java +++ b/sense-android-library/src/nl/sense_os/service/motion/MotionEnergySensor.java @@ -146,7 +146,7 @@ private void sendData() { i.putExtra(DataPoint.VALUE, value); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/motion/StandardMotionSensor.java b/sense-android-library/src/nl/sense_os/service/motion/StandardMotionSensor.java index 28c0cf77..06d33b24 100755 --- a/sense-android-library/src/nl/sense_os/service/motion/StandardMotionSensor.java +++ b/sense-android-library/src/nl/sense_os/service/motion/StandardMotionSensor.java @@ -110,7 +110,7 @@ private void sendData(String description, String sensorName, JSONObject json) { i.putExtra(DataPoint.VALUE, json.toString()); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.JSON); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } catch(Exception e) diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoSensor.java b/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoSensor.java index 6f6ee7ba..5a2b16bd 100644 --- a/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoSensor.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoSensor.java @@ -138,7 +138,7 @@ private void sendAppInfo() { i.putExtra(DataPoint.VALUE, json.toString()); i.putExtra(DataPoint.SENSOR_NAME, SensorNames.APP_INFO_SENSOR); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } }; diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoVersion.java b/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoVersion.java index 7d02b7c9..07310240 100644 --- a/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoVersion.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/AppInfoVersion.java @@ -2,6 +2,6 @@ public abstract class AppInfoVersion { - public final static String SENSE_LIBRARY_VERSION = "v3.3.2-4-g73f0dc4-dirty"; - public final static String CORTEX_VERSION = "v1.4.2-coaching_v3.0"; + public final static String SENSE_LIBRARY_VERSION = "v3.3.2-5-g704a66e-dirty"; + public final static String CORTEX_VERSION = "v1.4.2-coaching_v3.0-dirty"; } diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/AppsSensor.java b/sense-android-library/src/nl/sense_os/service/phonestate/AppsSensor.java index 4e1e1f0e..076c0e95 100644 --- a/sense-android-library/src/nl/sense_os/service/phonestate/AppsSensor.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/AppsSensor.java @@ -97,7 +97,7 @@ private void sendInstalledApps(List apps) { i.putExtra(DataPoint.VALUE, value.toString()); i.putExtra(DataPoint.SENSOR_NAME, SensorNames.APP_INSTALLED); i.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } catch (JSONException e) { @@ -118,7 +118,7 @@ private void sendForegroundApp(JSONObject foreGroundApp) { i.putExtra(DataPoint.VALUE, foreGroundApp.toString()); i.putExtra(DataPoint.SENSOR_NAME, SensorNames.APP_FOREGROUND); i.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/BatterySensor.java b/sense-android-library/src/nl/sense_os/service/phonestate/BatterySensor.java index f880b17a..773cccd3 100755 --- a/sense-android-library/src/nl/sense_os/service/phonestate/BatterySensor.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/BatterySensor.java @@ -136,7 +136,7 @@ public void onReceive(Context context, Intent intent) { i.putExtra(DataPoint.SENSOR_NAME, SensorNames.BATTERY_SENSOR); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); lastSampleTime = System.currentTimeMillis(); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/PhoneActivitySensor.java b/sense-android-library/src/nl/sense_os/service/phonestate/PhoneActivitySensor.java index 7960a09a..84edcc07 100755 --- a/sense-android-library/src/nl/sense_os/service/phonestate/PhoneActivitySensor.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/PhoneActivitySensor.java @@ -84,7 +84,7 @@ private void sendData(String screen) i.putExtra(DataPoint.VALUE, json.toString()); i.putExtra(DataPoint.SENSOR_NAME, SensorNames.SCREEN_ACTIVITY); i.putExtra(DataPoint.TIMESTAMP, dataPoint.timeStamp); - i.setClass(context, nl.sense_os.service.MsgHandler.class); + i.setPackage(context.getPackageName()); context.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/ProximitySensor.java b/sense-android-library/src/nl/sense_os/service/phonestate/ProximitySensor.java index 7fc55d8a..4bcbcfb3 100755 --- a/sense-android-library/src/nl/sense_os/service/phonestate/ProximitySensor.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/ProximitySensor.java @@ -153,7 +153,7 @@ private void handleLatestValue() { i.putExtra(DataPoint.VALUE, value); i.putExtra(DataPoint.DATA_TYPE, SenseDataTypes.FLOAT); i.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - i.setClass(mContext, nl.sense_os.service.MsgHandler.class); + i.setPackage(mContext.getPackageName()); mContext.startService(i); } diff --git a/sense-android-library/src/nl/sense_os/service/phonestate/SensePhoneState.java b/sense-android-library/src/nl/sense_os/service/phonestate/SensePhoneState.java index ca52e8bd..3ee492e6 100755 --- a/sense-android-library/src/nl/sense_os/service/phonestate/SensePhoneState.java +++ b/sense-android-library/src/nl/sense_os/service/phonestate/SensePhoneState.java @@ -347,7 +347,7 @@ private void sendDataPoint(String sensorName, Object value, String dataType) { Log.w(TAG, "Error sending data point: unexpected data type! '" + dataType + "'"); } intent.putExtra(DataPoint.TIMESTAMP, SNTP.getInstance().getTime()); - intent.setClass(context, nl.sense_os.service.MsgHandler.class); + intent.setPackage(context.getPackageName()); context.startService(intent); } diff --git a/sense-android-library/src/nl/sense_os/service/push/GCMReceiver.java b/sense-android-library/src/nl/sense_os/service/push/GCMReceiver.java index 21a5e653..7d7555a1 100644 --- a/sense-android-library/src/nl/sense_os/service/push/GCMReceiver.java +++ b/sense-android-library/src/nl/sense_os/service/push/GCMReceiver.java @@ -240,7 +240,7 @@ private void toggleService(Context context, String toggle) { editor.commit(); Intent task = new Intent(context.getString(R.string.action_sense_service)); - task.setClass(context, nl.sense_os.service.SenseService.class); + task.setPackage(context.getPackageName()); context.startService(task); } else if (toggle.equals("0") && started) { Editor editor = getSharedPreferences(SensePrefs.STATUS_PREFS, MODE_PRIVATE).edit(); @@ -248,7 +248,7 @@ private void toggleService(Context context, String toggle) { editor.commit(); Intent task = new Intent(context.getString(R.string.action_sense_service)); - task.setClass(context, nl.sense_os.service.SenseService.class); + task.setPackage(context.getPackageName()); context.startService(task); } }