• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android Studio Constraint Layout Error

I am getting such an error while compiling the application.
When I make a LinearLayout, the error disappears, but when I use a ConstraitLayout, the error appears.

Screenshot_20230627-093206_Chrome.jpg


Java Class


public Uri getLocalBitmapUri() {
LinearLayout linearLayout = findViewById(R.id.parent); /*Your root view to be part of screenshot*/
linearLayout.buildDrawingCache();
Bitmap bmp = linearLayout.getDrawingCache();
// Store image to default external storage directory
Uri bmpUri = null;
File file;
try {
File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath() + "/" + getString(R.string.app_name) + "/");
dir.mkdirs();
String fileName = "/" + System.currentTimeMillis() + "share_image.png";

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
file = new File(dir, fileName);
} else {
file = new File(getExternalFilesDir(Environment.DIRECTORY_PICTURES), "share_image_" + System.currentTimeMillis() + ".png");
}

FileOutputStream out = new FileOutputStream(file);
bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
out.close();
bmpUri = Uri.fromFile(file);
} catch (IOException e) {
e.printStackTrace();
}
return bmpUri;
}




Xml


<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:layoutDirection="ltr"
android:eek:rientation="vertical"
tools:context=".MainActivity">

<RelativeLayout
android:id="@+id/relativeLayout7"
android:layout_width="1280dp"
android:layout_height="55dp"
android:layout_gravity="center_horizontal|center_vertical"
android:background="@color/colorPrimary"
android:gravity="center_horizontal|center_vertical"
android:layoutDirection="rtl"
android:eek:rientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/level_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginTop="2dp"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="RtlCompat" />

<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/level_number"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:layout_toStartOf="@+id/score"
android:layout_toLeftOf="@+id/score"
android:layout_toEndOf="@+id/questionNumber"
android:layout_toRightOf="@+id/questionNumber"
android:gravity="center_vertical|center_horizontal"
android:max="10"
android:progress="10"
android:progressDrawable="@drawable/circular_progress_bar2" />

<TextView
android:id="@+id/questionNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginStart="1dp"
android:layout_marginTop="1dp"
android:layout_marginRight="1dp"
android:background="@drawable/item_background"
android:gravity="center_horizontal|center_vertical"
android:paddingLeft="20dp"
android:paddingTop="10dp"
android:paddingRight="20dp"
android:paddingBottom="10dp"
android:text="0 / 0"
android:textColor="@color/colorAccent"
android:textSize="20sp"
tools:ignore="RtlCompat" />


<TextView
android:id="@+id/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_marginLeft="1dp"
android:layout_marginEnd="1dp"
android:background="@drawable/item_background"
android:drawableEnd="@drawable/score"
android:drawablePadding="15dp"
android:gravity="center_horizontal|center_vertical"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="30dp"
android:paddingBottom="10dp"
android:text="0"
android:textColor="@color/colorAccent"
android:textSize="20sp"
tools:ignore="RtlCompat" />

</RelativeLayout>

<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:eek:rientation="vertical"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout7"
tools:layout_editor_absoluteX="29dp">


<TextView
android:id="@+id/questionText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center_vertical|center_horizontal"
android:paddingLeft="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp"
android:paddingBottom="5dp"
android:scrollbars="vertical"
android:textColor="@color/textColor2"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>

<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="631dp"
android:layout_height="345dp"
android:layout_gravity="center_vertical|center_horizontal"

android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:eek:rientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/done"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3"
app:layout_constraintVertical_bias="0.104">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/answerGridview"
android:layout_width="406dp"
android:layout_height="123dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:columnWidth="40dp"
android:gravity="center"
android:horizontalSpacing="4dp"
android:padding="4dp"
android:scrollbars="none"
android:verticalSpacing="4dp" />



<Button
android:id="@+id/reveal"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="@drawable/border_background"
android:drawableLeft="@drawable/reveal"
android:drawablePadding="-5dp"
android:padding="5dp"
android:text="@String/show_answer"
android:textAllCaps="false"
android:textColor="@color/colorAccent" />

<ImageButton
android:id="@+id/reset"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:layout_margin="2dp"
android:background="@drawable/reset_skip_background"
android:padding="10dp"
android:scaleType="centerInside"
android:src="@drawable/reset" />

<ImageButton
android:id="@+id/skip"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_horizontal"
android:layout_margin="2dp"
android:background="@drawable/reset_skip_background"
android:padding="10dp"
android:scaleType="centerInside"
android:src="@drawable/skip" />


<Button
android:id="@+id/ask"
android:layout_width="139dp"
android:layout_height="615dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="@drawable/border_background"
android:drawableRight="@drawable/friends"
android:padding="5dp"
android:text="@String/askfriends"
android:textAllCaps="false"
android:textColor="@color/colorAccent" />



<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"

android:eek:rientation="vertical">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/choicesGridview"
android:layout_width="405dp"
android:layout_height="127dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:columnWidth="40dp"
android:gravity="center"
android:padding="4dp"
android:scrollbars="none"

/>

</LinearLayout>
</LinearLayout>

<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="1268dp"
android:layout_height="91dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="4dp"
app:adSize="SMART_BANNER"
app:adUnitId="@String/admob_banner_unit_id"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

<Button
android:id="@+id/done"
android:layout_width="1276dp"
android:layout_height="76dp"
android:background="@drawable/pressed_no_corners"
android:text="@String/done"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/adView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />

<ImageButton
android:id="@+id/voiceImage"
android:layout_width="120dp"
android:layout_height="66dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_gravity="center_horizontal"

android:alpha="0.6"
android:background="@drawable/border_background"

android:padding="10dp"
android:scaleType="centerInside"
android:src="@drawable/ic_speaker"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/questionImage"
app:layout_constraintEnd_toStartOf="@+id/linearLayout4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3" />

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/questionImage"
android:layout_width="500dp"
android:layout_height="250dp"
android:layout_alignParentTop="true"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:layout_marginTop="45dp"
android:layout_marginEnd="139dp"
android:layout_marginBottom="277dp"
android:adjustViewBounds="true"
android:gravity="center_horizontal"
android:maxHeight="250dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toTopOf="@+id/done"
app:layout_constraintEnd_toStartOf="@+id/linearLayout4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3"
app:shapeAppearanceOverlay="@Style/ShapeAppearanceOverlay.App.CornerSize50Percent" />

</androidx.constraintlayout.widget.ConstraintLayout>



I get this error when I try to convert LinearLayout ConstraintLayout.
I changed the Java Class to ConstraintLayout, still getting the same error

  • Question Question
Help IDK

I have no idea what this is doing on all my devices or what it is...the files I wanted to add are too big. Thia caused my Moto Stylus 5G to brick and my Samsung A20 is barely functional with the 200+ files daily and frequent restarts...please help me figure out what it is and how to remove it.






Art
VM Version: 2.1.0
Java Home: /system
Class Path: .
Boot Class Path: /apex/com.android.runtime/javalib/core-oj.jar:/apex/com.android.runtime/javalib/core-libart.jar:/apex/com.android.runtime/javalib/okhttp.jar:/apex/com.android.runtime/javalib/bouncycastle.jar:/apex/com.android.runtime/javalib/apache-xml.jar:/system/framework/framework.jar:/system/framework/ext.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/knoxsdk.jar:/system/framework/knoxanalyticssdk.jar:/system/framework/smartbondingservice.jar:/system/framework/securetimersdk.jar:/system/framework/fipstimakeystore.jar:/system/framework/timakeystore.jar:/system/framework/sec_sdp_sdk.jar:/system/framework/sec_sdp_hidden_sdk.jar:/system/framework/drutils.jar:/system/framework/android.test.base.jar:/system/framework/ucmopensslenginehelper.jar:/system/framework/esecomm.jar:/apex/com.android.conscrypt/javalib/conscrypt.jar:/apex/com.android.media/javalib/updatable-media.jar

Attachments

Duplicate class javax.activation.ActivationDataFlavor found in modules

//build.gradle(app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'

}

android {
namespace 'ug.ac.pentecostalcollege23.testcontact'
compileSdk 33

defaultConfig {
applicationId "ug.ac.pentecostalcollege23.testcontact"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}

//configurations {
// cleanedAnnotations
// implementation.exclude group: 'org.jetbrains' , module:'annotations'
//}
configurations {
// cleanedAnnotations {
// transitive = false
// }
cleanedAnnotations
// implementation.exclude group: 'org.jetbrains' , module:'annotations'
runtimeClasspath {
exclude module: 'javax.activation'
}
}

dependencies {

implementation('com.intellij:annotations:12.0') {
exclude group: 'org.jetbrains', module: 'annotations'
}
cleanedAnnotations 'org.jetbrains:annotations:13.0'

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.5.0-alpha04'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
//Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.6.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.6.0'
implementation 'androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0'
//Room
kapt 'androidx.room:room-compiler:2.5.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0'
implementation 'androidx.room:room-ktx:2.5.0'
implementation 'androidx.room:room-runtime:2.5.0'
//Test
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'


}

build.gradle(Testcontact)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.5.0'

}
}
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}
I want to use
in modules only jakarta.activation-api-1.2.1 (jakarta.activation:jakarta.activation-api:1.2.1) and ex clude javax.activation-1.2.0 (com.sun.activation:javax.activation:1.2.0)

  • Suggestion Suggestion
Would Affiliate Links be a Good way for the Forum to Make Money?

Would affiliate links be a good way for the forum to make money? For example, say the word "AdGuard" appears in a post. That could automatically turn into a link to the AdGuard website, via the forum's affiliate link (I've included my own affiliate link to show what this would look like). That would both make money for the forum, and give readers an easy way to the website of what's being referred to (AdGuard in this case).

  • Suggestion Suggestion
Rename "Gaming" section to "Video-games"?

In my opinion: the "Gaming" section of the forum should be renamed "Video-games"? "Gaming" (and "gamer") is jargon, slang. The standard English term is "video-game", and that's the term people are more likely to understand. This is especially important if we want this forum to speak to a worldwide audience, and not just people who speak English as their first language.

Need some help with hooking NFC

Hey All!
Im working on my first Magisk Module; a "Minimal-NFC-Framework Magisk Module"; for NFC devs and Researchers. The goal here is to have a cross-compatible and customizable NFC framework that contains a hook and some other useful NFC related dev tools (I.e NFCGate, but its own hook isn't working correctly on some devices, part of why i want to make a more compatible hook). Currently I've got the NXP SNxxxU series controllers supported, with plans to add the rest of NXP's stuff if/when someone reports it as needed, Likewise with all other NFC controllers and their framework/firmware. My Github repo for this project can be found here. You can see I've got a pretty good start already. I am having to reverse engineer my way through all of this as I can not find too much documentation on it. Please share any docs you may find too that may help!

So Hurdle #1 -->I optimally need to sort out a way to hook NFC in a similar way to xHook (The hook NFCGate uses), I have not messed with hooking before so need some good advice/guides/templates or prebuilt solutions.
Requirements for hook?
1- Support for android 10-13
2- ???

Hurdle #2 --> Need to identify the most common NFC controllers used on other devices so i can collect/source all the needed componets/files/libs/etc
Hurdle #3 --> Figure out a way to dynamically detect and mount the correct init/firmware & config files for the NFC controller on each individual device.

If you think you could help with this I want to hear from you! Even the smallest advice could be what I was missing!
Find me on any TG/Discord/Twitter
@k0mraid3

I just found my perfect Linux distro, Q4OS + Trinity

For a long time I've either lived with Windows 7 or badly attempted themes on Linux, neither of which felt 'right' especially today. Either I lived with unsupported and constantly breaking software requiring involved methods to keep it going or I lived with 'modern' garbage with a skin on top that never gave me that skeuomorphic itch.

But I found this Linux distro called Q4OS that while it's a pain to install (took HOURS to download its components over the internet, as it's not all there on the ISO image) it has this DE called Trinity that is a early 2000s time capsule, apps and all. From Amarok 1.4, to Konquerer, to Ark archiver, to K3B CD burning tool. HOWEVER, it's still maintained. You get the skeuomorphic touch but modern support for the web, YouTube, the works. I don't know where this distro has been hiding for the last ten years but I'm glad I found it.

If anyone is still into skeuomorphism or misses old KDE 3, this is a good one to try. All the best of the old but with the support of the new.


I'd take a screenshot but all the damned thing captures is the current open app, not the entire desktop. Prtsc isn't doing anything (bad keyboard on laptop?)

After Update

Hello Everyone,

I have just joined the forum and if I make any errors, please forgive me!

I am using a Galaxy A13, and following an update yesterday, I am left with an un-removable notice on an orange background saying - "Complete your OS upgrade?" click here to get started.

I actually clicked it and found a list of Apps that I do not want, Now I am unable to delete this message which "hangs around" on my notification locafion alongside my clock printout at the top left of my screen.

I have tried re-starting the device, but it still appears.

I am not very competent with technical matters, and also, being well past my sell-by date, I would be grateful if any answers and advice would be be in "simple" terms!

Regards,

ColinX

KOTLIN : HOW TO MAKE A FRAGMENT VISIBLE PROGRAMATICALLY

MAN, DO I NEED HELP!!

I have a MainActivity.kt along with its related MainActivity.xml.

I also have a Fragment that is a part of the MainActivity and it is consists of a MyFragment.kt and MyFragment.xml.
Within the MyFragment.xml I've specified that the MyFragment is Invisible, which means that wne the app starts and the MainActivity gets laid out, that MyFragment is not visible to the user.

I also have a MakeMyFragmentVisibleButton that's part of the MainActivity which, when clicked, I want to cause the MyFragment to become visible.

I am ASSUMING that while the MyFragment is INvisible no buttons or other controls that might be IN that MyFragmment are effectgivly UN-available to the user. He can't see them, can't interact with them.

BUT when the MakeMyFragmentVisibleButton is clicked by the user I want the MyFragment to become visible and thereby make any controls that might be within the MyFragment become visble and the user can interact with them.

That is how I WANT it to work.

BUT I can't figure out how to cause the MyFragment to become visible. I have succeeded in setting an onClickListener for the Button and it does indeed get called when the user clicks the button. But I haven't figure out WHAT CODE actually must run in order to make the MyFragment VISIBLE.

I looked at dozens of YouTube videos and online documents but they all seem to be written in JAVA. My app is in Kotlin which, unfortunately I have zero experience with (I have 45 years experience as a software engineer but I"m baffled by Kotlin).

So, if someone could PLEASE enlighten me as to what I need to do in Kotlin code to cause a Fragment to become visible (and correspondingly IN-visible) I would really appreciate it.

How to mute or stop Samsung Account notifications?

I'm using a Samsung Galaxy S9, model number SM-G965U, running Android version 10. It is not rooted.

I am annoyed because, on what seems like a daily basis, I get a notification from the app, "Samsung account," to let me know Samsung's legal terms have been updated.

When this happens, my phone makes the exact same noise it makes when I receive a text message. This is bad, because I don't want to miss any important messages, so every time this stupid app sends a notification, I get all activated about checking my phone.

When I go under Settings/Apps/Samsung account/Notifications, the only setting I'm allowed to change is "App icon badges." The settings for "Show notifications" and "General notifications" are on, and can not be altered or turned off.

Is there no way for me to take away this app's ability to pester me with notification sounds?

Side question: Is it possible to assign to my text messaging app a unique notification sound, so that notifications from other apps would no longer be mistaken for text message notifications?

Thank you!

Solution to "Hey Google" not working after Android 13 security update

"Hey Google" (AKA, Google Assistant) stops working after the phone is rebooted after installing the June 2023 security update. It seems the update turns off Google Assistant. To get it back it was necessary to not only toggle Assistant ON, but also retrain voice match (as though setting it up for the first time). Odd, but no further issue since doing this. HTH!

Open file dialog

Hi all, I have been trying for 3 days to create some code (button click) that will allow me to select a mp3 file from the media library and copy it to another directory within the app structure. I have sought assistance from 2 ai sources but have but have gotten all tangled up in permissions and other structural problems. So far I cannot even get the file open dialog to start and show any files. Does someone have some sample code that actually works? I would need to specify the music library location and the destination location.

Thanks

help me fix this app

package com.example.mobilemoneytransfer

import java.util.*

import kotlinx.serialization.*
import kotlinx.serialization.json.*
import kotlinx.coroutines.*
import retrofit2.*
import retrofit2.converter.gson.*

@Serializable
data class TransactionRecord(
val senderPhoneNumber: String,
val recipientPhoneNumber: String,
val amount: Int,
val timestamp: Long
)

interface MobileMoneyApi {
@POST("send-money")
suspend fun sendMoney(
phoneNumber: String,
pin: String,
recipientPhoneNumber: String,
amount: Int
): Response<Unit>

@POST("pay-bill")
suspend fun makePayment(
billNumber: String,
amount: Double,
phoneNumber: String
): Response<Unit>

@GET("transaction-history")
suspend fun getTransactionHistory(
phoneNumber: String,
pin: String,
fromDate: Date?,
toDate: Date?
): Response<List<TransactionRecord>>
}

class SendMoneyService {

private val client = OkHttpClient.Builder()
.addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY })
.build()

private val json = Json {
prettyPrint = true
}

private val api = Retrofit.Builder()
.baseUrl("https://api.mobilemoney.com/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(MobileMoneyApi::class.java)

fun sendMoney(
senderPhoneNumber: String,
senderPin: String,
recipientPhoneNumber: String,
amount: Int
): suspend (Result<Unit>) {
return withContext(Dispatchers.IO) {
val response = try {
api.sendMoney(senderPhoneNumber, senderPin, recipientPhoneNumber, amount)
} catch (e: Exception) {
return@withContext Result.failure(e)
}

if (response.isSuccessful) {
return@withContext Result.success(Unit)
} else {
return@withContext Result.failure(RuntimeException("Error sending money"))
}
}
}

fun getTransactionHistory(
phoneNumber: String,
pin: String,
fromDate: Date?,
toDate: Date?
): suspend (Result<List<TransactionRecord>>) {
return withContext(Dispatchers.IO) {
val response = try {
api.getTransactionHistory(phoneNumber, pin, fromDate, toDate)
} catch (e: Exception) {
return@withContext Result.failure(e)
}

if (response.isSuccessful) {
val transactionRecords = response.body() ?: emptyList()
// Cache the transaction records.
TransactionRecordCache.putTransactionRecords(transactionRecords)
return@withContext Result.success(transactionRecords)
} else {
return@withContext Result.failure(RuntimeException("Error getting transaction history"))
}
}
}
}

class MakePaymentService {

private val client = OkHttpClient.Builder()
.addInterceptor(HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BODY })
.build()

private val json = Json {
prettyPrint = true
}

private val api = Retrofit.Builder()
.baseUrl("https://api.mobilemoney.com/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(MobileMoneyApi::class.java)

fun makePayment(
billNumber: String,
amount: Double,
phoneNumber: String
): suspend (Result<Unit>) {
return withContext(Dispatchers.IO) {
val response = try {
api.makePayment(billNumber, amount, phoneNumber)
} catch (e: Exception) {
return@withContext Result.failure(e)
}

if (response.isSuccessful) {
return@withContext Result.success(

  • Question Question
Group MMS Not Sending

Hi Everyone,

Over the last couple months I've noticed an ongoing issue with Android Messages. Messages being sent to a group will not be delivered unless wifi is shut off. Receiving messages works fine though.

I have rebooted, cleared the cache/data from Messages, ensured wifi calling is on and set to wifi preferred, installed other messaging apps/used Samsung's default messaging app, turned 5G on and off, reset the APN settings to default, created a new APN, ensured auto downloading of messages is on, ensured the apps are always up to date and even factory reset the phone. Is there something I missed? No matter what I try the messages to a group don't send. I've also been told that duplicate messages of mine are received, however the message says it is undelivered on my end. Any advice you all may have would be greatly appreciated! Thank you in advance.

I'm on a Samsung Galaxy S21+ 5G through T-Mobile
Android 13
One UI 5.1
Security Patch June 1, 2023

Filter

Back
Top Bottom