Advanced Topics
Table of Contents
- Show Tracking Available
- SDK Presentation Callbacks
- Logs
- Localization
- Staging environment
- API Reference
- Proguard / R8
- Getting notified about updates
- FAQ
1. Show Tracking Available
When an ondemand ride is booked, tracking becomes available. This shows the current state of the ride and position of the driver on a map. After completing the booking process, user will be redirected to this screen by default.
However, it may happen the user dismisses the SDK or close the app and open it again. In such case, you can check the current state through Mozio.trackingState
and be notified about changes through the Mozio.trackingListener
. For example, our Demo app uses these to show a “Tracking Available” label as shown below:
If the app detects a current ride is available, It is recommended that you add some UI indication like a badge or button to inform the user about this.
Also, you may want to offer the possibility of showing the Tracking screen for such ride. To do so, all you need to do is execute the following line from any Activity you want the feature to be displayed on.
In our Demo app, tapping the Tracking Available
label will present the Tracking screen.
Note: If there is no ride available, the command above will have no effect.
2. SDK Presentation Callbacks
You can get notified when the Mozio SDK is presented or dismissed from the screen:
// 1. Implement the `MozioPresentationListener` interface:
public class MainActivity extends AppCompatActivity {
//Other stuff...
@Override
public void onMozioPresented() {
// Do whatever you need when the Mozio SDK is presented...
Log.d("Mozio", "Mozio SDK UI presented");
}
@Override
public void onMozioDismissed() {
// Do whatever you need when the Mozio SDK is dismissed...
Log.d("Mozio", "Mozio SDK UI dismissed");
}
// 2. Pass the implementing instance to the `Mozio` class:
@Override
protected void onCreate(Bundle savedInstanceState) {
//Other stuff...
Mozio.getInstance().setPresentationListener(this);
}
//Other stuff...
}
Passed data through this method will be available in the reports sent each month via email.
3. Logs
3.1 Logging
There are three levels of logging, default, verbose, and disabled.
While debugging your app, you can keep the logging level at default or set it to verbose by doing the following:
While not debugging your app, you can set the logging level to disabled so that no logs are sent to the device’s console. We do not log any sensitive information, but this will prevent anything from being logged at all:
3.2 Usage logs opt out
The Mozio SDK occasionally sends usage logs to Mozio, you can opt out of this feature by doing:
This is not recommended. Opting out will make it hard for us to debug any issues your implementation may be facing. Mozio never sends any user identifiable data or sensitive information as part of the logs.
4. Localization
The Mozio SDK is supported in multiple languages.
If the device’s Locale isn’t supported by Mozio, the SDK will be displayed in English.
4.1 Supported languages
Language | Code |
---|---|
English | en |
Spanish | es |
4.2 How to localize the SDK with a different Locale than the device’s?
To allow the user to set the app language, you may want to force the SDK to be displayed in a Locale different than the device’s. You can provide multiple preferred locales using the list structure, with the first one having the highest priority. To do so, all you need to do is add the following code:
Keep in mind that the Locale set must correspond to a language that the SDK supports. Otherwise, the setting will be ignored and the SDK will be displayed in the language dictated by the device’s Locale or English if it’s not supported.
5. Staging environment
If you’re interested in booking test rides that do not involve a real driver or payments, you can do so with our Staging environment. The installation of staging artifact described in section 2.2 of the main guide.
Few notes:
- Keep in mind that your
Mozio API-KEY
for one environment does not work for others. So if you only got aproduction
key you should reach us to get astaging
key as well. - We recommend that each environment is linked to different versions of the app, that is different sandbox or App IDs for each.
When using our Staging environment every search you do will throw a bunch of test results. You are interested in two specific results:
- Use the
Smarty OAuth (AUT)
result to test rides that do not require payment (what we call “OAuth” rides like Lyft where you pay with your Lyft account). - Use the
Smarty Credit Card (AUT)
result to test rides that do require credit card input.
Booking these will take you through all the ride states (driver coming, driver arrived, in trip, completed) automatically.
If you are interested in Tracking (seeing the car on the map), you need to do a specific search:
- From:
44 Tehama Street, San Francisco, CA, USA
- To:
Moscone Center, Howard Street, San Francisco, CA, USA
6. API Reference
7. Proguard / R8
If your project uses Proguard or R8 minification, please add these rules to your proguard-rules.pro
file:
##--------------- Begin: Mozio ---------------
# Keep API request/response classes:
-keep class com.mozio.moziosdk.api.request.** { *; }
-keep class com.mozio.moziosdk.api.response.** { *; }
# Keep common models:
-keep class com.mozio.moziosdk.model.** { *; }
##--------------- End: Mozio ---------------
8. Getting notified about updates
We recommend that you subscribe to our Releases page to be notified about the latest versions of the Mozio SDK.