Using Android Intents
View Android Intents Reference View the Android intents reference.
View TMM API Sample Code Sample code for TMM-API integrations is available on GitHub, including projects for Android, iOS and .NET MAUI.
- TMM supports several Android intents you can use to configure and control the program.
- An intent may trigger TMM to show user interface, or it may do a configuration action in the background.
- An intent may return information to the calling program, or it may simply perform the requested action without any return.
Example: Client Application Registration
Section titled “Example: Client Application Registration”On Android, TMM uses the REGISTER Intent mechanism to register client applications.
Send the Request
Section titled “Send the Request”intent.putExtra("applicationID", applicationID)startActivityForResult(intent, registerRequestCode)intent.putExtra("applicationID", applicationID);startActivityForResult(intent, registerRequestCode);Parse theResponse
Section titled “Parse theResponse”override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == registerRequestCode) { if (resultCode == RESULT_OK) { // registrationResult: // OK: Your app is registered // Unauthorized: TMM was not able to verify the Application ID // NoNetwork: There is not internet connection
val registrationResult = data?.getStringExtra("registrationResult") val locationPort = data?.getIntExtra("locationPort", -1) val locationV2Port = data?.getIntExtra("locationV2Port", -1) val apiPort = data?.getIntExtra("apiPort", -1) } }}@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == registerRequestCode) { if (resultCode == RESULT_OK) { // registrationResult: // OK: Your app is registered // Unauthorized: TMM was not able to verify the Application ID // NoNetwork: There is not internet connection
String result = data.getStringExtra("registrationResult");
// localhost port for WebSocket Locations, Version 1 int PositionsPort = data.getIntExtra("locationPort", -1); // localhost port for WebSocket Locations, Version 2 int PositionsV2Port = data.getIntExtra("locationV2Port", -1);
// The REST API is at $"WS://localhost:{apiPort}" int apiPort = data.getIntExtra("apiPort", -1); } }}