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

Ways to improve technical debt for improving the functionality of the ap.

I am building an android app that will allow the user to scan and convert various images and pre-planned material into high definition printable formats allowing the user to print any content with ease. But my team recently started facing issues while rolling out v2 for our tool. We noticed a good amount to technical debt while reviewing the code moving forward we want to improve it.


Need to know if anyone has experiences using a code review tool.

runtime error while accessing google api in android emulator

I am trying to access the googleFit API. It seems pretty straightforward. Get the google sign-in permissions and required authorizations then query for Step count. My code doesn't seem to work. and it logs only "Error!!" that's it. Android gurus, Where am I going wrong??

Code:
fun getAuthorizationAndReadData() {
        try {
            MainActivity().fitSignIn(FitActionRequestCode.READ_DATA)
        } catch () {
           Log.i("e", "error!!!!")
        }
       }

MainActivity.kt
Code:
enum class FitActionRequestCode {
    READ_DATA
}

private val fitnessOptions: GoogleSignInOptionsExtension = FitnessOptions.builder()
            .addDataType(DataType.TYPE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ).build()

    fun fitSignIn(requestCode: FitActionRequestCode) {
        if (oAuthPermissionsApproved()) {
            readHistoryData()
        } else {
            requestCode.let {
                GoogleSignIn.requestPermissions(
                        this,
                        requestCode.ordinal,
                        getGoogleAccount(), fitnessOptions)
            }
        }
    }

    private fun getGoogleAccount() = GoogleSignIn.getAccountForExtension(this, fitnessOptions)


    private fun oAuthPermissionsApproved() = GoogleSignIn.hasPermissions(getGoogleAccount(), fitnessOptions)

    private fun performActionForRequestCode(requestCode: FitActionRequestCode) = when (requestCode) {
        FitActionRequestCode.READ_DATA -> readHistoryData()
    }
    private fun readHistoryData(): Task<DataReadResponse> {
        // Begin by creating the query.
        val readRequest = queryFitnessData()

        // Invoke the History API to fetch the data with the query
        return Fitness.getHistoryClient(this, getGoogleAccount())
                .readData(readRequest)
                .addOnSuccessListener { dataReadResponse ->
                    printData(dataReadResponse)
                    Log.i(ContentValues.TAG, "Data read was successful!") }
                .addOnFailureListener { e ->
                    Log.e(ContentValues.TAG, "There was a problem reading the data.", e)
                }
    }

    private fun queryFitnessData(): DataReadRequest {
        // [START build_read_data_request]
        // Setting a start and end date using a range of 1 week before this moment.
        val calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"))
        val now = Date()
        calendar.time = now
        val endTime = calendar.timeInMillis
        calendar.add(Calendar.WEEK_OF_YEAR, -1)
        val startTime = calendar.timeInMillis

        return DataReadRequest.Builder()
                .aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
                .bucketByTime(1, TimeUnit.DAYS)
                .setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
                .build()
    }

I have an app that needs to access Google Fit Api.
I can get the google sign-in pop up. But the next screen, requesting permission for my data types (TYPE_STEP_COUNT_DELTA, AGGREGATE_STEP_COUNT_DELTA) is not displayed.

As soon as I choose my google account the pop-up goes away and nothing is displayed further.



I have followed all the steps for the Setup mentioned here https://developers.google.com/fit/android/get-started

  1. Set up my project in Google API developer console

  2. Install google play services packages in my android studio

  3. Created an OAuth 2.0 Client ID

  4. Add the dependencies
Code:
  dependencies {
       implementation 'com.google.android.gms:play-services-fitness:20.0.0'
       implementation 'com.google.android.gms:play-services-auth:19.0.0'
   }
  1. Enable sign-in options "google" in my firebase console
Yet I do not get the further screens.

My code is as below:


Code:
public void setFitnessOption() {
       fitnessOptions =
               FitnessOptions.builder()
                       .addDataType(DataType.TYPE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ)
                       .addDataType(DataType.AGGREGATE_STEP_COUNT_DELTA, FitnessOptions.ACCESS_READ)
                       .build();
     }

public void checkFitInstalled() {
       if (isGoogleFitPermissionGranted()) {
           GetData();  //step count query     
       } else {
         requestGoogleFitPermission();
           GetData();    //step count query
       }
     }

public boolean isGoogleFitPermissionGranted() {
       if (GoogleSignIn.hasPermissions(GoogleSignIn.getLastSignedInAccount(this), fitnessOptions)) {
         return true;
       } else {
         return false;
       }
     }

public void requestGoogleFitPermission() {
       GoogleSignInAccount account = GoogleSignIn.getAccountForExtension(this, fitnessOptions);
       GoogleSignIn.requestPermissions(
               this,
               GOOGLE_FIT_PERMISSIONS_REQUEST_CODE,
               account,
               fitnessOptions);
     }


What am I missing out?? struggling for days with this issue. Any input would be great!!!

Help Retired Fed

Although it sounds a stupid thing to ask, I have to ask whether you are certain the phone was off? Even if it wasn't, i.e. something interrupted the shutdown or the button was pressed long enough to turn it back on, losing 48% overnight sounds high unless you live in fringe coverage, but if it really was turned off the battery shouldn't drop at all (bar a small amount due to self-discharge).

Unfortunately if the phone wasn't both turned on and in a location with really bad signal the simplest explanation is that there's a problem with the battery, which would be unusual in a phone that's less than a year old. But that's all I can think of.

Does this happen consistently or is it (as I suspect) a one-off?

Pre-order, trade-in and gifts thread

Dang, they had a display one? Jealous!

Yes they did and I took advantage of the opportunity to explore. It's very comparable in size and weight to my Note 10+. It's taken me a year to become accustomed to the buttons being on the wrong side of the Note... now I'll have to relearn that. It felt great in the hand and looks... OMG what a beautiful phone! The sales rep came over to assist me and I told him I just needed some hands on fun while I was waiting for my order to arrive. He smiled and said I well understand... It's quite a phone. We are in for a treat!

Need opinion about game controls

I wrote and am testing simple game for android.
Wanted to ask people, active gamers because it is not obvious for me.
Now live touch screen controling is working this way:
One touch - one moving to direction (left-right) + simultaneously immediate shot.
Holding touch - periodical firing. Automatically.
I like this way.
Is it comfortable for you?
Make visible controls - too expensive for resources.
Do you need controls yet?
Video (30 sec):

OxygenOS update 10.3.8 for OnePlus 6 & 6T

OnePlus has begun the OTA, (Over The Air), rollout of their new stable Android 10 OxygenOS firmware, 10.3.8, for OnePlus 6T, McLaren and OnePlus 6 users.

As always, there will be a limited roll out initially, followed by the global roll out in a few days.

Build date = 21 January 2021

Download size = 408MB incremental

Changelog
  • System updates
    • Updated MemberShip to 1.2.0.2
    • Updated Android Security Patch to 2021.01
    • Updated GMS package to 2020.09
  • OnePlus Store
    • An intuitive and convenient way to manage your OnePlus account, get easy-to-access support, discover exciting members-only benefits, and shop for OnePlus products. (Please note that it can be uninstalled) India only

Android security patch = January 2021

Camera version still = 3.8.114 (TBC)

This is the 23rd official, stable, update for the 6T in 806 days. 1 update on average, every 35 days

(N.B. This OxygenOS 10.3.8 is not available for the T-Mobile (USA) carrier minority variant)

Switch off phone alarm from mi band 5

Is there any way to switch off the alarm ringing on the phone (redmi note 9 pro) without touching it?

I already have try some third party application but no one has this function.

I had huawei p20 with their band for more than 2 years and this function was so good and now part of my daily routines.
In the morning i didn't need to search my phone to switch off the alarm, I just touched the band (that also vibrate simultaneously) and the alarm went off on both devices.

I'm very upset because I bought the Mi band 5 only for this function. At work I can't keep anything on my arm, so basically I really use it only for this function that it doesn't have.

Hope someone can help.

Thank you!

Help Suggestions?

Haven't dated in years but if I wanted to, I'd look for an app that doesn't use models in their advertisements.
That will narrow the market significantly ;)

As always with a "best" question I find myself asking "define best"? Different people will have different requirements, and so I'm sure different apps will suit different people better than others. Heck, I'm sure that many will be different depending on what country you are in (which we don't know).

No Seamless Updates for S21 series

Why can't they adjust if it's warranted for functionality? Or is there an edge if they are unique amongst competitors?
Unique in not offering a feature that makes updates more painless but has no effect on functionality otherwise isn't exactly a competitive edge, so I think we can dismiss that motivation.

As for why they can't deviate, well clearly (because of their market power) they can. If you are asking why Google mandated it, there are an awful lot of things that Google mandate and that manufacturers have to do, and a number of those can fairly be classified as anti-competitive but manufacturers go along with them (and many, including Samsung, have never publicly voiced any qualm). This one simplifies updates and doesn't stop manufacturers doing anything else, so has no downside to the user and no obvious one to the manufacturer. So the question of why Samsung choice this hill to fight on remains valid: is this just some massive corporate "we can't be bothered", or is there something peculiar about Samsung's workflow that this conflicts with?

Cannot Find Google Pixel Buds Icon (reinstalled twice)

The Pixel Buds app isn't a launchable app on Pixel phones. It integrates into the phone's settings menu instead. You can access it by going to Settings > Connected devices and tapping the gear icon next to your Pixel Buds. A shortcut is to swipe down from the top of the screen to expose the quick settings panel and then long-press the Bluetooth icon.

https://support.google.com/googlepixelbuds/answer/7685360

Filter

Back
Top Bottom