• Breaking News

    [Android][timeline][#f39c12]

    Sunday, May 1, 2022

    Is it okay to provide ViewModel inside a module with Dagger 2? Android Dev

    Is it okay to provide ViewModel inside a module with Dagger 2? Android Dev


    Is it okay to provide ViewModel inside a module with Dagger 2?

    Posted: 01 May 2022 05:58 AM PDT

    I saw this approach from one of my colleague where ViewModel is provided using the module thus you won't even need to instantiate it inside Activity or Fragment onCreate nor onCreateView but I can't find a single article yet that is doing the same approach. Its working fine at all but I want to know if this is okay and valid at all.

    See the sample code here in SO

    https://stackoverflow.com/q/72076746/12204620

    Thanks everyone

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

    How does the google family link app block apps ?

    Posted: 01 May 2022 02:03 AM PDT

    Hello,

    I'm an Android developer and my company is developing a parental control app.

    We use the accessibility service to detect application launches. We couldn't find any other API to do so. I was wondering how google family link does this without using the accessibility service. They are not binding any accessibility services. Does anyone know which APIs they use ?

    Thanks.

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

    Best roadmap for android app initial release

    Posted: 01 May 2022 03:25 AM PDT

    Hello,

    Together with my mate we releasing an mobile app on google play store. What are the best practices for releasing it? Currently we want to somehow release it strictly only for us, and no one else to test the functionalities of GP Store and real behavior of the app after downloading it from Store. Is it a good approach to release it in this way (to preform initial "smoke" tests), and how to do that?

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

    Any good canvas or UI courses to recommend?

    Posted: 30 Apr 2022 12:58 PM PDT

    Hello everyone,

    UI was always my weak spot, ever since i was a student i always remember that i hated HTML and Front end dev so much, and i'm looking to improve on this point but can't come across a good resource so far online.

    What do you recommend to be better when it comes to UI, i'm looking for courses or good resources on Canvas and animations.

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

    How realistic is it for a new dev to take an abandoned app and update it to work with newer versions of Android?

    Posted: 30 Apr 2022 05:33 PM PDT

    I have an expensive Gaiam body fat scale and the app developer seems to have abandoned the app with no updates for more than a year.

    How realistic is it that a new dev could take the apk and update it to work again?

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

    Inserting a List of Objects of an Entity within a Separate Entity in Android using Room Database with Kotlin

    Posted: 30 Apr 2022 01:33 PM PDT

    ** If this breaks a Rule, no worries mods can remove,. I can restructure the question to get a deeper understanding of the GoogleDocs Insert Mutliple Objects with Room Database. **

    TL;DR - Inserting A list of Objects within an Entity Class using Room Database and Kotlin. Original Q on Stack Overflow: https://stackoverflow.com/questions/72071355/inserting-a-list-of-objects-in-android-room-database-with-kotlin

    I'll explain here as well, hoping someone has a good understanding of Inserting Objects with Room Database, using Kotlin. I'm creating an Application that Allows the user to create a Clothing Item given this Clothing.kt class:

    @Parcelize @Entity(foreignKeys = [ ForeignKey(entity = Outfit::class, parentColumns = ["id"], childColumns = ["outfitRefFK"] ) ] ) data class Clothing ( //Sets all attributes and primary key @PrimaryKey(autoGenerate = true) val id: Int, val type: String, val color: String, val style: String, val description: String, val dateAdded: Date = Date(), val brand: String, val theme: String, val image: String, @Nullable val outfitRefFK: Int ): Parcelable 

    The class uses what I'm assuming is standard POJO to work with the DAO to ADD, INSERT, DELETE, and QUERY from that Table.
    ClothingDao.kt

    @Dao interface ClothingDao { //Ignores when the exact same data is put in @Insert(onConflict = OnConflictStrategy.IGNORE) suspend fun addClothing(clothing: Clothing) @Update suspend fun updateClothing(clothing: Clothing) @Delete suspend fun deleteClothing(clothing: Clothing) @Query("DELETE FROM Clothing") suspend fun deleteAllClothing() @Query("SELECT * FROM Clothing ORDER BY id ASC") fun readAllData(): LiveData<List<Clothing>> @Query("SELECT * FROM Clothing WHERE type='Top' ORDER BY id ASC") fun selectClothingTops(): LiveData<List<Clothing>> //Called in ListFragment Searchbar. Queries Clothing Type or Clothing Color. @Query("SELECT * FROM Clothing WHERE type LIKE :searchQuery OR color LIKE :searchQuery") fun searchDatabase(searchQuery: String): LiveData<List<Clothing>> } 

    My goal is to use an Outfit Entity Class that will store a List of Clothing Items when the user forms their created List. I haven't had issues with the UI and Binding Data in the ViewModel with the Clothing Class, but mostly storing the List of Clothing items in the DB as a Outfit.

    Outfit.kt

    @Parcelize @Entity data class Outfit ( @PrimaryKey(autoGenerate = true) val id: Int, val outfitName: String, @Ignore val ClothingItems: List<Clothing> ):Parcelable 

    And I'm currently working on the OutfitDao but here is what I have so far.

    OutfitDao.kt

    @Dao interface OutfitDao { @Insert(onConflict = OnConflictStrategy.REPLACE) suspend fun addOutfit(outfit: Outfit) @Query("SELECT * FROM Outfit ORDER BY id ASC") fun readAllData(): LiveData<List<Outfit>> } 

    My Question

    Given the tables I currently have, how can I store a list of Clothing Objects, that match a given Outfit ID. I understand that it's not possible to store a list of objects in SQLite, but I've been trying to understand Google's documents given their MusicDAO Example for Inserting Multiple objects

    Googles Example: Android Insert Room Database with Kotlin

    @Dao public interface MusicDao { @Insert(onConflict = OnConflictStrategy.REPLACE) public fun insertSongs(varargs songs: Song) @Insert public fun insertBoth(song1: Song, song2: Song) @Insert public fun insertAlbumWithSongs(album: Album, songs: List<Song>); } 

    I'm assuming if I can somehow understand the "insertAlbumWithSongs" and "InsertBoth" functions then I could solve my problem. Just not sure of my next step.

    My attempts so far:

    1. @Embedded val ClothingItems: List<Clothing>
      Using an Embedded list was my closest attempt but Room couldn't figure out how to store Clothing as an object in SQLite. It also did not like Referencing multiple Embedded Objects.
    2. Storing each Clothing Type within Room as a JSON String using GSON and Following this Tutorial: https://www.section.io/engineering-education/storing-custom-data-types-with-custom-typeconverter-in-room-database/
      - This one was difficult for me to understand, as it seems majority of the article and other SO posts, that this method is for grabbing already created data sets form online JSON API's. That could be great for future purposes, but not what I need at the moment.
    submitted by /u/Sad-Grapefruit9996
    [link] [comments]

    How to 'execute' a Flow query in a Room?

    Posted: 30 Apr 2022 05:35 PM PDT

    Not sure if this is a silly scenario or not but what is the best way to immediately evaluate a Room query that has a return type of LiveData/Flow? I have a UI with a list of items where I use that normally (update the UI when the database changes etc) but I also have a scenario where I need to get that list on init of a viewmodel to set values on another list (basically I get a similar list of items from an API and want to mark the ones already stored on the device). Currently I'm doing a .collect() after my API call returns to get the stored items but I'm not sure if that's the right way to do it.

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

    why app is taking so long to review in playstore

    Posted: 30 Apr 2022 08:25 PM PDT

    I have uploaded my first app on 26th April 22 now it's 1st may , but still the app is not being live , the app just have 4 screen 2 of them only contains textview and 1 have a link button and the main one have 2 audio files that's had to been played

    Why this small app is taking too long now it is close to 7 days ,it is making me nurvous that will my first app will be banned don't know for what

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

    Integrate Payment in Application?

    Posted: 30 Apr 2022 06:29 PM PDT

    I want to integrate a payment section between two customers (platform)

    Do you have any tips to integrate one? Maybe a service or a best practice?

    Also, do you know the margins of PayPal? As I want to charge as less as possible (5%) it should still pay off somehow

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

    Searching for an Android app development course.

    Posted: 30 Apr 2022 05:48 AM PDT

    Hello, I'm searching for an App development course. If you have any suggestion I would appreciate it. I saw there are a lot of programs/languages but my goal is to develop an app at the level of the big ones, like Twitter, Facebook etc...(referring to the interface). I have a decent base in coding. Maybe is better to ask what the best program/lenguage is and then I search for the course for myself.

    Thanks

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

    How to recomposition after popbackstack?

    Posted: 30 Apr 2022 08:48 AM PDT

    I have two composable which have the same minor composable called "TitleArea" which contains text as a string. When I click the button in SecondScreen I can change the TitleArea's content to "New User Name". But when I click the popbackstack button to FirstScreen. The TitleArea's text in FirstScreen doesn't be changed to "New User Name" and still is "Origin user Name".

    I think the problem is because it didn't make FirstScreen recomposition. But I can't find a way to let it recomposition or any other solution.

    Here is my code.

    FirstScreen

    @Composable fun FirstScreen( navController: NavController ) { TitleArea() Button( onClick { navController.navigate(route = Screen.SecondScreen.route) } ) } 

    SecondScreen

    @Compsoable fun SecondScreen( viewModel: TitleAreaViewModel = hiltViewModel(), navController: NavController ) { TitleArea() Button( onClick { navController.popBackStack() } ) Button( onClick { viewModel.onEvent(MeasurementsEvent.ChangeName) } ) } 

    TitleArea

    @Composable fun TitleArea( viewModel: TitleAreaViewModel = hiltViewModel() ) { Text( text = viewModel.state.value.userName ) } 

    ViewModel

    @HiltViewModel class TitleAreaViewModel @Inject constructor( private val measurementUseCases: MeasurementUseCases ) : AViewModel() { private val _state = mutableStateOf(MeasurementsState()) val state: State<MeasurementsState> = _state fun onEvent(event: MeasurementsEvent) { when(MeasurementsEvent.ChangeName) { _state.value = state.value.copy( userName = "New User Name" ) } } } 

    MeasurementsState

    data class MeasurementsState( val userName: String = "Origin user Name" ) 

    Thanks to everyone who read the post. Have a nice weekend.

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

    How to do properly when I need access to activity context

    Posted: 30 Apr 2022 12:37 PM PDT

    Hello guys. I am completely stuck for a days. As a new in android development need to implement login. We are using auth0 to handle login for us. I created for username login setup with abstractions and own implementation of auth0 but stuck with google social login. With google social login auth0 require access to activity context. As far as I know getting access of context in view model is not recommended but also from my point of view accessing auth0 from composable should be also suspicious. Any advice how would you do it. Here is auth0 sdk for reference if someone need https://github.com/auth0/Auth0.Android

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

    Learn Dagger 2 from Dagger Hilt

    Posted: 30 Apr 2022 08:16 AM PDT

    Is the fact that anyone can just decompile APKs to Java on Android Studio a security issue?

    Posted: 30 Apr 2022 10:00 AM PDT

    I know you can do the same on iOS with Hopper but it's much harder.

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

    Testing Mobile Push Notifications

    Posted: 30 Apr 2022 09:50 AM PDT

    Hello developers,

    I am working on a server to publish different kind of (push) notifications like mobile push, web push, email, sms and so on: https://github.com/notifo-io/notifo

    The server is already used in production in a few products and is working well. I am looking for an easy way to test mobile push notifications in my CI pipeline. We already have monitoring for that with a real device, but I would like to use something that is not dependent on an actual device.

    For example I have a test for emails, where I start a dummy server in production and test if the email has been delivered. I would like to do something similar.

    Perhaps a test android app that is hosted somewhere and receives push notifications and confirms them? Or another service that is built for that?

    Afaik I cannot query messages in firebase, otherwise it would be a good start to test the pipeline to firebae.

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

    Is it necessary/recommended to learn/know Java before learning Kotlin for Android App development?

    Posted: 30 Apr 2022 01:29 AM PDT

    I am stuck in the tutorial phase. It seems that I can't get passed the fact that Kotlin relies on Java in a way. I think I need to master Java and then master Kotlin then I can start writing apps. This thinking scares me because there is so much to be done before I can start writing apps.

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

    How to get JSON data, when a JSON field changes.

    Posted: 30 Apr 2022 08:50 AM PDT

    Hello guys, I'm creating a music streamer app, i was given a JSON file which contains the company's website online music player status. One of the JSON field is the current track name witch changes when the track changes. I managed to display the name of the track in the app but when the track changes, the name of the previous track remains. How can i resolve this issue?

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

    What is the best, most efficient and complete road path to learning Android App Development?

    Posted: 30 Apr 2022 01:32 AM PDT

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel