• Breaking News

    [Android][timeline][#f39c12]

    Friday, January 31, 2020

    Weekly "anything goes" thread! Android Dev

    Weekly "anything goes" thread! Android Dev


    Weekly "anything goes" thread!

    Posted: 31 Jan 2020 04:40 AM PST

    Here's your chance to talk about whatever!

    Although if you're thinking about getting feedback on an app, you should wait until tomorrow's App Feedback thread.

    Remember that while you can talk about any topic, being a jerk is still not allowed.

    submitted by /u/AutoModerator
    [link] [comments]

    Takeaways comparing Flutter to Jetpack Compose

    Posted: 31 Jan 2020 07:42 AM PST

    What is an Android Dev related hill you are willing to die on?

    Posted: 31 Jan 2020 09:38 AM PST

    Most people have at least one opinion they will fight tooth and nail to defend, what's yours?

    submitted by /u/taji34
    [link] [comments]

    GitHub - mohammadima3oud/Complete-Google-Map-API-Tutorial: Learn How to use Google Map API for Android from Basic to Advance with complete examples.

    Posted: 30 Jan 2020 11:42 PM PST

    Which is the faster and lightest emulator(or method to run Android apps) on PC for development?

    Posted: 31 Jan 2020 02:30 PM PST

    Recently I have tested AndBox on Ubuntu, but I expected more for a method "native" to run apps. I got more performance with GenyMotion, but this doubt arose.

    Regardless of the OS you are using, which one is the best?

    submitted by /u/Gilga3354
    [link] [comments]

    I'm in a Scoped Storage Holding Pattern

    Posted: 31 Jan 2020 04:57 PM PST

    I am waiting for Android R Beta release in a month or two so I can see what direction they took with the scoped storage. So I am not targetting Android Q yet and haven't implemented any of those scoped storage changes. I wonder how many other apps are doing the same

    submitted by /u/veltlikeme5
    [link] [comments]

    Purpose of categories for implicit intents

    Posted: 31 Jan 2020 04:20 PM PST

    I don't quite get the point of categories. The action tag specifies the type of action. Why is there a need for a category attribute?

    submitted by /u/backslashv
    [link] [comments]

    Bottom Nav or Tabs

    Posted: 31 Jan 2020 05:03 AM PST

    Do you guys and girls prefer bottom nav or tabs? They're both ergonomic forms of navigation, but bottom nav(for Android at least) doesn't look right because it's stacked on the system navigation. I personally prefer tabs, but so many popular apps use bottom nav. Thoughts?

    submitted by /u/murray1029
    [link] [comments]

    Fabric Answers Daily Email Alternative

    Posted: 31 Jan 2020 02:30 PM PST

    I've been getting Fabric.io daily Answers emails to see stats on all my apps. With Fabric being sunsetted, does anyone know of a way to replicate these emails with Firebase Analytics? Or will the emails continue? I haven't been able to find anything.

    Thanks in advance!

    submitted by /u/iawix
    [link] [comments]

    Play Store finally doesn't cut text on weird places of the "what's new" section

    Posted: 31 Jan 2020 05:09 AM PST

    Remember this:

    https://www.reddit.com/r/androiddev/comments/dhuecz/play_store_now_concats_the_start_and_end_of_your/

    ?

    I've noticed that now it doesn't occur anymore and is officially fixed by Google. I've tried on multiple apps on the Play Store.

    So, you don't have to worry about this anymore :)

    submitted by /u/AD-LB
    [link] [comments]

    Retrofit & Gson (Kotlin) - Not a primitive type: 'L'

    Posted: 31 Jan 2020 01:13 PM PST

    Hi all,

    EDIT:

    Resolved!! For some reason, after cleaning the project, it would no longer build. This lead me to an error where I needed to add further statements into my build.gradle file, the below is what I had to add for anyone else that gets this error:

     compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } 

    Retrofit and android is driving me insane at the moment, so I hope someone might be able to assist me in understanding what is going on. I've tried everything I can think of, but nothing changes the error.

    A bit of history, I'm a C# developer (10+ years experience) coming to Java & Android. So far, it's been a pretty easy transition, but this one issue has just had me stuck for a few days now, and without it working, I can't really move on with the development of the application I'm working on.

    Anyone understand what's going on here? "Not a primitive type: 'L'"? Where does "L" come from?

    The Current Output

    The current version of code, as seen below, makes a connection to the API with the correct "username" and "password" value. Therefore, it successfully decodes the AuthRequest object and turns it into JSON and submitts to the URL.

    The request is successful - as I can see this in the API logs, and I can see the output as follows:

    { "authKey": "key", "authKeyExpiry": 120, "refreshKey": "key2" } 

    However - the following error is thrown and the android app crashes:

    A/zygote: thread.cc:2090] No pending exception expected: java.lang.NoClassDefFoundError: Not a primitive type: 'L' A/zygote: thread.cc:2090] at void retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall$1.onResponse(retrofit2.Call, retrofit2.Response) (DefaultCallAdapterFactory.java:76) A/zygote: thread.cc:2090] at void retrofit2.OkHttpCall$1.onResponse(okhttp3.Call, okhttp3.Response) (OkHttpCall.java:129) A/zygote: thread.cc:2090] at void okhttp3.RealCall$AsyncCall.run() (RealCall.kt:140) A/zygote: thread.cc:2090] at void java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) (ThreadPoolExecutor.java:1162) A/zygote: thread.cc:2090] at void java.util.concurrent.ThreadPoolExecutor$Worker.run() (ThreadPoolExecutor.java:636) A/zygote: thread.cc:2090] at void java.lang.Thread.run() (Thread.java:764) 

    EDIT: Gradle file as below:

    app

    apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "appid" minSdkVersion 23 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' implementation 'com.google.code.gson:gson:2.8.6' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.squareup.retrofit2:retrofit:2.7.1' implementation 'com.squareup.retrofit2:converter-gson:2.7.1' implementation 'com.squareup.okhttp3:okhttp:4.3.1' implementation 'org.conscrypt:conscrypt-android:2.2.1' } 

    The Code

    The following code has been added, I've been following a tutorial, however, I've had to adjust things for my API. My aim was to keep it simple.

    Model/AuthRequest

    data class AuthRequest ( val username: String, val password: String ) 

    Model/Auth

    data class Auth ( @SerializedName("authKey") val authKey : String?, @SerializedName("authKeyExpiry") val authKeyExpiry : Int?, @SerializedName("refreshKey") val refreshKey : String? ) 

    Api

    public object Api { private lateinit var retroFit: Retrofit private var api: ApiInterface? = null private lateinit var gson: Gson private var baseUrl: String = "https://webserviceurl/" private var authKey: String = "" private var authTimeout: Int = 0 private var refreshToken: String = "" fun getApi() : ApiInterface { if (api == null) { var client = OkHttpClient.Builder().build() gson = GsonBuilder().create() retroFit = Retrofit.Builder() .baseUrl(baseUrl) .client(client) .addConverterFactory(GsonConverterFactory.create(gson)) .build() api = retroFit.create(ApiInterface::class.java) } return api!! } fun getGson() : Gson { return gson } } 

    ApiInterface

    public interface ApiInterface { @POST("Login") fun login(@Body request: AuthRequest): Call<Auth> } 

    The code that calls this function, is currently just put in a login activity, the code for this activity can be seen below:

    activities/LoginActivity (login function)

    class LoginActivity : AppCompatActivity() { private lateinit var txtUsername: EditText private lateinit var txtPassword: EditText override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_login) txtUsername = findViewById(R.id.txtUsername) txtPassword = findViewById(R.id.txtPassword) } fun handleLogin(view: View) { val username = txtUsername.text.toString() val password = txtPassword.text.toString() val callback = object : Callback<Auth> { override fun onResponse( call: Call<Auth>?, response: Response<Auth>? ) { showNotification("It worked?") } override fun onFailure(call: Call<Auth>?, t: Throwable) { Log.e("Test", t.message, t) showNotification("It failed?") } } Api.getApi() .login(AuthRequest(username, password)) .enqueue(callback) } } 
    submitted by /u/andercode
    [link] [comments]

    Kotlin Scope functions made simple

    Posted: 31 Jan 2020 08:26 AM PST

    Is the compression performed on an app bundle guaranteed to be lossless?

    Posted: 31 Jan 2020 03:17 AM PST

    I just did an update and users are getting errors that could only make sense if lossy compression was being applied to my asset files.

    submitted by /u/Nimitz14
    [link] [comments]

    [Android Studio/Kotlin] Linting is Complicated? Am I doing this right?

    Posted: 31 Jan 2020 06:35 AM PST

    (I'm new to Android dev with a background in web dev.) I've been trying to implement a linting situation for our teams new project and there seems to be a lot of pieces involved. [In web dev I've just used 'prettier' w/ VS Code]

    Our goal is to control standard kotlin formatting/code styles by a command line script (so we can run it CI), w/a preferred action of being able to have Android Studio automatically format/fix the files.

    From the way I'm looking at it, there are four pieces involved in this equation (It's been surprisingly hard to understand how all these pieces fit together):

    1. Android Studio Code styles
      seems to be what rules are used w/`Reformat Code`
    2. Android Studio Linting
      can be run w/command line; hard to figure out how to customize/better see what the rules are. Seems to be a list here(https://sites.google.com/a/android.com/tools/tips/lint-checks) which can be configured in lint.xml but... I'm assuming these rules are fine as is, and we're going to use this check, but just not going to configure unless we disagree w/something that is yelling.
    3. Android Studio Inspections
      easy to configure, but don't seem to relate at all to what happens when running `lint`
      These seem to be the rules that are applied when running `Analyze > Code Cleanup`
    4. Detekt (w/ktlint formatting),
      seems to be the most commonly used Code Analysis for kotlin, and super thorough from a smells perspective (which seems very useful)

    I don't like having to mirror the configs for detekt w/Code Styles + Code Inspections. :

    It seems like I need to do this in order to get the "automatic updates" to work properly.

    • I can run `Reformat Code` and `Code Cleanup` and they automatically update the file(s) in a useful manner
    • I am using the detekt plugin, and it has a command in Android Studio called "Auto Detect by Detekt Rules" which seems to just auto correct the formatting rules. This seems fine, but looking further it doesn't help me in some useful situations like breaking up long function signatures, for example.

    We have all these files in source control to keep us on the same page:

    • codeStyles/Project.xml
    • inspectionProfiles/Project_Default.xml
    • detekt.xml (config for anyone who uses detekt plugin)
    • detekt-config.yml

    Is this a normal way that "Android dev" lints? It seems SUPER complicated. Maybe just initially while you are configuring things to match?

    submitted by /u/imperfectly_balanced
    [link] [comments]

    Passing Context to Utility Class

    Posted: 31 Jan 2020 10:19 AM PST

    So I've created a static Utility Class that depends on the context of the activity that uses one of its methods. Now i read a lot about the Memory Leaks this can cause if the activity is unable to be destroyed because of the reference the Utility Class holds.

    My question is if the object of the activity I pass as a context is also "held hostage" if the methods of my Utility Class never create a variable that holds this object, instead only using the passed parameter directly (not saving it in any form)?

    Thanks in advance

    submitted by /u/Ceroyo
    [link] [comments]

    Reactive Paging and Loading based on the usage of Unidirectional Data Flow pattern.

    Posted: 31 Jan 2020 04:19 AM PST

    Cross-device data synchronization design question

    Posted: 31 Jan 2020 08:30 AM PST

    Hi, I'm developing an app and am looking for some insight on an architecture that will help me sync data across devices/platforms. I have a few somewhat unique requirements:

    • App should have no login
    • Data entered into the app is unique to a single user and never viewed by anyone else
    • When a user installs the app on either Android or iPhone all of their data should be stored only in a local SQLite database or some other datastore (e.g. Realm.io) on their phone
    • A user may upgrade to a paid membership at which time they have the option to sync their data between all their devices (Android/iPhone/iPad and in the future a website). I would like to keep a copy of the data on each device for the eventuality of.....
    • A user may stop syncing between devices at which time a local copy of whatever data is on each device remains intact.

    My thoughts right now are to have a local Realm database that comes with the app install. When a user upgrades I will create a unique identifier and hidden password stored on the device which I will use to associate them with a synced Realm in the cloud, without needing to provide a password themselves.

    At upgrade time I will copy the local Realm to the synced Realm.

    If they want to link a new device they will have to read a QR code from their master device, which will give them the unique identifier/password combo used to connect to their cloud-based Realm. I'm going for a similar experience to how apps like Signal or WhatsApp work.

    A few of my questions/concerns:

    • Is there a better datastore and syncing option than Realm, like another provider, or some way to do this with pure SQLite and running my own sync server, without writing a ton of complex transactional data merging code?
    • How do I go about keeping a local copy of data on each phone, that way when someone downgrades all their data is simply on their phone?
    • What is the best way to authenticate someone to a cloud data store without requiring them to have a username and password? (e.g. UUID or token)

    Thank you very much!

    submitted by /u/jon1234567
    [link] [comments]

    How can I do AsyncLayoutInflater onCreate

    Posted: 31 Jan 2020 07:16 AM PST

    I wrote my question here before. Is there anyone to help
    https://stackoverflow.com/questions/60006139/asynclayoutinflater-oncreate

    submitted by /u/emptyfiles
    [link] [comments]

    Google Play Store listing experiments, "needs more data", should I really wait?

    Posted: 31 Jan 2020 06:23 AM PST

    I sometimes run experiments changing the app icon, and usually within a few hours you can see an icon 30% or 40% better than the other, but google says it needs more data.

    Does anyone ever noticed a change on this?

    Should I really wait or just consider one better than the other already?

    submitted by /u/RafaelF82
    [link] [comments]

    Alternate android stores

    Posted: 31 Jan 2020 01:35 AM PST

    This has been asked many times before but much of the material that could be found was more than 5 years old so wanted to get latest update on how is the experience publishing on SlideMe and Samsung Stores in particular? Issues of payment and refund, apk integrity (read Amazon changes dev's apk on their own so...), does it affect your publisher status on other stores or any other specific issues.

    Also if anybody can relate a positive experience with any other store or make any recommendations they are most welcome.

    Thanks in advance.

    submitted by /u/smudgeapp
    [link] [comments]

    Need help with implementing Design library

    Posted: 31 Jan 2020 05:03 AM PST

    I'm kinda new to the world of android development. I need help with implementing design library, that would look something like this:

    implementation 'com.android.support:design:28.0.0'.

    this is showing an error. I'm running android studio version 3.5.3.

    submitted by /u/controversialcomrade
    [link] [comments]

    Good resourcesLearning Java for app development(i already know C++)

    Posted: 31 Jan 2020 04:23 AM PST

    Can someone please tell me where can I learn java when I already know C++?

    submitted by /u/rohillashourya
    [link] [comments]

    Add 'Play in VR' option to an image

    Posted: 30 Jan 2020 10:23 PM PST

    Hey devs, I'm developing a Museum Gallery app which will play videos and images in VR. These are the problems I'm facing:

    1) There are no online tutorial on how to open a images in VR in Android Studio (like if I click on a VR icon, one specific image will open in standard VR mode). How to do this?

    2) I can ask a user to import images. Is it possible to arrange those images in 3D space which can be played in VR?

    I'll be grateful to the dev who will help me.

    Thanks for the help.

    submitted by /u/PratikPingale
    [link] [comments]

    Some store named Catappult is redistributing my apps without permission

    Posted: 30 Jan 2020 08:06 PM PST

    This isn't some piracy site. They seem to be presenting themselves as a legitimate store. They proudly sent me automated emails to tell me that two of my free apps are being distributed on their store. I had never heard of them.

    Isn't this a copyright violation even though the apps are free on Google Play? Honestly, I'm probably going to ignore it because they are probably doomed to fail, but if a major player did this kind of stuff, it could create big problems for developers. You'd have to support users without knowing how they got your app. They could be stuck with an obsolete version and emailing you about it. They might be using it on a non-GApps device so they aren't being served ads. etc.

    Plus, they even have the gall to name themselves after an absurdly inferior siege weapon.

    submitted by /u/butterblaster
    [link] [comments]

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel