diff --git a/fivegmag_5GMSdAwareApplication/.idea/compiler.xml b/fivegmag_5GMSdAwareApplication/.idea/compiler.xml index fb7f4a8a..b589d56e 100644 --- a/fivegmag_5GMSdAwareApplication/.idea/compiler.xml +++ b/fivegmag_5GMSdAwareApplication/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/fivegmag_5GMSdAwareApplication/.idea/misc.xml b/fivegmag_5GMSdAwareApplication/.idea/misc.xml index bdd92780..9f71c83d 100644 --- a/fivegmag_5GMSdAwareApplication/.idea/misc.xml +++ b/fivegmag_5GMSdAwareApplication/.idea/misc.xml @@ -1,7 +1,7 @@ - + diff --git a/fivegmag_5GMSdAwareApplication/app/build.gradle b/fivegmag_5GMSdAwareApplication/app/build.gradle index 6328bd71..e41bd909 100644 --- a/fivegmag_5GMSdAwareApplication/app/build.gradle +++ b/fivegmag_5GMSdAwareApplication/app/build.gradle @@ -51,4 +51,17 @@ dependencies { def retrofit_version = "2.9.0" implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" +} + +task CaptureLibraryVersion { + def libDef = project.configurations.getByName('implementation').allDependencies.matching { + it.group.equals("com.fivegmag") + } + if (libDef.size() > 0) { + android.buildTypes.each { + libDef.forEach { item -> + it.buildConfigField 'String', "LIB_VERSION_" + item.name, "\"${item.version}\"" + } + } + } } \ No newline at end of file diff --git a/fivegmag_5GMSdAwareApplication/app/src/main/assets/config.properties.xml b/fivegmag_5GMSdAwareApplication/app/src/main/assets/config.properties.xml index 3e17ff9d..d5cae691 100644 --- a/fivegmag_5GMSdAwareApplication/app/src/main/assets/config.properties.xml +++ b/fivegmag_5GMSdAwareApplication/app/src/main/assets/config.properties.xml @@ -5,6 +5,6 @@ https://rt.5g-mag.com/ - http://192.168.178.78:3003/m8/ + http://192.168.2.1:3003/m8/ \ No newline at end of file diff --git a/fivegmag_5GMSdAwareApplication/app/src/main/java/com/fivegmag/a5gmsdawareapplication/MainActivity.kt b/fivegmag_5GMSdAwareApplication/app/src/main/java/com/fivegmag/a5gmsdawareapplication/MainActivity.kt index 58010a6a..aeb08369 100644 --- a/fivegmag_5GMSdAwareApplication/app/src/main/java/com/fivegmag/a5gmsdawareapplication/MainActivity.kt +++ b/fivegmag_5GMSdAwareApplication/app/src/main/java/com/fivegmag/a5gmsdawareapplication/MainActivity.kt @@ -9,7 +9,9 @@ https://drive.google.com/file/d/1cinCiA778IErENZ3JN52VFW-1ffHpx7Z/view package com.fivegmag.a5gmsdawareapplication +import android.content.pm.PackageManager import android.os.Bundle +import android.util.Log import android.view.View import android.widget.AdapterView import android.widget.ArrayAdapter @@ -38,7 +40,7 @@ import java.net.URI import java.util.* -const val TAG = "5GMS Aware Application" +const val TAG_AWARE_APPLICATION = "5GMS Aware Application" @UnstableApi class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { @@ -61,6 +63,8 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { loadConfiguration() populateM8SelectionSpinner() exoPlayerView = findViewById(R.id.idExoPlayerVIew) + setApplicationVersionNumber() + printDependenciesVersionNumbers() registerButtonListener() mediaSessionHandlerAdapter.initialize( this, @@ -75,7 +79,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { } override fun onStop() { - EventBus.getDefault().unregister(mediaStreamHandlerEventHandler); + EventBus.getDefault().unregister(mediaStreamHandlerEventHandler) super.onStop() // Unbind from the service mediaSessionHandlerAdapter.reset(this) @@ -83,7 +87,24 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { override fun onStart() { super.onStart() - EventBus.getDefault().register(mediaStreamHandlerEventHandler); + EventBus.getDefault().register(mediaStreamHandlerEventHandler) + } + + private fun setApplicationVersionNumber() { + try { + val packageInfo = packageManager.getPackageInfo(packageName, 0) + val versionName = packageInfo.versionName + val versionTextView = findViewById(R.id.versionNumber) + val versionText = getString(R.string.versionTextField, versionName) + versionTextView.text = versionText + } catch (e: PackageManager.NameNotFoundException) { + e.printStackTrace() + } + } + + private fun printDependenciesVersionNumbers() { + Log.d(TAG_AWARE_APPLICATION, "5GMS Common Library Version: ${BuildConfig.LIB_VERSION_a5gmscommonlibrary}") + Log.d(TAG_AWARE_APPLICATION, "5GMS Media Stream Handler Version: ${BuildConfig.LIB_VERSION_a5gmsmediastreamhandler}") } private fun loadConfiguration() { @@ -171,7 +192,7 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { } private fun replaceDoubleTicks(value: String): String { - return value.replace("\"", ""); + return value.replace("\"", "") } override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { @@ -248,9 +269,9 @@ class MainActivity : AppCompatActivity(), AdapterView.OnItemSelectedListener { for (serviceListEntry in jsonServiceList) { val itemAsJsonObject = Json.parseToJsonElement(serviceListEntry.toString()).jsonObject - var name: String = + val name: String = replaceDoubleTicks(itemAsJsonObject["name"].toString()) - var provisioningSessionId = + val provisioningSessionId = replaceDoubleTicks(itemAsJsonObject["provisioningSessionId"].toString()) val entryPoints = ArrayList() diff --git a/fivegmag_5GMSdAwareApplication/app/src/main/res/layout-land/activity_main.xml b/fivegmag_5GMSdAwareApplication/app/src/main/res/layout-land/activity_main.xml index d4b059c9..e3d601a4 100644 --- a/fivegmag_5GMSdAwareApplication/app/src/main/res/layout-land/activity_main.xml +++ b/fivegmag_5GMSdAwareApplication/app/src/main/res/layout-land/activity_main.xml @@ -94,5 +94,15 @@ app:layout_constraintStart_toStartOf="@+id/idExoPlayerVIew" app:layout_constraintTop_toTopOf="@+id/idExoPlayerVIew" /> + + \ No newline at end of file diff --git a/fivegmag_5GMSdAwareApplication/app/src/main/res/layout/activity_main.xml b/fivegmag_5GMSdAwareApplication/app/src/main/res/layout/activity_main.xml index 0424e65b..cc9087f7 100644 --- a/fivegmag_5GMSdAwareApplication/app/src/main/res/layout/activity_main.xml +++ b/fivegmag_5GMSdAwareApplication/app/src/main/res/layout/activity_main.xml @@ -95,5 +95,15 @@ app:layout_constraintStart_toStartOf="@+id/idExoPlayerVIew" app:layout_constraintTop_toTopOf="@+id/idExoPlayerVIew" /> + + \ No newline at end of file diff --git a/fivegmag_5GMSdAwareApplication/app/src/main/res/values/strings.xml b/fivegmag_5GMSdAwareApplication/app/src/main/res/values/strings.xml index d938136b..c840c777 100644 --- a/fivegmag_5GMSdAwareApplication/app/src/main/res/values/strings.xml +++ b/fivegmag_5GMSdAwareApplication/app/src/main/res/values/strings.xml @@ -5,4 +5,5 @@ Select a Stream Start Playback %1$s kbit/s - Rep ID: %2$s + Version: %s \ No newline at end of file