Android changelog

Version 7.1.6 (2023-12-20)

  • Updated: TokenPayload.
  • Fixed: BatteryOptimizationsChangedEvent event.

Version 7.1.5 (2023-10-26)

  • Updated: Removed one of unneeded callback event.

Version 7.1.1 (2023-09-26)

  • Added: DeviceSettings event. This event informs whether power save mode and battery optimizations are enabled on the device or not.
  • Removed: BatterySettings event.

Version 7.1.0 (2023-08-23)

  • Changed: Receive a BatterySettings event when the PowerSaveMode changes.
  • Changed: Transmit all collected events when stopping tracking.

Version 7.0.2 (2022-12-15)

  • Fixed: Retry location collection in case of failure.
  • Fixed: Refreshing device id only if new access token contains a new user id.

Version 7.0.1 (2022-11-22)

  • Changed: Update dependencies, notably the SDK now uses Kotlin 1.7.10.

Version 7.0.0 (2022-10-07)

  • Added: BatteryOptimizationsChangedEvent event. This event informs when there is a change in the app's battery optimizations setting.
  • Added: isBatteryOptimizationsEnabled read-only property. Its value will be true if battery optimizations are enabled for the application.
  • Added: PowerSaveModeChangedEvent event. This event informs when there is a change in the device's power save mode setting.
  • Added: isPowerSaveModeEnabled read-only property. Its value will be true if the device has power saving mode enabled.
  • Added: version read-only property. It returns the current SDK version.
  • Added: isSuccess read-only property to the TransmissionEvent sealed class. Its value will be true when the transmission is successful.
  • Removed: Settings class and the getSettings() function have been removed. The notification and the data transmission settings can be configured during runtime using the mutable properties notification and wifiOnlyDataTransfer, respectively.
  • Removed: Reason.KILLED has been removed. The SDK will automatically restore itself after being killed by the user or the OS, and it will not notify the application via the AutoStartEvent and AutoStopEvent anymore.
  • Changed: minimumSdkVersion has been increased to 23 (Android 6.0).
  • Changed: initialize(application: Application, settings: Settings, callback: MotionTag.Callback) function parameters have changed to initialize(application: Application, notification: Notification, callback: MotionTag.Callback).
  • Changed: userToken(token: String) and getUserToken() functions have been replaced by the mutable property userToken.
  • Changed: useWifiOnlyDataTransfer(on: Boolean) function has been replaced by the mutable property wifiOnlyDataTransfer.
  • Changed: notification(notification: Notification) function has been replaced by the mutable property notification.
  • Changed: isTrackingActive() function has been replaced by a read-only property isTrackingActive.
  • Changed: hasRequiredLocationSettings() function has been replaced by a read-only property hasRequiredLocationSettings.
  • Changed: hasRequiredPermissions() function has been replaced by a read-only property hasRequiredPermissions.
  • Changed: getRequiredPermissions() function has been replaced by a read-only property requiredPermissions.
  • Changed: getDeniedRequiredPermissions() function has been replaced by a read-only property deniedRequiredPermissions.
  • Changed: wifiOnlyDataTransfer is now false by default.
  • Changed: A completion callback parameter must be specified when calling the clearData() function. The callback function will be called on the main thread once the user data has been deleted.
  • Changed: The SDK no longer throws an IllegalStateException after calling start() function without a valid userToken. If the userToken is invalid (or null) during the data transmission process, the SDK will send a TransmissionEvent.Error event through the onEvent(event: Event) callback.

Version 6.2.0 (2022-08-17)

  • This version is identical to 6.2.0-rc01.

Version 6.2.0-rc01 (2022-07-25)

  • Added: The SDK supports apps targeting Android 13: targetSdk 33.
  • Changed: Update dependencies

Version 6.1.2 (2022-02-18)

  • Changed: Update dependencies, particularly com.google.android.gms:play-services-location which had a known NPE issue.

Version 6.1.1 (2021-12-01)

  • Fixed: Fix a rare IllegalArgumentException crash when observing connectivity changes on Android 11.

Version 6.1.0 (2021-10-20)

Important changes since version 6.0.0:

  • Added: The SDK supports apps targeting Android 12: targetSdkVersion 31.
    • Apps targeting Android 12 must now request both android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION permissions for the new precise location setting that is required by the SDK.
    • Google has introduced a new format for the backup and restore configuration file for apps that run on and target Android 12, please check our documentation for more information.

Version 6.1.0-rc02 (2021-10-13)

  • Fixed: Fix an internal state issue that could throw a ForegroundServiceStartNotAllowedException on Android 12.
  • Fixed: Fix a IllegalArgumentException crash on Android 11.

NOTE: This version depends on Jetpack WorkManager 2.7.0-rc01 which might be unstable at the moment.

Version 6.1.0-rc01 (2021-10-04)

  • Improved: Improve exception message when accessing the SDK instance without initializing it first.

NOTE: This version depends on Jetpack WorkManager 2.7.0-rc01 which might be unstable at the moment.

Version 6.1.0-beta02 (2021-09-13)

  • Improved: Reduce gaps when publishing long stays.
  • Changed: Update dependencies.

NOTE: This version depends on Jetpack WorkManager 2.7.0-beta01 which might be unstable at the moment.

Version 6.1.0-beta01 (2021-08-27)

  • Added: The SDK supports apps targeting Android 12: targetSdkVersion 31.
    • Apps targeting Android 12 must now request both android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION permissions for the new precise location setting that is required by the SDK.
    • Google has introduced a new format for the backup and restore configuration file for apps that run on and target Android 12, please check our documentation for more information.

NOTE: This version depends on Jetpack WorkManager 2.7.0-alpha05 which might be unstable at the moment.

Version 6.0.0 (2021-07-08)

  • Changed: The MotionTag functions are no longer static. The main functionality can be accessed via the class singleton instance: MotionTag.getInstance().
  • Changed: The MotionTag.with(Application, Settings, MotionTag.Callback) function has been renamed to MotionTag.getInstance().initialize(Application, Settings, MotionTag.Callback).
  • Changed: The MotionTag.start(token) function does not expect a JWT parameter anymore. The token must be specified using the new MotionTag.getInstance().userToken(token) function.
  • Changed: The Settings class initialization has been simplified by making use of parameters with default values.
  • Changed: The useBatterySavingMode setting has been removed. Battery saving mode is always enabled now.
  • Added: A userToken(token) function that allows updating the user JWT during runtime (e.g.: when the token expires). The provided token will be persisted in the SDK and must be provided before calling the start() function.
  • Added: A getUserToken(): String? function that allows retrieving the current user JWT.
  • Improved: Improve movement detection algorithm.
  • Improved: Transmit the collected data more often in order generate storyline items faster.
  • Improved: Add a prefix to the private library resources.

This commit in the sample app repository demonstrates how to update from version 5.x.x to 6.0.0.

Version 5.5.2 (2021-06-22)

  • Fixed: Correctly handle data transmission timeout.

Version 5.5.1 (2021-05-25)

  • Fixed: Fix a rare crash when trying to open the local database.
  • Fixed: Fix an issue that could lead to a delay in the initial location tracking.

Version 5.5.0 (2021-05-17)

  • Changed: Starting from this version, the Android MOTIONTAG SDK releases will now be hosted on a public Maven repository.

Please change the maven repository declaration as follows: maven { url "https://pkgs.dev.azure.com/motiontag/releases/_packaging/releases/maven/v1" }.

The old https://artifactory.motion-tag.de/artifactory/libs-release Maven repository will be deactivated on January 31, 2022.

Version 5.4.0 (2021-05-07)

Version 5.3.0 (2021-03-15)

  • Improved: Collect BatterySettings event with information about the app's battery optimizations and the device's power save mode status.
  • Improved: Only collect Connectivity event when there's a change in the device's connectivity.
  • Improved: Move keystore file to the no backup folder (API levels 21 and 22).
  • Fixed: Fix sensor data resampling algorithm.
  • Fixed: Fix a rare SecurityException crash when observing connectivity changes on Android 11.
  • Fixed: Fix crash when parsing invalid Location bearing on Nokia phones.
  • Deprecated: Settings.Builder().useBatterySavingMode(boolean) and MotionTag.useBatterySavingMode(boolean) functions have been deprecated and will be removed in version 6.0.0.

Version 5.2.0 (2021-02-11)

  • Changed: The SDK no longer supports API levels 18 and 19. The minimumSdkVersion is now 21.
  • Improved: Make sensor data collection more resilient to runtime crashes.
  • Improved: The internal database was moved to the no backup folder in order to exclude it from automatic backup.
  • Improved: Add WorkManager section to the documentation.
  • Fixed: Fix RemoteServiceException when calling MotionTag.useBatterySavingMode() or MotionTag.useWifiOnlyDataTransfer() in rapid succession.
  • Fixed: Fix crash when parsing invalid Location speed on Nokia phones.

Version 5.1.0 (2020-12-11)

  • Improved: Reduce data transmission by up to 50%
  • Changed: Immediately trigger the creation of user in our backend after starting the SDK
  • Fixed: Fix RemoteServiceException crashes when trying to launch the foreground service

Version 5.0.0 (2020-11-24)

  • Changed: The SDK's foreground notification will now be displayed only when the device is moving, therefore we recommend app developers to use a low priority notification coupled with a low importance channel in order to not disturb the user every time they start moving.
val channel = NotificationChannel("tracking_channel_id", "channel title", NotificationManager.IMPORTANCE_LOW)
// Other configurations
channel.setShowBadge(false)
notificationManager.createNotificationChannel(channel)

val notification = NotificationCompat.Builder(context, "tracking_channel_id")
    .setPriority(NotificationCompat.PRIORITY_LOW)
    // Other configurations
    .build()
notification.flags = Notification.FLAG_ONGOING_EVENT
  • Improved: The SDK size has been reduced from 30 MB to 8 MB.
  • Improved: Tracking restart algorithm has been refactored and improved.

Version 4.2.0 (2020-09-14)

  • Improved: Reduce data transmission by up to 20%.

Version 4.1.0 (2020-09-04)

  • Fixed: Event class Java interoperability issue.
  • Improved: Reduce delay to publish user's last storyline item.
  • Improved: Mode detection accuracy.

Version 4.0.0 (2020-07-24)

  • Added: Support for Android 11. Apps targeting SDK version 30 or later must be granted android.permission.ACCESS_FINE_LOCATION permission before requesting android.permission.ACCESS_BACKGROUND_LOCATION. More information in the official Android documentation. An example implementation can be found in our sample app.
  • Added: MotionTag.getDeniedRequiredPermissions(). This function returns a List<String> with the required runtime permissions that are still denied.
  • Changed:MotionTag.getRequiredPermissions() now returns a List<String> instead of an Array<String>.
  • Changed: de.motiontag.tracker.Reason.Start and de.motiontag.tracker.Reason.Stop were merged to de.motiontag.tracker.Reason.
  • Removed: MotionTag.requestRequiredPermissions(activity, requestCode) public function. Please use ActivityCompat.requestPermissions(activity, permissions, requestCode) to manually request permissions. MotionTag.getRequiredPermissions() can be used to retrieve an array with the required runtime permissions.
  • Removed: MotionTag.checkIn() and MotionTag.checkOut() public functions.
  • Improved: Tracking restart algorithm.

Version 3.0.0 (2020-06-10)

This is a major release and it is not backward compatible with the previous ones.

  • Some packages and classes have been moved and/or renamed as follows:

de.motiontag.tracker.models.Event -> de.motiontag.tracker.Event

de.motiontag.tracker.models.Event.AutoStart -> de.motiontag.tracker.AutoStartEvent

de.motiontag.tracker.models.Event.AutoStop -> de.motiontag.tracker.AutoStopEvent

de.motiontag.tracker.models.Event.Location -> de.motiontag.tracker.LocationEvent

de.motiontag.tracker.models.Event.Transmission -> de.motiontag.tracker.TransmissionEvent

de.motiontag.tracker.models.Reason -> de.motiontag.tracker.Reason

  • Added TransmissionEvent.Success event:

This event informs when a package of events has been successfully sent to the server. The timestamp represents the time of the server confirmation response. The trackedFrom and trackedTo represent the time range of the transmitted events.

  • Added TransmissionEvent.Error event:

This event informs when a package of events failed to be transmitted to the server. The timestamp represents the time of the failure. The errorCode and errorMessage describes the error that occurred.

  • Removed MotionTag.turnLoggingOn(on: Boolean) and Settings.Builder.turnLogginOn(on: Boolean) public functions.

  • Improved mode detection accuracy.

Version 2.4.0 (2020-03-18)

  • Reduce data transmission by up to 60%.

Version 2.3.2 (2020-03-11)

  • Update WorkManager dependency version to 2.3.3.

This version fixes a bug that could prevent sensor data from being transmitted to our server.

Version 2.3.1 (2020-02-13)

  • Remove <uses-feature android:name="android.hardware.sensor.stepdetector" /> feature from AndroidManifest.xml.

Version 2.3.0 (2020-02-12)

IMPORTANT:

  • The SDK now requires android.permission.ACTIVITY_RECOGNITION runtime permission when running on Android 10.

The OS will automatically grant this permission to existing apps. However, this is not the case for new app installs, therefore developers must request this permission before starting the SDK.

A few helper functions were added to help developers with the task of verifying and requesting the correct permissions and location settings:

MotionTag.hasRequiredLocationSettings(): Checks if the device has all the required location settings.

MotionTag.hasRequiredPermissions(): Checks if the app has all the required permissions.

MotionTag.getRequiredPermissions(): Returns an array with all the required permissions.

MotionTag.requestRequiredLocationSettings(Activity activity, int requestCode): Displays a dialog that allows users to enable all the required location settings.

MotionTag.requestRequiredPermissions(Activity activity, int requestCode): Requests the required runtime permissions to the user.

Please check our documentation for more information.

Other changes:

  • Reason.Stop.LOCATION_PERMISSION was renamed to Reason.Stop.PERMISSION
  • Improve mode detection accuracy
  • Restructure internal background jobs

Version 2.2.7 (2020-01-27)

  • Improve tracking restart when the app is killed by Android OS
  • Fix crash in the SDK when Auto Backup feature is enabled in the app
  • Add Auto Backup section to the documentation

Version 2.2.6 (2020-01-16)

  • Fix crash when accessing internal database from multiple threads

Version 2.2.5 (2020-01-15)

  • Speed up SDK initialization process by lazy loading the local database
  • Add an additional exception listener to investigate crashes when first time opening app

Version 2.2.4 (2020-01-07)

  • Add exception listener to investigate crashes when first time opening app

Version 2.2.3 (2019-12-05)

  • Fix a crash when using the SDK together with Firebase Performance Monitoring

Version 2.2.2 (2019-11-12)

  • MotionTag.isTrackingActive() now returns false when tracking is interrupted

Version 2.2.1 (2019-10-03)

  • Reduce battery consumption
  • Schedule periodic jobs with WorkManager
  • Remove library restriction from useWifiOnlyDataTransfer method
  • Hide internal SDK resources

Version 2.2.0 (2019-09-13)

  • Add support for Android 10

IMPORTANT:

Starting from version 2.2.0, the SDK requires compileSdkVersion 29 or higher. Apps targeting API 29 must request both android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_BACKGROUND_LOCATION runtime permissions, otherwise the SDK will not work properly on Android 10.

After requesting the location permissions, Android 10 users will get a dialog with 3 different options to choose from. Users must select "Allow all the time" option, otherwise the SDK won't function properly.

Version 2.1.0 (2019-09-02)

  • Reduce battery consumption
  • Improve tracking restart when the app is killed by Android OS

Version 2.0.0 (2019-08-23)

  • Section 2.3 MotionTag.Callback changed ...

FROM

Returns Method Explanation
void onAutoStart(Reason.Start reason) Informs the application that tracking has been automatically started.
void onAutoStop(Reason.Stop reason) Informs the application that tracking has been automatically stopped.
void onLocation(Location location) Hands the latest captured android.location.Location. to the application.
void onTransmission(long timestamp) Informs when a package of events has been successfully sent to the server. The timestamp parameter represents the time (in milliseconds) of the server confirmation response.

TO

Returns Method Explanation
void onEvent(Event event) Informs the application about a new incoming event.
Event Explanation
AutoStart(Reason.Start reason) Event informs application that tracking has been automatically started.
AutoStop(Reason.Stop reason) Event informs application that tracking has been automatically stopped.
LocationEvent(Location location) Event hands the latest captured android.location.Location. to the application.
Transmission(long timestamp) Event informs when a package of events has been successfully sent to the server. The timestamp parameter represents the time (in milliseconds) of the server confirmation response.
  • Section 3.5 Automatic Start/Stop changed ...

FROM

class CustomClass implements MotionTag.Callback {

    @Override
    public void onAutoStart(Reason.Start reason) {
        switch (reason) {
            case RESTART:
                // do something after the tracking was restarted
                // after rebooting the phone or updating the application.
                break;
            case LOCATION_SERVICE:
                // do something after the tracking was restarted
                // by turning on the location services.
                break;
            case KILLED:
                // do something after the application has been killed and
                // the tracking is restarted.
                break;
        }
    }

    @Override
    public void onAutoStop(Reason.Stop reason) {
        switch (reason) {
            case RESTART:
                // do something after the tracking was stopped
                // because the phone was shut down
                break;
            case LOCATION_SERVICE:
                // do something after the tracking was stopped
                // by turning off the location services.
                break;
            case LOCATION_PERMISSION:
                // do something after the tracking was stopped
                // by revoking the location permissions.
                break;
        }
    }
}

TO

Java

class CustomClass implements MotionTag.Callback {

    @Override
    public void onEvent(Event event) {
        switch (event.getType()) {
            case AUTO_START:
                // do something after the tracking was restarted, e.g.
                onAutoStart(event.getReason());
                break;
            case AUTO_STOP:
                // do something after the tracking was stopped, e.g.
                onAutoStop(event.getReason());
                break;
            case LOCATION:
                // do something after the application provides a location, e.g.
                onLocation(event.getLocation());
                break;
            case TRANSMISSION:
                // do something after the application has successfully transmitted data, e.g.
                onTransmission(event.getTransmittedAt());
                break;
        }
    }

    private void onAutoStart(Reason.Start reason) {
        switch (reason) {
            case RESTART:
                // do something after the tracking was restarted
                // after rebooting the phone or updating the application.
                break;
            case LOCATION_SERVICE:
                // do something after the tracking was restarted
                // by turning on the location services.
                break;
            case KILLED:
                // do something after the application has been killed and
                // the tracking is restarted.
                break;
        }
    }

    private void onAutoStop(Reason.Stop reason) {
        switch (reason) {
            case RESTART:
                // do something after the tracking was stopped
                // because the phone was shut down
                break;
            case LOCATION_SERVICE:
                // do something after the tracking was stopped
                // by turning off the location services.
                break;
            case LOCATION_PERMISSION:
                // do something after the tracking was stopped
                // by revoking the location permissions.
                break;
        }
    }

    private void onLocation(Location location) {
        // Maybe display the location on a map
    }

    private void onTransmission(Long transmittedAt) {
        // Maybe display the time, so the user gets informed that data will be analysed soon
    }
}

Kotlin

class CustomClass : MotionTag.Callback {

    override fun onEvent(event: Event) {
        when (event) {
            is Event.AutoStart -> onAutoStart(event.reason) // do something after the tracking was restarted, e.g.
            is Event.AutoStop -> onAutoStop(event.reason) // do something after the tracking was stopped, e.g.
            is Event.LocationEvent -> onLocation(event.location) // do something after the application provides a location, e.g.
            is Event.Transmission -> onTransmission(event.transmittedAt) // do something after the application has successfully transmitted data, e.g.
        }
    }

    private fun onAutoStart(reason: Reason.Start) {
        when (reason) {
            RESTART -> TODO() // do something after the tracking was restarted after rebooting the phone or updating the application.
            LOCATION_SERVICE -> TODO() // do something after the tracking was restarted by turning on the location services.
            KILLED -> TODO() // do something after the application has been killed and the tracking is restarted.
        }
    }

    private fun onAutoStop(reason: Reason.Stop) {
        when (reason) {
            RESTART -> TODO() // do something after the tracking was stopped because the phone was shut down
            LOCATION_SERVICE -> TODO() // do something after the tracking was stopped by turning off the location services.
            LOCATION_PERMISSION -> TODO() // do something after the tracking was stopped by revoking the location permissions.
        }
    }

    private fun onLocation(location: Location) {
        // Maybe display the location on a map
    }

    private fun onTransmission(transmittedAt: Long) {
        // Maybe display the time, so the user gets informed that data will be analysed soon
    }
}

Version 1.6.1 (2019-05-22)

  • Remove unused bluetooth permission
  • Fix crash when parsing geofence event