#114 – BlrDroid BlrKotlin: April 2021 Meetup

anroidcontext, gitmessage, android11, androidr, blrdroid, meetup, androiddev, android

Похожие видео

Описание

Hello and welcome to our first online meetup.

Текстовая версия

Yeah hello everyone welcome to our first.

Online meetup which we are doing with our meetup gross be alert and be alert hotline I hope from home is going good for everybody. Love down is treating you well so just a basic level of introduction I guess. Everybody knows at Baylor drives and since this is an online meetup we would expect some likes it is always a possibility of subnet circuiting:

So please bear with us or now we have multiple sessions signed up for you and just quick comments on how to ask questions so basically: Speakers will be available here and they will present their slides you can ask the questions in the YouTube comments?

Itself and we will highlight them over the stream so there will be a limit of five questions per session but each of the.

Speakers will be will share their social contact. So basically you can contact them later if you have any counter questions or questions.

Later on so yeah we cannot really interact. So not much to say so I have with me Ryu and British. Ryu from viola Cortland and BJ's is from VL at right so we are so you guys want to say something.

Hi everyone welcome to the today's event hope everybody is fully aware. Now morning everyone oh yeah like lockdown. Is treating you well and you all are transient?

Yes we will try to miss more on online.

Event let's see how it goes great okay we can start with the posture yeah.

Okay so we start with sessions now so let me just introduce lineage in the stream. Yeah so Dinesh is Android engineer he works in go-jek and today's session!

Is about kid commit messages and how you can use them to leverage a good programming? So I will now transfer this over to Dinesh let me just remove my screen yeah okay so Dinesh can you start sharing. Your screen done can you guys see my screen yeah one second okay so your screen is now visible okay so yes remove ourselves from stream:

And then if you can start off in like five seconds.

Okay so my presentation is visible right. Yeah your presentation is visible you can start now awesome good morning guys thank you for joining us today over here and I hope foreign tiny instating you.

Well without any further delay let's jump right into how to write better commit messages I'll: Share my experience about writing commit messages and how we can leverage that for good software engineering right so yeah so first? Of all you need to think about get commit messages as a mode of communication.

Get commit messages or their to relay? Information from one developer to another developer? So it is not just any commitment.

It's a mode of communication right so to write better. Communication messages better good commit messages you need to have a shift. In your mindset so you need to every time you write a commit message and you need to tell.

Yourself that it's not about me anymore it's about us right so there's a collaborator. Mechanism so get commit messages I'm not there: To serve you but to serve others who are reading.

Your code obviously right so there are some of this common.

A developer developer conversation right so you would have heard.

About it every day in your company or in your work work work space so can you give me some back the board? Why the code is written over here and the development may ask what feature does this piece of code relate.

To and there may be one other developer who says I have no idea: Why this condition X's it seems weird so all these are relevant communications that we have no one then right so good commit: Message I can eliminate all these kind of questions that come across.

All right so now let me share. My experience about writing good commit messages and how a good structure would be all right so good commit message needs to have this.

Much information I did need to have what that commit message is for and why are we writing. The commit message for and how are we going to solve that problem that we are addressing. With that commit message and obviously more information right so that's a template.

That I would like to share with you guys. Which I work for me for a quite a long time in my experience at read bus and as well:

As in coaching so that you guys can have. Adopted as well okay so yeah so there are majorly. Three different parts of a good commit?

Message the first line which says what is the commit message about is it a fix is it a. Refactor is it a feature and there goes a title of that commit as well and then comes some explanation about?

This commit message so why is this why are we doing that and how are we going to solve a particular use. Case with that commit message it can be a bug and you can say how are we going to fix.

This back why is this bug occurring so this kind of explanation. You can give in the second part of it and obviously the third part of it can be a tracking ID like.

So some companies may use JIRA or some kind - may use asana where people can go ahead. And check more information about that commit obviously if it's a feature:

Then you can get all the details about. The feature in that JIRA or asana or if it's a bug then you may have steps like reproducing steps or what is the impact of that work.

And all those information which you cannot put inside a commit: Message you can put it you can communicate it via a tracking ID and so here is an example of a commit.

Message that we wrote in some some time? Ago right so you can see that the first line says a refactor? And optimized movie adopter for smooth scroll so the first line conveys revenge for information telling.

That okay this commit is for a refactor and what we've done over here is the optimize the movie adapter for some smooth scone and further. Down you will be able to see that the computation inside the on pant view hold was causing the frame to render. Data so these are some background about that commit myself why are we doing this and?

In the next part you'll see the looking: We are doing some tests and how can we test it so you are communicating to the one who is reading.

This commit message telling that okay if you want to do something about this commit message? You can go ahead an able GPU rendering and go to this option and you're giving some some more information. To the developer who's reading this commit message telling.

It okay these are ways that you can test for this commit and obviously the next one. Is a JIRA ID that you are giving over there.

And obviously you can login into your JIRA and go to this. Particular JIRA and see more information about why this commit was required and all everything that you need to know about this committee okay: Okay so now that we have a commit message format in place and if you are working with around twenty thirty:

Developers how can enforce uniformity that everybody will be using the commit message so there are a couple of ways to do this and. One of the ways is using git templates type so what we can do using git templates.

And so you can create a you can create a template file? And then you can link it with your git config and so that. Every time you come at you you you can be assured that you will follow the commit forever and so there are a couple.

Of ways of doing it so the first way. They can do is you can create a file called commit message dot txt and the second! Thing is you can just paste this commit message.

Structure into that commit message dot txt file. And I'll save it right and then you can execute this command which is a git config.

- if in global and commit to a template and then you path to the file that yes Piaget's so what this guy is doing. Is it is going into the git config and it is modifying a property called commit or template. And it is pointing the commit or template to the file that you just committed which means that every?

Commit that you do from now on will be following this template okay now let's see! And what happens if you try to commit after you do this following configuration right now. You just type git commit and this thing appears.

In your screen right so you can right away. See that that's a template that is pre-populated.

For you right now all you have to do is and all you all your developers.

Have to do is just edit this template and then hit the Save button that's it if it is a market to become and.

Escape : W base and that's it so the git commit is enforced throughout all the developers that have.

In your organization alright so this is a this is a way that you need.

To go but there's a caveat to this because it is a very client focused application so you need to go to every developer.

In your organization and ask them to have this coming but operations.

That can be solved by using scripts. That you can ask your developers to execute where you can write all this steps and automate this automate this as well and there are couple. Of spin-offs by following these good good strategies or what you can do is you can query and alt you can run querying and analytics.

On your gift logs right so once once you follow this template for around the three to four months at what: You can do is you can filter all your kit locks.

By success that you can ask your you can?

You can you can write a query languages can give you all the features. They have ever done in the past one month you can you can give you. All the commits that are related to say a feature in the last three months or you can also query.

For something like this what are all the factors. That I have done for the past three months so this kind of querying and analytics would be possible if you follow.

Very unified commit messages and the second spin out that is a very interesting!

Spin off right so often you hear we use crashlytics or fabric I know that it's duplicated so we use actually takes on firebase right. The whenever there's a there's a bug.

That surfaces so crashlytics will give us a give us a. Warning and it will give us a it will give us an error.

On the portal right so whatever you want to what if you want to tag that tag that. Commits to the developer who wrote this right so if you remember in the template we had packing ID right so that tracking ID can be used.

Android

And to automatically triage the crashes that! Are there in my crashlytics to the code commuters. Themselves so it will be a very awesome ated way of trying other.

Sites so an error occurs in production it comes to crashlytics and crashlytics gives the hook to your one of your servers yourself and knows! Who had actually committed and this this line of code because you can you know that by the cracking of the JIRA. Idea Algie asana ID that picometer has just used and again right away.

Cracking a tiger JIRA to detail of purpose when I said these are some of the spin-offs! And an obviously or a period of time your get logs will look very beautiful and it will not be it will not start?

With the small little 450 percentage of your crash at 50 percentage! Of your comments and it will and the. Rest starts with a capital casing so it will be pretty uniform and you look very beautiful right so these are some of the good.

Spin-offs that come up with come aboard with a good commit messages and more often more often than not we end up writing commitments.

For ourselves right so the you'll you will! Get good commit messages if you have a mind shift change right: You when you always think about okay I'm not writing.

This commit message just because I need to know what's.

Happening rather you need to have in mind that I am writing the commit message not for myself but for others? To understand what this committee is going come into the doing right so you relay as much information as possible!

In the shortest amount of time so that should be your end goal when you're writing. Commit message so you get this into your mind and the you commit messages will become.

Beautiful hit oh cool this is a very short session but I think I relayed the information! Correctly to you just like how you are going! To relay the get commit messages to your developers yep so i can be reached over twitter and linkedin.

So here are the social media accounts over here so any questions you can ping me right. Away thank you the niche for the short session all of:

Us probably use git so i guess it was useful for a lot of people so if anyone has any questions please post them into youtube. Comment and then we'll highlight them over the stream and then Danish can answer it will be - for a few seconds.

For questions okay so one question is about.

Sharing the PPD so basically we'll share the PPT later through our Twitter channels? For all of the sessions yeah the news question. You okay so yeah as far as I know there.

Is no limit to the description that you can have? And you can have it as detailed.

As possible see the more descriptive you are the more understandable your readers would?

Be can you follow the template for with it tag as well yeah obviously because: You know at the end of the day some some some companies they squash all the commits before they emerge so in that case all?

Your commit messages go for a toss right so obviously you can use this commit structure! For for things like tagging for racing merge:

Request for racing a pull request so this this this this format. Applies to everything that you can do wanna get I wish you can have Denise. It was a question so can you look?

At this frame I'm highlighting the question of the stream can you can we use emojis in the templates I mean no I don't I don't think!

You can you can obviously use whatever is on your keyboard. But not the graphical stuff yeah I was writing it in the past I wanted to have it in the past. But I was not able to do let me know let me highlight another question.

Yeah can it be done from yeah obviously it can be done from Android studio and so it can be done from. Any see this is this is the git client that you're targeting.

Right so if you set it as a global config in your gate rights whatever the client. You are using for committing be tender studio beat source tree everywhere this gets highlighted this templates this template comes into picture.

Wherever you are committing irrespective of what client you are using you can it really can be under. Studio it can be source tree it can be good crack and whatever.

It is okay so I see a lot of questions now I'm.

Gonna highlight one mode yeah and I guess the rest. You can these guys can contact you over twitter or obviously yes so this is the question what about merge commits locally. Because setting templates will be hard to enforce this pattern?

Yeah so there are two kinds of conflicts.

That you can do one is a global configuration local configuration right so when you when you see. This slide yeah so you can see that get quantity - - global: Right so if we replace that with git config - if in local then it becomes your local config H if you want project specific context.

Can do it as a local conflicting if you want for your. Entire laptop or Intel lemak to be for to follow the same template.

You can use global config it's just a simple change that you can do okay. So I guess this is enough for questions. As of now whoever has any other questions which i can see in the YouTube comments.

So please contact Denise directly on his Twitter.

And he'll be happy to answer all your questions Thank You Dinesh: For joining us and presenting the session on kid I will be yeah: Cool have a nice day okay so we are done with?

Our first session and now we are going to move to our next.

Session let me just add a minute? To the stream I am Rift everyone so should I add your screen now itself yeah you could do that.

Yeah okay okay so we'll try to that next. Session now so let me just introduce um with oh I don't think I should so probably whoever is watching already knows? Ombre so um it works as a developer advocate at Google and he is one of the earliest.

Organizers on PLA Drive so overdue um with everyone does the first time I'm using.

Stream yacht so bear with me if I make some mistakes ah and I hope everybody is taking the log down seriously. And and there's keeping safe and following all the protocols that are being discussed up today jumping straight into the topic. I want to talk about Android level so Android level is in Developer:

Preview right now as you guys all most of you guys might know. This is a good time to kind of learn about this and understand what's there.

What you might need to focus on and how your apps need to kind of adjust to the new changes! That are there so in the session this is more of an informational session than an instructional session so I'm gonna.

Point out a few things that you might need to kind of look more deeply into rather than actually giving you a lot. Of instructions on how you might want to do things I'm going to tell you what is available what might effective.

And things like that and you guys will have to go ahead and look look at the areas that interests. You and then apply back to your code or learn more about?

It so by no means this is a complete set of instructions or complete set of features. I'm trying to cover the ones which I thought might be interesting might be things that.

Will affect apps immediately without further ado let me start:

So I'm gonna start with focus areas on Android are are the overview. Of the top features that came about mostly the privacy? Changes are very important and they have some of the things that I feel will affect your apps most urgently?

Or more quickly and some of the other interesting features that you might wanna kind of apply in order. To make your app performance as well as your user experience. A lot better for your your user base so looking at Android levan:

There are many things that we actually looked at when it is about improving the whole OS itself. But about in in this bunch of things that are there: We wanted to focus a lot on the privacy aspect of it and also in terms of polishing the experience.

For end users now allocating at the timelines we are already in Developer Preview. R2 ah nearly inevitable q3 uh and this is a great time for you guys to start giving.

Us feedback in Developer Preview is basically there so that we understand as Google we get the feedback from external developers. To try out the OS and give us feedback on the changes and how that is affecting their changes some of these.

Changes act some of this feedback actually! Leads to changes in the oh is itself an example would be scopes George last year we introduced scopes storage in Android 10 and there was a lot.

Of feedback that came back to the team saying that they need to people need a little more time in order.

To it adjust their code bases to work correctly with it that's when legacy request like is the liquor legacy mode or manifest of attribute.

Was added so that people can opt out of it once beta releases start rolling out the number: Of changes that are made to the IRS's reduce on the core and the focus shifts on to stabilizing it and then the final release!

Is expected to be somewhere on q3 and so in a nutshell this is a great time for you guys to go ahead test your apps. Understand what is there understand how these API change is effective and! Then reply and then give feedback or start looking at if there are changes that can impact you start looking at how you can mitigate some.

Of these changes what you should do now is basically review the program understand the key dates and details?

In each developer preview or each release that we are having there are changes that are happening some some new features are added sometimes some features. Are removed so you want to kind of look at look at and understand what? Are the changes that has happened and and go go ahead and keep updating yourself.

With what does it available in the market today secondly test of a set up a test.

Environment or a run environment where you flash one of your devices set. Up your emulators so that you can actually go ahead start working.

With it are you set up your Android studio so download the preview tools download!

The SDK look through the setup guide to understand if there is anything new and additional that you need to do in order to get everything. Working as expected I'll learn about what's new review the privacy changes review.

Androiddev

The features and that might affect your app in the first one what I mentioned was in the first. Step what I mentioned was just under get in general understanding of the large areas of changes in the fourth.

Step is basically understand the areas that actually affect your app and you might need to make changes test your apps early. On it there might be things that you assume. So do not leave it your assumptions.

Do not leave it to just literature please go ahead and test your apps on these devices. And also we have introduced a toggle behavior.

So you can go ahead and toggle certain breaking changes ah because.

When LA in the last couple of years when we have seen AI users testing apps or other developers testing. Their apps one of the prime concerns has been there is a breaking change unless I can fix that breaking change I cannot test any further.

Into my flow so in order to mitigate that. Sort of a situation there is new in the developer option there are new tacos available for behavior.

Changes where you could go ahead and toggle off certain features which will make it work like it was in Android. 10 well then the change in level so that you can continue testing without: That breaking change affecting you anymore so please!

Take advantage of this and lastly update your app at this point in Developer!

Preview smeissen do you guys is to understand what those changes are and identify alternative ways of fixing it I wouldn't suggest you guys go ahead and! Jump change everything immediately that is because. In develop during a developer preview the system can change quite quite a lot or there are new changes introduced.

There are eight inches that might come in so wait for your changes. For the the way the the o is to actually go into the beta.

Phase before you actually start applying your changes.

It is a great time to kind of understand and figure out what. Are the other changes that you might want to kind of bring moving on I start. With the privacy changes and then jump in to look at other things that we we would be discussing so quickly jumping.

Into the privacy changes the first one I want to talk about is scope so this scope so this. Is something that what introduced in in Android in Android 10 but a lot of feedback came back for the saying that.

This was a big change and then a few mitigation steps were given so that people could opt. Out of it one of them being request. Legacy external storage flag which was given so that you can address your manifest turn.

This to address your manifest and then set it appropriately so that the app would behave like a legacy device rather than applying the scope service principles this. Was like a bypass to all the changes that were introduced in Android that was introduced. In Android L 10 now one of the things that.

We've done in Android livin is to remove this fly ball together before that let me quickly! Touch upon what our app what slope storage. Is all the power if you take the app storage that is internal.

Storage as well as external storage if you look at the external storage there as they rush there! Is the shared storage space right it'll share through the space.

If you have the permissions to read or write you have access?

To the entire file system that is what our scope storage? Wonder what the intention of bringing this about is to actually protect the apps data. As well as a user's private data with scope storage are in place as will only be able to access.

The files that they have actually written or they have explicit.

Approval from the user to access it which and for things like this also leads to another thing which is better attribution to the data. On the disk the OS by that what I mean is the OS has better understanding of what I have actually wrote this. And when an install happens what all?

Files can be removed completely now there are situations where we want to share information or rather files. Between apps and that is usually in terms of media files also there are gated stores media stores for photo video music etcetera. Which are again under media permission so you will have to request for a permission before you can access.

Data from or access data from these media stores now this was how things.

Work and for any file outside of that so you want to pick some particular file from your downloads. Folder any file from your download for that you can use a system picker and the user will have to give.

Explicit permission for the app to pick the file and then only it will be allowed this is how things.

Worked in android 10 now in android 11 with the legacy request legacy. External storage flag removed you don't have the option to opt out of this android s hope so this behavior! What and what has been introduced with Leben has been that.

There are bulk API is to make changes so if you want to delete or update a few files together then there are bulk api's for.

Accessing that in the media stone with media store if you have without. Any permission the app is able to read its own data which is any file that it had. It to the media store it could read it but for any file for all the files that are there.

In the media so like all the photos that are there added to the media! So you will have to request for the read permission once you get the read permission you're you are limited. To getting access into the into each of these media stores these third one is like I said if you want to pick a file.

You have to use a system because not third-party third-party file because if you are using third-party file because! Definitely test for scope storage impact because.

Picking a file are to view or to attach to your attach to a feature! In your application things like that will require system picanha so look for scopes or a chain:

Scope stories impact and some of these areas moving on the next one I want talk about. Is one time permission this is a new permission that has brought. In a new permission style that is brought in where you can actually like give the permission just for that.

One instance of precision by one instance what it means as if the Apple?

In the foreground or has afro ground surface if the app goes into the background then it is on the foreground the service.

Is closed then it is considered to be that that session getting over.

And the permission is off this is useful for places where you wanna give your location just once or you want to take your take? The photograph for your profile picture which is just used for sign up but you don't want to give the camera permission for the app throughout the lifecycle? Of the app right so this sort of a permission where you're just giving it only for that morning's session is quite.

Useful this is not a target SDK gated so you would really need to check your app how this is gonna have what.

Happens in users gives this in Android 11 one of the other. Things that is as a philosophy is that we don't want to nag the user by asking them to asking them?

Permissions again and again so if the user clicks deny two times that's considered to be deny and don't ask so please do understand. That asking permission should be appropriate you should provide the rationale and be very clear. About how information is shared and appropriate information shared so that user can make an informed!

Decision by giving you the permission or not moving on to service for ground-types this. Was a concept introduced in Android ten there was four spoken type for media projection and location which was which was something that.

We had set in there were other ones also defined! But they were not like they were optional like syncing data a media player.

Phone call device companion all these other types of foreground services but also provided but with location wasn't there a lot of people saw impact because that. Is a more common use case people.

Use right and on top of it uh without declaring this for grant service.

Type in your manifest for your foreground! Service you don't get the location the permission is not actually the permission is not given to care collect location for the foreground service so be this.

Change was something people had to mean in eleven we have introduced two more which is microphone and camera: So if you are having foreground services which actually use microphone or camera you will have to actually.

Add them to your manifest otherwise form those permissions are not that data. Is not pass to it if you don't add it from camera there'll. Be M no data from the sensor that goes to your app so you will get.

Null data or no from microphone there will. Be no audio that is actually passed your service then there are some changes that are there on the UI sections also for foreground. Notifications now you can actually swipe out foreground notification what:

Happens is they it actually sits in the pane if you would see at the bottom of the screen there is.

A pain called foreground services so you would you have? For your running services then your silence services and then there's a new pane for foreground. Services the ones that is swipe out do not go out of your attention it basically.

Means that they actually get added to the foreground services pane and when you click on that. Program for services pain is actually expanded back again that's what the second or third picture here is actually showing so that's um that's. Not something that will affect your app it is just that.

They users will be using it this way and you need to be aware of this as a developer ah the other thing.

With with permissions is was package visibility apps could actually right now go ahead and look for all the packages that are installed on the. Device as long as user gives them permission going further. Ah this is kind of limited we have to use a queries element.

In the manifest to are to let the system know what inform what? Apps are you looking for you could do it two ways one is that you can specifically give the package name so there.

Are legitimate use cases where you want to understand if another package. Is there or not so other app is installed so you query for that package name and then figure out whether.

The package is installed or not if it if the package details. Are not found it consider to be not installed and then you take the alternative flow this is a very? Common thing that people do it especially for things.

Like sharing directly to an app and things like that now with the limit of the package visibility restrictions coming into picture you will have. To specify those package names or you have to give an intent filter that conveys or in the query you have to give the intent filter.

That canvassing tender so it could be that you want to share. At a particular type of a particular type of file with all the apps and you're creating a custom share dialog?

So you want to know what all apps are installed which can handle. That intent you have to provide that in the query this gives the OS enough information to understand what system enough information.

To understand that when you query do you have access to read information. About those packages or not now there are instances when you have to query all the packages.

Meetup

And that is hidden under a new function or rather that is guarded. By a new permission called as query all packages and this is introduced.

In Levin so if you have a use case by which.

You need to query for all packages in the device you will then have the users new permission and the user has to provide.

This function explicitly for you ah this is a very interesting API and I think this would.

Be really useful in identifying data access issues especially. In the era where privacy is becoming really really important.

There are a lot of times that we see that apps do get penalized?

For things that their SDK is that they have added. Have been doing now there might be a private data access from an SDK that they have added.

Unfortunately the developer did not understand that or did not have any information about it they deployed it to play play policy found this. Out and then there is ramification because of that could be a suspension or a termination of the app this is quite difficult when! You have a lot of SDKs this is not very easy to understand how some of these SDKs behave and that is where:

We have introduced this new data auditing.

API by which you can identify and rectify potential unexpected data accesses so you can try to call which. Will which will then give you information about when a data access. A private data access is happening whether!

It's from your app or from your SDK of certain places you yourselves know that? Yes my app does that you can add contextual in for content contextual information there so that that logs that come.

In do clearly tell you along with the context it will be logged along with the context so that you understand. That that is a legitimate use case this this is super?

Useful it is over it is a new API I strongly advise. People to kind of try this out and especially when you have.

Apps have a lot of SDKs this is something that might be very useful to help kind of dig a little more deep into:

And can avoid a lot of potential heartaches later so summarize! The privacy changes I'm just leaving the slide in the presentation.

So that somebody can look at it and review it later I'm not gonna go through:

It again and repeat although what I have. Said but have an understanding of this look at this sheet before while you're evaluating if your app has getting impacted? By these changes or not now let's move on to some of the new features so in Developer Preview we have introduced new tools for testing and?

Debugging your app one of them is a new compatibility framework.

Developers are now able to change individual or individual features on and off so that they can continue testing.

So for example there are quite a few of these things that are available say scope storage you could turn off scope storage and then run your. App so that that particular feature is not impacting your current testing cycle but then then what again. None of these core toggles will be available in the public.

Build it will only be there for the developer profuse please. Be aware of that this is important to understand because users.

Will not be able to toggle off a certain feature and continue. Running your app and that sort of enough that sort of option is not there in the public build.

Of your voice at all all right so this is really useful this because you might be blocked: By feature say a new change one where and not allowing you to test any of the other changes so you could turn off change one and.

Then continue testing the impact of change two three and! Four and you can isolate and test individual behaviors one at a time and identify and. Identify with great accuracy what all things are impacting you so please take advantage of this feature refresh rates.

Now apps and games you you might all be aware of and you've seen many many articles. And many many articles as well as documentation? And doc doc dogs explaining why the multiple refresh rates and their impact on battery and and screen resolution and things!

Like that or screen clarity and things like that a lot of games earlier this is this was controlled. By the system this when when it felt like when it felt there is a need to kind of pump up the the.

The refresh rates it would and to to kind of Power Save it would actually lower the refresh rates for certain.

Operations now apps and games can request for choosing this refresh: Rate so and a game can say that I want to run at a ninety.

Hertz and the device can actually take take that information work with it and this can be asked.

From both an SDK office as well as from your NDK but be cautious when you use it we do profile. Or your app or your game to understand its impact when you turn on a higher refresh rate screen refresh. Rate and see whether that us and ensure this doesn't affect your users adversely the other interesting change that have seen was that um.

There is a resume on reboot sort of a thing as you might all know there are two types of encrypted stores. And Android which is that die then device encrypted storage as well. As a credential and restoration you most of you when you reboot your app if you would see that.

You have to unlock your app for all the apps to receive messages?

And things like that the table so the credential encrypted store access is something that was not there earlier. On boot unless the user for logs into the device the mess the credential store encrypted store. Is not accessible now with with the Nuge in Levin.

What has happened this what what change has been brought about is that there's an improvement for this for ot installations. So if it is over there installations which can which happen at night for.

Instance and the device reboots automatically there!

Is access to a credential so apps will be able to kind of continue to run and will see messages. With without the user immediately interacting or law or unlocking the screen and there is support for direct access for device encrypted! So is also which was there for a long time that continues to be there now there is a new a.

Vehicle for Phi G Phi G like you know is getting deployed globe in many parts of the globe or India.

We still are in the testing phases but if you're a global app you will have to understand the impact! Of this and Phi G Network the speeds of the network is really high so you want to take advantage of the improved? Speed as well as latency to maybe run a better use case or to kind of do certain!

Operations which otherwise might impact user experience if it's on a stored slow at work so use this along with the dynamic metered API as? Well as bandwidth estimated for API to kind of give better user 4x better user experience for users on Phi G so there is a new API.

Please do look through that and and see whether that how you can improve. The experience for users but for those who are on 5g networks now call screening perspective there are certain. Improvements or there are new api's this is specifically useful if your app is a has is interacting.

With this particular particular use case which is to remove spam and things like that apps can now reject a send out rejection details?

And they can also customize screen post call screen which is a system provider post called swing but you can actually customize. That information so that users can perform certain actions: The other one that you should definitely your users are not bothered about what as developers we would be excited about is Wireless ADP the command-line.

Interface are can communicate using ADB from the computer from a wireless perspective?

Earlier this was a cumbersome process of connecting your device you're using. A cable and things like that and so you have? To approve that for a particular to prove that.

Put a particular network for on your for on your device and then if your computer. Is also running on the same network you can communicate: It but you can send commands to your device by ADP maybe put fire push files in there pull.

Certain configurations out and things like that there's always a pairing tia pairing required:

Every single time and that can be done with QR code or a six digit. Number this is interesting I'm hoping that a lot of developers would be happy with seeing this from. A screen-recording perspective improve the UI there is new controls in your in the pain that actually shows that recording has started.

So the notification pane has multiple things like you wanna stop audio do you want to show that touches earlier. These settings were there but then you have to go into developer options and turn them on and off which?

Is wet compass also give your product to a main screen where it's visible the other change. Is that the notification the notification that tells!

You that ask me recording is happening is right now earlier was the system color and with options the new one will be red in color.

So that it it is clearly visible and communicating to the user the screen? Recording is happening and they will there are no options added to that anymore. Notification is free is another option that is there.

There is a dedicated place that you can actually go on and turn on the history so notifications that if swiped. Off you can actually go back and you just can go back and see that from the notification histories it's a history. Pane it's accessible by a shortcut in the notification.

Shade ah this isn't complete this is this is there whatever you right now but it's not completely polished and ready for. A beta so there might be some designs changes or some changes that you will.

See as the versions actually progress so wrap it up quickly there are plenty. Of more features that are there I think taken some of these.

Photos from 9 to 5 Google website but there. Are new things like the pain the note um the media stored pain joy media notification which actually comes in the settings.

Pane there is a battery share option up is seen there is a screen share a new new thing Bluetooth audio codec selection. There are many things new features that are available so keep reading more about this at the developer.android.com website and also. With every release that is coming out please?

Do update yourself on what has been added what is being changed and what.

Are things that are removed please don't assume that things are not good to remove or not gonna. Change so testing is required with every update of the solid with every developer preview of beta release please do test your.

Apps again it is important to be aware of these changes so that you can limit the amount of time you're testing.

Blrdroid

So read up on it figure out the changes and tear and ensure those changes don't actually affect you reiterating the timelines again we:

Are in the last phase of developer previous April is April is where we are and developed reviews are coming. The turtle previous coming to the point beta leases are about to start so the amount of changes are gonna be limited and please do tests?

Throughout the cycle so that your apps are ready for primetime and final release happens. None of your users who have the latest device with.

The latest OS are getting a bad experience from your apps and that's it from me hopefully?

This was useful like I said this is not an exhaustive list of features that are there but you really. Need to see this as a pointer to all the available things and you can jump into jump in and go in detail. For the things that you think are gonna!

Impact you or any areas that you want to study more if you have any further: Questions please ask now or follow me on Twitter. That's the easiest way to reach me if there are questions!

Please feel free to post on Twitter I would just I would be checking that very regularly. What do you think Thank You Amit yeah so we'll take questions now please put your questions on the YouTube!

Comments and I will highlight them over the stream. Okay let me start with the questions. Yeah first question of it so the solar passengers if location is allowed only once or does it matter.

Someone will try so the whole point is this is an option that the user can keep for. Tracking delivery their delivery executive would have a different app I presume that is a different app for their delivery executors!

And they can provide a location full time that option is not removed they've added a new one called as a give location only watts. Even though adding legacy permission boys is not audible on ten voice. Is not okay so that I I am not sure if I understand.

This question correctly please give me some more details offline and we can discuss this almost the next question.

I'll pack it on for now who the new already been playing ADP connect come on be required. Or the device should be connected automatically?

You will have to do bearing up front once and then it can be connected it will not automatically let you connect. From from a security perspective so there is a no initial!

The first time authentication has to be a pairing is done first and then there. Is an authentication step at every single time you want to kind of go ahead once it is authenticated then you can actually?

Continue the connection that is that is the current.

Information that I have seen things can change like I said this is Developer Preview things will will improve. So there might be some changes that will come with that might come with different. Places next question I can I can you get all the detailed description of APA and future.

Updates developer.android.com has with every development review: We are actually writing logs with links to the API as well as articles which explain these. Changes very a very much in a detailed fashion so I would suggest you to stick to developer.android.com to start with.

Right now next question for background location we have to fill up form and share more details about:

It okay this is something to do with policy and that is I can share!

The details with you offline but for policy things I'm not gonna interpret any of the policies. For the moment okay I take last question now yeah the scopes or is applied to device. Administrator apps okay this is very interesting.

Thanks for asking this I see there is a there is a different class of application that might need entire. Disk access which is like why like add device administration apps or antivirus apps or file custom file because things. Like that file managers by Edward they have a special permission that is given but that is controlled by policy.

Unless and until it is the primary purpose of the app I don't believe it will be approved this is my understanding. Of it right now it down to the policy part of it that is my understanding of it right now things might? Change because they have not been approved I know that technically.

There is a permission and that will be guarded by policy is something that is definitely be there. So the scope storage settings still do apply for all apps technically: But there are certain class of apps are can you get special privilege.

To get in there access because they are use cases demands it for an anti-virus. App that needs to look through all the files right so things like that and that's got a bit but guarded by a policy. Also so I guess is that the last question!

Jetha yeah we can take one more just one more will be awaiting. For at 9 to gender stream so I'll just highlight yeah yeah yeah like you said you we can. We can be understand the kind of data can be tracked using bounce.

Manager how's it work so it does it tells you all your data acts as part. Of it what the details I think it will be too heavy to talk about it.

Here I can share the details with you offline what I'm gonna do with. This session at least is I'm gonna.

Take all the questions that you guys are shared here I'm gonna create a trick document and? I'm going to put all the answers we will share it with the alert to all the people of who were here and using. The using our media page we will actually put all these questions and answers there some of this?

Requires me to also look through what is the change that is coming: Change that has happened and update it and that's why it would? Be best that I take some of these detailed questions offline but I will share this information.

With each one so I think that's enough for questions Amit has already told that he's available.

On Twitter so if you have any other questions you can directly contact him and yeah I'm sorry my twitter ids am Sanjeev. First two letters of my first names the entire last name am sa NJ wev i regularly post on android so in case you're? Interested follow otherwise if there are questions feel free to ask yes okay thank you for that informative section about the next.

Version of Android I'll update the stream: Now thank you thanks everyone higher than. I so yeah we will start with the next session now yes so I would like to welcome!

Adnan here at 9 works has entered India traders o Lopes Zola stage and he is also to organize around.

Red phone India so if you were there at the Canadian last year you would have met him so and then we'll: Give a session about Android context so and then let's start yeah let me she must be yeah yeah NEC yeah so I've added the screen?

To the string so over to you're mine now yeah so good morning everybody to begin with that's.

The first thing this is the first time I'm doing a remote talk at all. I'm much more physical but TAS in that sense.

If something goes wrong please do let. Me know if you have suggestions it will be more welcome to intro so today I would like to talk to you about a topic which like everybody knows.

About but nobody knows what actually is going on right right you have used you use it every day! In and out but you don't really know what do you what it really means and what it really does right context is something.

Which a lot of people get confused. And like even after the use of doing Android you still I'm not sure.

Okay what does it really matter does it not but so my motivation behind this talk was to you know.

Like you know one day I was my this was hey you know what there. Are so many types of context and I don't really.

Understand how each of them function right like yeah I can use them I can get things to work using. The right context but I don't really know why did one both.

Versus the right so that is when I started to look at what really the difference.

Is and what actually happens in donal yes but and this talk: Is basically entire summary of everything that I learned over the past that this whatever I've been through whatever?

I exploded in this in a way where and you can understand. It and make it like I have a mental. Model has to be context and what to use so we'll see we'll talk about all of those things in the slides!

So let me dig you know by something simple right very very simple what is context right.

If somebody asked me that question I would say it is pure magic because I don't. Know anything that I want to do in Android which requires. A context I pass it and it does it gets done I don't need to think about it twice but yeah that is what!

I would describe it as but in actual reality context is. Basically a global state of information of your application at any given point.

Of time I'm pretty sure you have heard of this a lot of times in the past you have probably? Tried to find more but there is not much of there in terms of context.

Related info while it is true that it is just a straight of your current application but there are different! Types of context right like context as a whole is not the same like there is an application.

Context there is an activity context which you have.

So context basically is think of it as a state of information for you based on different! Levels of the application so think of application level as state of information.

Global state of information where as at an activity level you would be restricting it to that.

Particular screen you will see how that. Makes a difference and why is that difference important as well so even before we go there right why! Do you even need the pen text.

You have to access resources that is context is going to help you do that you want a sense of your application:

Context again if you want to access a system service which is like a Wi-Fi a manager vibration control notification service all of those. Things you still use the context to get access. To it you can do read file paths and this you could start activities services broadcast using the context as well so any component.

Basically that Android has is done in started using the context looking at this what you can figure out already. By now is context is required for majorly.

Two things one is accessing components and elements of Llorona and it also is required to access. Components and stuff of other apps as well so let's say you want to communicate to a secondary app you will be context!

Let's say you want to access the operating system.

Level service right click over manager service you would still need context so basically context is the communication layer between different components: Between your own within your app and outside your app as well so that is why you would need context I'm pretty.

Sure you use these on a day to day basis activity start services and broadcasts.

Just like that so that is what context provides in terms of functionality to begin with so coming to that question! Right like there are so many types of context you have application context you have something called!

As the activity context you have something called. As piece context that is there as well then you have something called theme context.

You have the very famous this you could do a distort and a lot of things. Work with that is there's either not so famous that so yeah what I mean to say is there are.

So many types that it is very easy. To get confused right which to use when to use how do I even start making.

Sense of all of these and why are there so many contexts.

To begin with like why couldn't it not be we could just have? One context and just get done with it right so in reality there. Are the type of contexts that actually matter as a developer to you I just two types one is UI context and the second!

Is a non UI context so what are you to say why this is all the all these contexts which. We saw previously can largely be grouped: As a UI 10 text or non UI context so we'll look at what the difference.

Between UI and on your context is but ideally remember this you only as a developer you only care about whether it is you a context. Or a non UI context to begin. With even before we kind of try to get into a context and on you attend X let's quickly look at what.

The class hierarchy looks like like like I was very curious to understand what implementation looks like? What happens where so you have a base classes the context class this is an abstract?

Class no implementation at all context wrapper exchange the context. Class again no implementation does not really. Give much out and then you have application:

Class the service class the context team wrapper which extend the context tracker. So the application and the service class your extend the context wrapper and not the context theme wrapper.

And an extreme wrapper is basically where the first set of implementation starts coming into picture but what is happening is the vanishing wrapper. Has some functions which are worried and shaky they get resources get theme and all of those things and your most favorite component activity exchange.

Depends context theme wrapper so with this in mind this is just don't get hook on the details I showed you this thing! Just to help you understand the hierarchy because now when you when we talk about you and on your context. You will start to realize what I mean by you and on your context so the context class and the context that were in by themselves are non.

UI context they do not have anything to do with theming or this so as per the biggest diagram your. Application class and the service class instances? Are non UI context whereas context team wrapper is a UI context because it has information related!

To theme think of it as your UI context is nothing but the regular context with your application! Theme on top of it so this enforces. That your themes are basically it gives you theming.

For all your views and stuff so when text you eigen. Text is just that it is as simple as that now that you know like you know the difference between what I'm going to say between UI context and on. Your context let's see how you would you differentiate what how so I know your person immediately right how does it make.

A difference like what difference does it make if theme is there not there so as I said your conditions just going to express. Your theme the theme which you define in your manifest will automatically be picked!

By the system if you provided a UI context! If you do not provide a UI context let's say you provide it a non-void context what. Is going to happen is your theme is going to be.

Known and the system default theme by the OS is going to be picked so let's look at how you can what you all ways you can get. Hold of this UI context right so the very first obvious one is activity you can do this this will return!

You the instance of the activity and that is a UI context sprite because it exchanged the context trap of theme. Wrapper on the fragment you would call something like get context and it would still give.

You back the activity context this is assuming that this factor into fragment using a fragment transaction manager and the and you didn't?

Create the fragment or just by any other means on any view you could to get context.

And it will give you back the UI a related context as well one caveat though. That you need to keep in mind here is you can create views programmatically and when you say let's say there's an exam a simple. Example say takes you new textview is equals to new textview you pass in this most of the times but what you could.

Also was in is the application context instead of the activity context so what you just. Did there was you created a view but passed in the application context to it and then after that if you call get context.

What is going to be returning to you is the application context. And not w UI context so you effectively have a non UI context on the view if based on the view was created.

For you similarly let's look at what non-ui context basically means for you right. How you access the non-ui parts of it so in the activity i mean you could just call get application context. Or get application that would return to you the application global application context this is a non UI context.

Because it does not really have anything to do with your UI or theming. Or new types of within a service.

You could also call get application context or this Middletons the instance. Of the service and as we saw the service? Basically we exchanged the context wrapper and not the context theme wrapper so what happens is it has no information related.

To basically anything to do with your theming. Or UI and it makes sense as well right.

Like as a service there is no way you can do anything related to the you Eric!

Your services are supposed to be background long learning. Tasks so make sense that you don't.

Have to this is a non UI context to begin with well you would get access to a context object from anywhere it could! Be activity is this I mean you could do or don't get application on context on that object and it will.

Return you back the global context which we just booked off so first receiver itself! Does not have a context as such so when you get on in on receive.

When you get to pull back the context?

Is being passed field so basically what happens here is you broadcast receiver: Is not really capable of having the context of its own but it is just being passed to you which. You can use we'll look at more details of this broadcast receiver:

Because it is a very interesting and like a special type of context. That gets passed to it in this as well by now we are already thinking right like does it really. Matter UI non-ui context how did why do I care like I could!

Pass by either of them and yet everything:

Still works for me and you would probably be right in saying that to be honest like most of the cases. What is going to happen is if you pass a application on UI context. To a UI based context there is not much that is going to bring it is not going.

To crash first of all it is not going to create any. Problems or throw an exception or anything but it the way each of these context works and the amount of flexibility. And accessibility and the control and power these contexts have is slightly!

Different I say slightly because most of them majority of the. Tasks with a regular context new UI or non UI but there are special.

Things that o UI context can do you which application in context cannot. And vice-versa as well so we'll look at a few of them as so how does it make a difference so let's try to understand which context should you use.

And like you know why would you use a particular context this is something?

Later why not just stick to one context? Right so let's look at something very simple? Right the application context we have only used this everywhere in our app like you know application can get application context?

You do it to initialize a lot of things all of those things are there so application context in itself is a singleton?

Instance within the same process what this means is it is a singleton across your app if you have a single process.

If you have multiple processes then there are two application context separate kind instances which are with different?

Processes in total so since this is a singleton instance what happens is you calling gate application context from anywhere across. The app on any object which always written. You the same instance this is one single.

Engine which is stored across your entire application lifecycle so irrespective? Of how many times you call it or from where you call it it is still going to return you the exact same instance. And with that same set of information this as we already know is a non UI pin text because this is long-lived it does not have anything.

To do with UI or theming to begin with Plus this context is going to the: Entire application does not depend on any of the lifecycle of any of your other components the only thing it depends on is. The actual app lifecycle itself apart from that it does not really care where:

You use it from where you pull it from you will be able to access it pretty much everywhere even think of there as let's look at what. This activity or service context is right like this is within. Your activity or the service you get access to a context as well what does that look!

Like so every time you have this it is a unique instance for activity or post service for that matter so what I'm going. To say it is unique instances let's say. You create two instances of the same activity in at two different time points of time the context.

You can just fake it index or do this and you'll get back the context object the the two context objects which?

You got back will be different because. They are very unique instances created at an activity or a service level so every time you spin off a new activity a context.

Implementation is created along with it and that provides the actual context. Object put so one thing to remember here is this is not unlike our application: Context which is long-lived and does not care where it is created where.

It is being done this is very specific to that duty or the service which.

You are trying to access it from and is unique. To only that active your service you cannot access this context? Outside of this activity side cycle or this.

Services life cycles you can in a way if you show references but that would that context would still be pointless because it would not be active with:

The screen or the services no longer active as well the way you would access it is call this and!

You should get access to both of them the activity context. Which will be which you get in return when you click.

On this when you call this will get context is a UI context because if you remember? The context team wrapper is the parent for this it will be e class and context team wrapper. Is our UI context which has UI anything related changes so this is a UI context.

But me as the service as we saw open is not the context. Theme wrapper but he exchanged the context wrapper engine I guess unknown UI context and as I have. Already mentioned it does not really make.

Sense for the service to have UI related context: Because there is not any UI element to the service that you could play around.

With so coming to the broadcastreceiver context right as I told this is not really a context of context context of its own like: How we have with activity services and application broadcastreceiver context is a little special where?

And it is being passed to it in onreceive where every time you call and get a new on receipt being called. A new unique instance for always being possible.

So if the same broadcast receiver is fired at multiple points of time the context. Object which you receive will be unique and different from the previous one which you had so it is being pass through. It as an argument so yeah this is also unknown you a context because you can't really do anything?

UI related in numbers receiver so this is again on your context! Does not have anything to do with the new theming or the UI part of it what is special.

About this context is you get something called as receiver!

Restricted context what this is is a type of context but it has everything that the regular context! Would have but there are two methods which are disabled.

Like the those being the register receiver and buying service I mean really sure it is very obvious as to why this! Is there because you kind of it would be infinite loop right if I keep. Resisting receivers within the fever's on the sea so yeah and you can't really buy into a service from onreceive.

Дополнительные материалы

Хештеги:
Поделиться или сохранить к себе:
Моя Мотивация