From ba45346fba85c02d373a1b6b69f50d2dc62daecb Mon Sep 17 00:00:00 2001 From: Mariya Date: Tue, 2 Jan 2024 17:09:22 +0530 Subject: [PATCH 1/7] Implement - In app update after getting the new update link from check update response --- app/build.gradle | 10 ++- app/src/main/AndroidManifest.xml | 25 +++++- .../dashboard/DashboardActivity.kt | 80 +++++++++++++++++-- app/src/main/res/xml/file_paths.xml | 3 + 4 files changed, 108 insertions(+), 10 deletions(-) create mode 100644 app/src/main/res/xml/file_paths.xml diff --git a/app/build.gradle b/app/build.gradle index 005cf3d..06a8859 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,11 +16,11 @@ android { // prod - production, preprod - preproduction, quality - qc defaultConfig { - applicationId "in.sminnovations.hpostesting" + applicationId "in.sminnovations.hpostesting.preprod" minSdk 21 targetSdk 34 - versionCode 56 - versionName "2.1.56" + versionCode 26 + versionName "2.1.26" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -83,7 +83,7 @@ dependencies { implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'com.google.android.play:core:1.10.3' - + implementation 'io.nats:jnats:2.11.2' @@ -138,4 +138,6 @@ dependencies { implementation "androidx.preference:preference-ktx:1.2.1" implementation 'io.nats:jnats:2.11.2' + implementation 'com.google.android.play:core:1.10.3' + } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 61c85a5..c5913bd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,6 +5,8 @@ + + @@ -62,7 +64,17 @@ android:exported="false" android:label="@string/title_activity_dashboard" android:theme="@style/Theme.HPOS.NoActionBar" - tools:ignore="MissingClass" /> + tools:ignore="AppLinkUrlError,MissingClass"> + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index 584138a..88ee490 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -1,10 +1,20 @@ package com.example.hpostesting.presentation.dashboard +import android.app.DownloadManager +import android.content.BroadcastReceiver import android.content.Context +import android.content.Intent +import android.content.Intent.ACTION_INSTALL_PACKAGE +import android.content.IntentFilter +import android.content.pm.PackageManager +import android.content.pm.ResolveInfo +import android.net.Uri import android.os.Bundle +import android.util.Log import android.view.Menu import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.FileProvider import androidx.drawerlayout.widget.DrawerLayout import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration @@ -13,22 +23,21 @@ import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController import com.example.hpostesting.data.constant.LanguageManager import com.google.android.material.navigation.NavigationView -import com.google.android.play.core.appupdate.AppUpdateManager -import com.google.android.play.core.appupdate.AppUpdateManagerFactory + import com.google.firebase.appdistribution.FirebaseAppDistribution import com.google.firebase.appdistribution.FirebaseAppDistributionException import com.google.firebase.crashlytics.FirebaseCrashlytics import dagger.hilt.android.AndroidEntryPoint import `in`.sminnovations.hpostesting.R import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding +import java.io.File @AndroidEntryPoint class DashboardActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var binding: ActivityDashboardBinding - val appUpdateManager: AppUpdateManager = AppUpdateManagerFactory.create(applicationContext) - val appUpdateInfoTask = appUpdateManager.appUpdateInfo + private var downloadId: Long = 0 override fun attachBaseContext(newBase: Context?) { val languageCode = LanguageManager.getSavedLanguage(newBase!!) LanguageManager.setLocale(newBase, languageCode) @@ -41,7 +50,7 @@ class DashboardActivity : AppCompatActivity() { binding = ActivityDashboardBinding.inflate(layoutInflater) setContentView(binding.root) setSupportActionBar(binding.appBarDashboard.toolbar) - + initiateUpdate() val drawerLayout: DrawerLayout = binding.drawerLayout val navView: NavigationView = binding.navView val navController = findNavController(R.id.nav_host_fragment_content_dashboard) @@ -67,6 +76,64 @@ class DashboardActivity : AppCompatActivity() { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } + private fun initiateUpdate() { + val apkUrl = "https://www.dropbox.com/scl/fi/v0hux8qrby54rjns8mhum/hpos-testing_preprod_2.1.27.apk?rlkey=ias0fe0zq72avy01rk4cvzmvp&dl=1" + + val request = DownloadManager.Request(Uri.parse(apkUrl)) + request.setTitle("App Update") + request.setDescription("Downloading update...") + request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) + request.setDestinationInExternalFilesDir(this, "Updates", "update.apk") + + val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager + downloadId = downloadManager.enqueue(request) + + // Register a BroadcastReceiver to receive the download complete event + val filter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE) + registerReceiver(downloadReceiver, filter) + } + + private val downloadReceiver = object : BroadcastReceiver() { + override fun onReceive(context: Context?, intent: Intent?) { + val id = intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) + if (id == downloadId) { + // Install the downloaded APK + installApk() + } + } + } + + private fun installApk() { + val file = File(getExternalFilesDir("Updates"), "update.apk") + file.setReadable(true, false) // Ensure the file is readable + + val uri: Uri = FileProvider.getUriForFile( + this, + "in.sminnovations.hpostesting.preprod.fileprovider", + file + ) + + // Create an intent to install the APK + val installIntent = Intent(Intent.ACTION_INSTALL_PACKAGE) + installIntent.data = uri + installIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or + Intent.FLAG_ACTIVITY_NEW_TASK or + Intent.FLAG_ACTIVITY_CLEAR_TOP + installIntent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true) + + // Start the installation + startActivity(installIntent) + + Log.d("InstallApk", "Install Intent URI: $uri") + Log.d("InstallApk", "Package Name: $packageName") + } + + override fun onDestroy() { + super.onDestroy() + unregisterReceiver(downloadReceiver) + } + + override fun onResume() { super.onResume() @@ -106,4 +173,7 @@ class DashboardActivity : AppCompatActivity() { // Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show() } } + + + } \ No newline at end of file diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..6e9c380 --- /dev/null +++ b/app/src/main/res/xml/file_paths.xml @@ -0,0 +1,3 @@ + + + From dfbcb4af6a7b7afd6ea90a2fe6c2ab28e46b3dae Mon Sep 17 00:00:00 2001 From: Mariya Date: Wed, 3 Jan 2024 12:52:28 +0530 Subject: [PATCH 2/7] error resolved --- .../hpostesting/presentation/dashboard/DashboardActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index 88ee490..ff3ef97 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -28,8 +28,8 @@ import com.google.firebase.appdistribution.FirebaseAppDistribution import com.google.firebase.appdistribution.FirebaseAppDistributionException import com.google.firebase.crashlytics.FirebaseCrashlytics import dagger.hilt.android.AndroidEntryPoint -import `in`.sminnovations.hpostesting.R -import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding +import `in`.sminnovations.hpostesting.preprod.R +import `in`.sminnovations.hpostesting.preprod.databinding.ActivityDashboardBinding import java.io.File @AndroidEntryPoint From b0d348cf6d66dc878a05086aafd6f7b896098618 Mon Sep 17 00:00:00 2001 From: Mariya Date: Wed, 3 Jan 2024 14:49:41 +0530 Subject: [PATCH 3/7] Implement - In app update after getting the new update link from check update response --- .../dashboard/DashboardActivity.kt | 51 +++++++++++++++---- .../presentation/dashboard/HomeFragment.kt | 9 ++++ .../hemocube/HemoCubeViewModel.kt | 2 +- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index ff3ef97..a8cf290 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -4,10 +4,7 @@ import android.app.DownloadManager import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.content.Intent.ACTION_INSTALL_PACKAGE import android.content.IntentFilter -import android.content.pm.PackageManager -import android.content.pm.ResolveInfo import android.net.Uri import android.os.Bundle import android.util.Log @@ -16,21 +13,27 @@ import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.core.content.FileProvider import androidx.drawerlayout.widget.DrawerLayout +import androidx.lifecycle.Observer import androidx.navigation.findNavController import androidx.navigation.ui.AppBarConfiguration import androidx.navigation.ui.navigateUp import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController +import com.example.hpostesting.data.Result import com.example.hpostesting.data.constant.LanguageManager +import com.example.hpostesting.presentation.hemocube.HemoCubeViewModel import com.google.android.material.navigation.NavigationView import com.google.firebase.appdistribution.FirebaseAppDistribution import com.google.firebase.appdistribution.FirebaseAppDistributionException import com.google.firebase.crashlytics.FirebaseCrashlytics import dagger.hilt.android.AndroidEntryPoint -import `in`.sminnovations.hpostesting.preprod.R -import `in`.sminnovations.hpostesting.preprod.databinding.ActivityDashboardBinding +import `in`.sminnovations.hpostesting.R +import `in`.sminnovations.hpostesting.databinding.ActivityDashboardBinding +import okhttp3.ResponseBody + import java.io.File +import javax.inject.Inject @AndroidEntryPoint class DashboardActivity : AppCompatActivity() { @@ -38,6 +41,8 @@ class DashboardActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var binding: ActivityDashboardBinding private var downloadId: Long = 0 + @Inject + lateinit var hemocubeViewModel: HemoCubeViewModel override fun attachBaseContext(newBase: Context?) { val languageCode = LanguageManager.getSavedLanguage(newBase!!) LanguageManager.setLocale(newBase, languageCode) @@ -50,7 +55,33 @@ class DashboardActivity : AppCompatActivity() { binding = ActivityDashboardBinding.inflate(layoutInflater) setContentView(binding.root) setSupportActionBar(binding.appBarDashboard.toolbar) - initiateUpdate() + + hemocubeViewModel.deviceUpdate.observe(this) { result -> + when (result) { + is Result.Success -> { + // Handle success + val apkUrl = result.data + initiateUpdate(apkUrl) + // The APK URL LiveData will be updated automatically + } + + is Result.Error -> { + // Handle error + val error = result.exception + // Handle error... + } + + is Result.Loading -> { + // Handle loading state + } + + else -> { + + } + } + } + + val drawerLayout: DrawerLayout = binding.drawerLayout val navView: NavigationView = binding.navView val navController = findNavController(R.id.nav_host_fragment_content_dashboard) @@ -63,6 +94,8 @@ class DashboardActivity : AppCompatActivity() { setupActionBarWithNavController(navController, appBarConfiguration) navView.setupWithNavController(navController) + + } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -76,10 +109,8 @@ class DashboardActivity : AppCompatActivity() { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } - private fun initiateUpdate() { - val apkUrl = "https://www.dropbox.com/scl/fi/v0hux8qrby54rjns8mhum/hpos-testing_preprod_2.1.27.apk?rlkey=ias0fe0zq72avy01rk4cvzmvp&dl=1" - - val request = DownloadManager.Request(Uri.parse(apkUrl)) + private fun initiateUpdate(apkUrl: ResponseBody) { + val request = DownloadManager.Request(Uri.parse(apkUrl.toString())) request.setTitle("App Update") request.setDescription("Downloading update...") request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt index 788e69f..ad16acc 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/HomeFragment.kt @@ -24,6 +24,7 @@ import com.example.hpostesting.data.model.login.LoginResponse import com.example.hpostesting.data.model.patient.HemoCubeTestData import com.example.hpostesting.data.model.patient.UserData import com.example.hpostesting.data.model.updates.CheckUpdateRequest +import com.example.hpostesting.data.model.updates.DeviceUpdateRequest import com.example.hpostesting.presentation.KitScanActivity import com.example.hpostesting.presentation.adapter.OfflineUserListAdapter import com.example.hpostesting.presentation.adapter.UserListAdapter @@ -150,6 +151,7 @@ class HomeFragment : Fragment() { } else { hemoCubeViewModel.checkUpdate(createCheckUpdateRequestData()) hemoCubeViewModel.uploadLogs() + hemoCubeViewModel.deviceUpdate(createDeviceRequestData()) } } hemoCubeViewModel.loginResponse.observe(viewLifecycleOwner) { response -> @@ -260,6 +262,13 @@ class HomeFragment : Fragment() { ) } + private fun createDeviceRequestData(): DeviceUpdateRequest { + return DeviceUpdateRequest( + serial_no = Constants.serialNumber + + ) + } + private fun setUserId() { binding.btnSubmit.setOnClickListener { val userId = binding.userId.text.toString() diff --git a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt index 5b3043a..706b4c5 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/hemocube/HemoCubeViewModel.kt @@ -156,7 +156,7 @@ class HemoCubeViewModel @Inject constructor( val logFile = logFileManager.createLogFile().let { file -> val requestBody = file?.asRequestBody("multipart/form-data".toMediaTypeOrNull()) val multipartFile = - requestBody?.let { MultipartBody.Part.createFormData("logFile", file.name, it) } + requestBody?.let { MultipartBody.Part.createFormData("logFile", file?.name, it) } multipartFile?.let { partFile -> databaseRepository.uploadLogs(partFile).let { result -> uploadLogs.postValue(result) From 18ed6c4e11274714fe32557444789911ec0266f4 Mon Sep 17 00:00:00 2001 From: Mariya Date: Thu, 4 Jan 2024 12:10:20 +0530 Subject: [PATCH 4/7] App update using api added --- app/src/main/AndroidManifest.xml | 2 +- .../dashboard/DashboardActivity.kt | 48 +++++++++++++++---- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c5913bd..f2029eb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -129,7 +129,7 @@ { - // Handle error - val error = result.exception - // Handle error... + result.exception.let { message -> + Toast.makeText(this, "An error occurred: $message", Toast.LENGTH_LONG) + .show() + + } + } is Result.Loading -> { - // Handle loading state + } else -> { @@ -109,8 +119,17 @@ class DashboardActivity : AppCompatActivity() { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } - private fun initiateUpdate(apkUrl: ResponseBody) { - val request = DownloadManager.Request(Uri.parse(apkUrl.toString())) + private fun initiateUpdate(responseBody: ResponseBody) { + // Extract the URL from the ResponseBody + val apkUrl = extractApkUrl(responseBody) + + // Check if the extracted APK URL is valid + if (!isValidHttpUrl(apkUrl)) { + // Handle the case where the URL is not valid + return + } + + val request = DownloadManager.Request(Uri.parse(apkUrl)) request.setTitle("App Update") request.setDescription("Downloading update...") request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) @@ -124,6 +143,17 @@ class DashboardActivity : AppCompatActivity() { registerReceiver(downloadReceiver, filter) } + // Function to check if a URL has a valid HTTP/HTTPS scheme + // Function to extract the APK URL from the ResponseBody + private fun extractApkUrl(responseBody: ResponseBody): String { + // Assuming your ResponseBody contains the APK URL as a string + return responseBody.string() + } + + // Function to check if a URL has a valid HTTP/HTTPS scheme + private fun isValidHttpUrl(url: String): Boolean { + return url.startsWith("http://") || url.startsWith("https://") + } private val downloadReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { val id = intent?.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) @@ -140,7 +170,7 @@ class DashboardActivity : AppCompatActivity() { val uri: Uri = FileProvider.getUriForFile( this, - "in.sminnovations.hpostesting.preprod.fileprovider", + "com.example.hpostesting.preprod.fileprovider", file ) From 46d2c2f57ba9e3abd0fa02e9df782106068c4610 Mon Sep 17 00:00:00 2001 From: Mariya Date: Thu, 4 Jan 2024 13:00:47 +0530 Subject: [PATCH 5/7] App update Issue fixed, its updated successfully within one app itself --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 2 +- .../presentation/dashboard/DashboardActivity.kt | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b3deb1f..8360008 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,7 @@ android { // prod - production, preprod - preproduction, quality - qc defaultConfig { - applicationId "in.sminnovations.hpostesting.preprod" + applicationId "in.sminnovations.hpostesting.quality" minSdk 21 targetSdk 34 versionCode 26 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f2029eb..0c89ba1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -129,7 +129,7 @@ { // Handle success - val apkUrl = result.data +// val apkUrl = result.data + val apkUrl = "https://dl.dropboxusercontent.com/s/fi/1c3nn7t0co431hicl3hrt/app-debug.apk?rlkey=e4uf13ty1dpcked614vy1aaqp&dl=0" initiateUpdate(apkUrl) Log.d("ApI", "APK URL: $apkUrl") Toast.makeText( @@ -119,9 +118,9 @@ class DashboardActivity : AppCompatActivity() { return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() } - private fun initiateUpdate(responseBody: ResponseBody) { + private fun initiateUpdate(responseBody: String) { // Extract the URL from the ResponseBody - val apkUrl = extractApkUrl(responseBody) + val apkUrl = responseBody // Check if the extracted APK URL is valid if (!isValidHttpUrl(apkUrl)) { @@ -170,7 +169,7 @@ class DashboardActivity : AppCompatActivity() { val uri: Uri = FileProvider.getUriForFile( this, - "com.example.hpostesting.preprod.fileprovider", + "com.example.hpostesting.quality.fileprovider", file ) From 7ba0124f1a0e420b0324afda6dcf3263947dc59e Mon Sep 17 00:00:00 2001 From: Mariya Date: Fri, 5 Jan 2024 18:24:36 +0530 Subject: [PATCH 6/7] Issue fixed related to Toast --- app/build.gradle | 2 +- app/src/main/AndroidManifest.xml | 2 +- .../presentation/adapter/OfflineUserListAdapter.kt | 13 +++++++------ .../presentation/dashboard/DashboardActivity.kt | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8360008..2eceb9e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,7 @@ android { // prod - production, preprod - preproduction, quality - qc defaultConfig { - applicationId "in.sminnovations.hpostesting.quality" + applicationId "in.sminnovations.hpostesting" minSdk 21 targetSdk 34 versionCode 26 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0c89ba1..21972fc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -129,7 +129,7 @@ Constants.INCUBATION_TIME_MAX) { + } else + if (isBetween15And30Minutes(userList.incubationTime) > Constants.INCUBATION_TIME_MAX) { Toast.makeText( view.context, - context?.getString(R.string.incubation_crossed_30_minutes), + view.context.getString(R.string.incubation_crossed_30_minutes), Toast.LENGTH_SHORT ).show() } else { @@ -102,7 +103,7 @@ class OfflineUserListAdapter(private val view: View, private val batLevel: Int) } else { Toast.makeText( view.context, - context?.getString(R.string.incubation_not_started), + view.context.getString(R.string.incubation_not_started), Toast.LENGTH_SHORT ).show() } diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index 98a8f63..d59ce6f 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -169,7 +169,7 @@ class DashboardActivity : AppCompatActivity() { val uri: Uri = FileProvider.getUriForFile( this, - "com.example.hpostesting.quality.fileprovider", + "com.example.hpostesting.fileprovider", file ) From 47888172fd8af69c14778980a61d23354e82ca4e Mon Sep 17 00:00:00 2001 From: Mariya Date: Tue, 9 Jan 2024 13:45:00 +0530 Subject: [PATCH 7/7] Added Branch for Api call version --- .../presentation/dashboard/DashboardActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt index d59ce6f..972ec55 100644 --- a/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt +++ b/app/src/main/java/com/example/hpostesting/presentation/dashboard/DashboardActivity.kt @@ -59,9 +59,9 @@ class DashboardActivity : AppCompatActivity() { when (result) { is Result.Success -> { // Handle success -// val apkUrl = result.data - val apkUrl = "https://dl.dropboxusercontent.com/s/fi/1c3nn7t0co431hicl3hrt/app-debug.apk?rlkey=e4uf13ty1dpcked614vy1aaqp&dl=0" - initiateUpdate(apkUrl) + val apkUrl = result.data +// val apkUrl = "https://dl.dropboxusercontent.com/s/fi/1c3nn7t0co431hicl3hrt/app-debug.apk?rlkey=e4uf13ty1dpcked614vy1aaqp&dl=0" + initiateUpdate(apkUrl.toString()) Log.d("ApI", "APK URL: $apkUrl") Toast.makeText( this, @@ -73,7 +73,7 @@ class DashboardActivity : AppCompatActivity() { is Result.Error -> { result.exception.let { message -> - Toast.makeText(this, "An error occurred: $message", Toast.LENGTH_LONG) + Toast.makeText(this, "An error occurred On Updating App: $message", Toast.LENGTH_LONG) .show() }