Saving Data on Android


Dele/ng a file from external storage



Download 19,28 Mb.
Pdf ko'rish
bet33/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   29   30   31   32   33   34   35   36   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Dele/ng a file from external storage
Insert the following code into 
deleteNote
 in the 
ExternalFileRepository.kt
 file:
return
 isExternalStorageWritable() && 
noteFile(fileName).delete()
The first part of the condition checks if the external storage can be written to or 
altered; the second part, if the first condition is true, returns the result of deleting 
the file. This way, you can be sure that the file will be deleted only if you can 
manipulate external storage.
Saving Data on Android
Chapter 1: Using Files
raywenderlich.com
31


Securing user data with a password
Security is important for the credibility of your app, especially when it comes to 
securing users’ private data. Storing data on external storage allows the data to be 
visible to other apps. That’s why, as a general rule, it’s advised to avoid using 
external storage. Or at least doing so, without a strong security system and 
encryption.
You can prevent users from installing apps on external storage altogether. Even 
when an app-only uses internal storage, having it installed on external storage could 
allow user to copy your app binary and data. To prevent users from installing the app 
on external storage you can add 
android:installLocation
 with a value of 
internalOnly
 to the manifest file.
Another best practice you can use to enhance your app’s security is to prevent the 
contents of the app’s private data directory from being downloaded with 
adb 
backup
. You do this by setting the 
android:allowBackup
 attribute to 
false
 in the 
manifest file. This overrides the default value of 
true
.
Although these are good strategies to use to secure your app’s files, the user can 
undermine them if the device is compromised or rooted. Even the built-in disk 
encryption is ineffective if the device is not secured with a lock screen.
One way to secure your data beyond the best practices listed above is to encrypt the 
files before writing them to the external file system with a user-provided password.

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   29   30   31   32   33   34   35   36   ...   292




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish