urchin zhou
urchin zhou

Reputation: 33

Why androidx.security.crypto.MasterKeys is deprecated?

In the android developer's docs reference,here is the url androidx.security.crypto.MasterKeys

I found the MasterKeys class is deprecated and advise to use MasterKey.Builder to work with master keys.

But when i refer to the source code of "MasterKey.Builder" and found that it still call MasterKeys in the end.

I'm confused, why MasterKeys is deprecated but still worked.

Upvotes: 3

Views: 4197

Answers (3)

Robert
Robert

Reputation: 42798

An API that is marked deprecated means that it should not be used because it will be most likely removed in the future.

Until the deprecated API has been removed (this can take months or even years) it can be used as before without problems. So not using the deprecated API means that you are prepared for the future.

If you don't want to switch to a different API, you can still use the deprecated API until it has been removed, however when you upgrade to a version that has the API removed you have to adapt your code as compilation breaks. However if you now switch to the new API you are fine and don't have to worry when upgrading the library the next time.

Upvotes: 2

vicente esparza
vicente esparza

Reputation: 171

Only actualice the implementation library at your build.gradle app inside dependencies with the newer version, at this time is:

implementation "androidx.security:security-crypto:1.0.0-rc04"

implementation "androidx.security:security-identity-credential:1.0.0-alpha02"

https://developer.android.com/jetpack/androidx/releases/security

Upvotes: 0

rCr_BD
rCr_BD

Reputation: 11

That deprecated class and new class object are basically the same. The latest one follows the builder pattern instead of the constructor for creating a new object of that class. Please give a read this answer https://stackoverflow.com/a/29881683/10436885

Upvotes: 0

Related Questions