Migrate from Android 3.7.1.4 to Android 3.8.0
Simple integration
- Make sure you're using the ARR format. If you aren't, switch to that before going forward. See Migrating a project from jar to aar in android.
- Replace the 3.7.1.4 library ARR files with the 3.8.0 AAR files.
a. Drag and drop the new release of the bin/acoustic-mobile-push-android-sdk .aar in the app/libs folder in the Project Files view and any of the stock plug-ins you use from plugins/acoustic-mobile-push-android .aar.
b. Then, delete ibm-mobile-push*.aar files from your libs directory.
c. Invalidate caches and restart. - Globally replace (select the app and Edit->Find->Replace in Path...) all code references and config file references that are currently com.ibm.mce.sdk with co.acoustic.mobile.push.sdk. This includes:
- Package imports
- API you call
- Classes you inherit from
- References in MceConfig.json and AndroidManifest.xml.
- Make sure you have upgraded to Android Studio 3.5.2 or higher.
- This version of the SDK now supports (and requires) AndroidX. In your app's build.gradle, set
compileSdk
to at least 29, andbuildToolsVersion
to at least 29.0.2. - In your project's build.gradle, set the
com.android.tools.build:gradle
dependency to at least classpath 'com.android.tools.build:gradle:3.5.0'. - Select your app and choose Refactor -> Migrate to AndroidX. Save the backup and click Do Refactor.
- If you implement it in your notifier class, rename
onDeliveryChannelRegistered
toonMessagingServiceRegistered
. - Update the AndroidManifest.xml for new package names. Change the name of the FcmMessagingService to co.acoustic.mobile.push.sdk.messaging.fcm.FcmMessagingService (add "messaging"). Delete the service FcmInstanceIdService, which is no longer required.
- Update your MceConfig.json file with any desired new options. New options include:
- "messagingService":"custom" intended for when someone else (not the Acoustic Mobile Push SDK) registers with FCM,
- "inboxControl":"" See Inbox section for more details.
- "location": { "request": { a number of options are added, and you will need to delete "providerPreferences". See the Location section for more details.
- The SDK shipped with an issue when upgrading queues. Implement the code in Error messages when upgrading to android adk 3.8.0 before shipping an upgrade. New releases do not need to follow this step.
- The SDK as shipped emits an error message as documented in Error messages when upgrading to android adk 3.8.0. This is cosmetic and can be ignored safely.
- If your code refers to:
DeliveryChannel.setDeliveryChannel(getApplicationContext(), MceSdkConfiguration.MessagingService.fcm);
that API is no longer present and may be deleted.
Inbox messages support
No changes other than the package name are required. Note that some new API has been added to allow you to have more flexibility with what's in the inbox. See Android: Inbox control API additions for Android for more details.
In-app messages
No changes other than the package name are required.
Geofences/beacons support
- Remove
providerPreferences
from your MceConfig.json file. Replace it with"request": {. Under "request"
are the following options:
"The request key is used to configure the sdk location request properties": "",
"request" : {
"interval between location updates in seconds": "minimum is 1",
"interval": 5,
"fastest interval between location updates in seconds": "minimum is 1",
"fastestInterval": 1,
"The smallest displacement in meters to generate a location request": "overrides the interval values",
"smallestDisplacement": 100,
"The priority of the location request": "can be either highAccuracy, balanced, lowPower or noPower",
"priority": "highAccuracy"
},
- interval is the maximum time in seconds between location updates. Setting this to a lower value will ask the OS to send more frequent updates when the app is in the foreground, at the expense of higher battery usage when the app is in the foreground.
-
fastestInterval is the minimum amount of time in seconds between two location updates.
-
smallestDisplacement overrides the "interval" and "fastestInterval" values. This tells the SDK to update its list of nearby interesting points based on how far the device has moved (in meters) since the last update. If smallestDisplacement is 100, the list of interesting points will be updated when the device has moved at least 100 meters from the previous location. This saves power if the device doesn't move for a while, and is the recommended way to trigger location updates.
If your providerPreferences value was: | Use this for priority: |
---|---|
"providerPreferences" : ["gps", "network"] | "priority":"highAccuracy" |
"providerPreferences" : ["network", "gps"] | "priority":"highAccuracy" |
"providerPreferences" : ["gps"] | "priority":"highAccuracy" |
"providerPreferences" : ["network"] | "priority":"lowPower" |
"providerPreferences" :[] | "priority":"noPower" |
- Update AndroidManifest.xml for location.
-
Add to AndroidManifest.xml if it's not already there.
-
A global search and replace of com.ibm.mce.sdk with co.acoustic.mobile.push.sdk should have already renamed most of the location services.
-
Delete the service GeofenceIntentService and the receiver LocationUpdateCaller.
-
Add two new receivers:
and
5. If you are using attributes:
No additional changes other than package name are required.
6. If you are using events:
No additional changes other than package name are required.
Updated 9 months ago