• Breaking News

    [Android][timeline][#f39c12]

    Friday, October 30, 2020

    Weekly "anything goes" thread! Android Dev

    Weekly "anything goes" thread! Android Dev


    Weekly "anything goes" thread!

    Posted: 30 Oct 2020 05:40 AM PDT

    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]

    How can I do custom notch on CardView like this?

    Posted: 30 Oct 2020 01:28 AM PDT

    Avoiding I/O in gradle ?

    Posted: 30 Oct 2020 08:22 AM PDT

    I have seen some threads recommending that you avoid I/O during gradle configuration. My company currently does this to get the branch name, build time, and git SHA, into BuildConfig. I'm trying to understand the reasoning of why I should avoid it before I bring it up to my coworkers.

    For these specific examples I replaced the git command with a static string, and did ./gradlew assemble* --dry-run --rerun-tasks --profile and those configuration times dropped from around 3s to 1.5s. that's a nice percentage but not all that significant since that's only for configuration.

    What else should I know? I have read some threads alluding to impacting incremental builds but can't find concrete info about why

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

    How do I show a toast just below the Toolbar

    Posted: 30 Oct 2020 02:42 PM PDT

    I need to show a toast just below the toolbar. It is a standard activity with no frills

    fun onCreateView(savedInstance: Bundle?) {

    super.onCreateView(savedBundle)

    setContentView(R.layout.my_layout)

    val toast = Toast(this).apply {

    setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 0)setDuration(Toast.LENGTH_LONG)

    show(R.string.success_string)

    }

    . . . . . . . Other code in the function . . . .

    }

    Activity definition in the manifest

    <activity android:name=".activities.InputActivity" />

    I have setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 0). I know that I can set the y offset but I don't know how the y offset should be calculated. The most relevant article on SO is from 2013. Any suggestions would be gratefully appreciated.

    https://stackoverflow.com/questions/18420445/how-to-show-custom-toast-below-actionbar

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

    kotlinx.coroutines 1.4.0: Introducing StateFlow and SharedFlow

    Posted: 30 Oct 2020 04:24 AM PDT

    Testing on real phone question

    Posted: 30 Oct 2020 10:59 AM PDT

    Hi folks, I'm new to Android dev so hope this isn't too stupid a question. I'm not clear from the articles I read on testing on a real device whether the methods listed leave the app on the phone such that it can be used out in the field, unplugged from android studio, and running in the background. It's for a cognition experiment for uni class, so I do not want to publish this to the public, but I do need to use it in a realistic way. (which means running in the background and then doing an interaction with the user once an hour). If this is not possible with a native app I suppose I should build it as a web app or something. thanks!

    submitted by /u/tremendous-machine
    [link] [comments]

    FirebaseCrashlytics not logging non-fatal errors (Android)

    Posted: 30 Oct 2020 12:20 PM PDT

    I am starting to migrate to FirebaseCrashlytics (finally) . Fatal crashes are reported fine. I am trying to log non-fatals. I've permitted logging in manifest file. Restarted the app after logging but I am not able to see anything in the console.

    private void logNonFatal() {

    FirebaseCrashlytics.getInstance().setCustomKey(ACTIVITY, true); // Key activity name

    for (String content: logList) // set all keys in the loglist

    FirebaseCrashlytics.getInstance().setCustomKey(content, true);

    FirebaseCrashlytics.getInstance().log(ACTIVITY_STARTUP + " error!"); // finally call log to register non-fatal error

    }

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

    Is there a known problem with chrome, and samsung galaxy phones having broken grayscale/black levels?

    Posted: 30 Oct 2020 03:45 PM PDT

    Chrome seems to make almost every video that should have either black become light gray, or a value that should be 100% white becomes grey instead.

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

    Admob question: Is big gap between ad requests and impressions affects revenue negatively?

    Posted: 30 Oct 2020 02:01 PM PDT

    Hi guys, i use admob to show interstitial ads in my app. I pre request it and when user does some steps i show it. Sometimes user doesn't get to that step and ad gets requested but doesn't get impression. So by having low cpm i started to thing about that maybe that can be a problem.

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

    Scrollytelling on native Android?

    Posted: 30 Oct 2020 04:57 AM PDT

    There are quite a lot of websites out there that use scrolling as an element of storytelling (scrubbing through a video, pinch into images, etc.). A good example for that is this website: AirPods Pro (sorry for the Apple reference).

    For a project we're trying to accomplish something similar, but native. I haven't come across many Android related references but came up with a few options:

    Build the website and wrap it in a WebView.
    Pro: We could use it for several platforms
    Contra: I think the UX will suffer quite a bit from that. Also, we need a click interaction to trigger sound.

    Use a list (like RecyclerView) with video players and some custom views
    Pro: Native experience
    Contra: Not sure if this is feasible. f.ex. linking the video progress to scroll is either very hard or not possible after all.

    Does anyone of you already accomplished something similar or has some tips how to create such an experience?

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

    Multiple Ad Banners for every Fragment vs Single Shared Ad Banner. Revenue difference? (AdMob or others)

    Posted: 30 Oct 2020 05:55 AM PDT

    So I was curious whether it makes a difference, in terms of revenue, to show a different Ad Banner on every Fragment or if it would get the same results as just showing the same one from the Activity.

    I'm not sure if I explained myself properly:

    OPTION 1:

    Activity1->[no ad banner]

    • Fragment1->AdBanner1
    • Fragment2->AdBanner2
    • Fragment3->AdBanner3

    OPTION 2:

    Activity1->AdBanner1

    • Fragment1->(same AdBanner1)
    • Fragment2->(same AdBanner1)
    • Fragment3->(same AdBanner1)
    submitted by /u/cmlui
    [link] [comments]

    Please help devs.

    Posted: 30 Oct 2020 07:58 AM PDT

    Please help devs.

    Hi we are having a game called "The last roman village" on Google play. for the past 2 days we have all refunds and canceled transactions which is unbelievable. Mostly of them from South Africa. I also noticed that several user issued like 8 refunds which is impossible. Anyone else experience the same?

    The image shows 1 user only refunded soo many times

    https://preview.redd.it/bxltc0dxy8w51.png?width=1505&format=png&auto=webp&s=70a8c817db0e52def6dd15f50ed51910391339bd

    Thanks all

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

    LiveData in Jetpack Compose?

    Posted: 30 Oct 2020 09:57 AM PDT

    I've been reading up on the guides Android has provided for Compose and want to make sure I understand this clearly. Is it the case that LiveData/MutableLiveData is being replaced with State/MutableState in Compose? If not, when would you use one over the other and vice versa? Thanks ahead of time!

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

    I made a library alternative to CustomTabs

    Posted: 29 Oct 2020 10:33 PM PDT

    The main reason to develop this was the fact that CustomTabs needs a service provider installed in the device to launch the tabs eg: Chrome, Brave, etc.

    So I made my own version of it which uses WebView to load pages. Plus, it supports private browsing & dark mode (for API >= 29).

    Any suggestions & improvements are most welcome!

    Github

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

    AR Core Android Tutorial without Sceneform?

    Posted: 29 Oct 2020 08:05 PM PDT

    Hi everyone!

    I am new to ARCore and it seems that most tutorials I find are related to Sceneform. However, sceneform doesn't seem to be supported in the newer versions of Android Studio ( which can only mean that it is being dropped eventually ). So it would really help me if there were some tutorials on ARCore android development without Sceneform.

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

    Google Elevation APIs

    Posted: 30 Oct 2020 01:51 AM PDT

    Hello! We will have our project at Microwave Design, which one of the crucial data we need to get is the ELEVATION.

    Fortunately, Google offers such API: https://developers.google.com/maps/documentation/elevation/overview.

    But I don't really get the...

    "Pay only for what you use.

    Our pricing scales to fit your needs with no commitments, termination fees, or usage limits — and you can use mobile Maps at no charge."

    Does it mean that I will get charged ONLY for every request? or does google will charge me EVERY month? So it means that my card would not be credited unless the bulk number of requests on API happens?

    Since I will be only using this API for around 100 to 500 requests. Thank you!

    PS. Im using a python script to extract data.

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

    Have to delete .gradle every other build

    Posted: 30 Oct 2020 03:30 AM PDT

    Basically what the title says here. After updating to Android Studio 4.1 I've had to delete the .gradle folder after every other build. I get a class not found on dexpathlist error on the second build for some reason. This is with no actual code change to the project. Any suggestions here?

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

    Making A Minimalist Smartphone

    Posted: 29 Oct 2020 06:42 PM PDT

    Hi guys,

    I'm planning on making a custom ROM for android that will essentially be completely normal aside from being entirely unmodifiable. My main goal is to curb my own smartphone addiction by taking control away from my future self (making it impossible to download youtube, reddit, instagram, etc.) and seeing as how I'm very new to the backside of Android I was wondering if anyone had any tips on how I might be able to do this. Is there any specific smartphone that might be easier to modify than others? Maybe one with a notoriously straightforward root process? Is there an easier way to do this than by rooting and modifying a phone? Any and all information is welcomed.

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

    Heads up notification in android O and higher

    Posted: 29 Oct 2020 10:28 PM PDT

    How can I get a head-up notification in android O and higher here is my notification code

    private void createMarkNotification(String path) {

    long currentTime = utilityClass.GET_CURRENT_TIME();

    Intent intent = new Intent(getApplicationContext(), x.class);

    intent.putExtra(utilityClass.CONSTANT_INTENT_FOR_MAR_NOTIFICATION, path);

    intent.putExtra(utilityClass.CONSTANT_ID_FOR_MAR_NOTIFICATION, currentTime);

    PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), (int) currentTime, intent, 0);

    Notification notification = new NotificationCompat.Builder(this, xyz)

    .setSmallIcon(R.drawable.ic_launcher_foreground)

    .setContentTitle("blab blab")

    .setAutoCancel(true)

    .setDefaults(Notification.DEFAULT_ALL)

    .setPriority(NotificationCompat.PRIORITY_HIGH)

    .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorAccent))

    .addAction(R.drawable.ic_launcher_foreground, "xyz", pendingIntent).build();

    NotificationManager notificationManager = (NotificationManager)

    getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify((int) currentTime, notification);

    }

    and I'm creating a notification channel in app class

    private void createNotificationChannel() {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

    NotificationChannel channel = new NotificationChannel(CHANNEL_ID_FOR_SERVICE,
    utilityClass.NOTIFICATION_CHANNEL_NAME_FIRST, NotificationManager.IMPORTANCE_DEFAULT);

    NotificationChannel channel2 = new NotificationChannel(xyz,
    utilityClass.NOTIFICATION_CHANNEL_NAME_SECOND, NotificationManager.IMPORTANCE_HIGH);

    NotificationManager manager = getSystemService(NotificationManager.class);

    manager.createNotificationChannel(channel);

    manager.createNotificationChannel(channel2);

    }

    }

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

    Migrating the deprecated Kotlin Android Extensions compiler plugin to ViewBinding

    Posted: 30 Oct 2020 01:52 AM PDT

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel