SlideShare a Scribd company logo
1 of 25
Third-party App
Stores on Android
Raipur
Agenda
1. App stores
2. Third-party app stores
3. Building an app store
4. Q/A
App Stores
Raipur
App Stores
● Digital distribution/hosting platform for software
● Provides users with a catalogue to browse & install software
● Allows updating software already installed
● Shares information about the software being distributed
● Optionally allows you to purchase software
Google Play
● Primary first-party app store and
repo
● Developed & distributed by Google
● Privileged system app, present on
all Android devices
● Allows users to purchase software
& related content/services
Other App Stores
● Amazon’s Amazon Appstore
● Samsung’s Galaxy store
● Huawei’s AppGallery
Third-party App
Stores
Raipur
Third-party App Stores
● Alternate distribution platform for software than the bundled
one in OS
● Uses either an existing repo or self-hosted
● Access to same system APIs as first-party app store is limited
or absent
F-Droid
● FOSS-only android app
distribution platform
● Maintains owns repo and
client app
● Can work with privileged
system APIs via extension
● 3k+ stars on
GitHub/GitLab
Aurora Store
● Alternative FOSS client to
Google Play
● Uses repo hosted by Google
Play to distribute same apps
● Can work with system APIs via
SU privileges or third-party
installers
● 1.5k+ stars on GitLab
Other App Stores
● Droid-ify
● Neo-Store
Building an App
Store
Raipur
Pre-requisites
● Must have an existing repo source
● Familiarity with system APIs will be a plus
Displaying Apps
● Present relevant apps on home screen
● Allow to search for specific apps
● Divide and allow browsing apps by categories
● Present all required information about app
○ Description, supported Android version
○ Permissions and data shared
○ Screenshots, reviews and other relevant information
● Optionally consider supporting opening repo links within app
Downloading Apps
● Apps can be either single APK, split-APK and might depend upon
shared libs
● Apps can be downloaded easily using either DownloadManager API
or WorkManager
● DownloadManager API is simple but allows less configuration
● WorkManager can be configured to download and trigger app
installation as required
private suspend fun downloadFile(request: Request): Result {
return withContext(Dispatchers.IO) {
val requestFile = File(request.filePath)
try {
requestFile.createNewFile()
URL(request.url).openStream().use { input ->
requestFile.outputStream().use {
input.copyTo(it, request.size).collectLatest { p -> onProgress(p) }
}
}
// Ensure downloaded file exists
if (!File(request.filePath).exists()) {
Log.e(TAG, "Failed to find downloaded file at ${request.filePath}")
notifyStatus(DownloadStatus.FAILED)
return@withContext Result.failure()
}
return@withContext Result.success()
} catch (exception: Exception) {
Log.e(TAG, "Failed to download ${request.filePath}!", exception)
requestFile.delete()
notifyStatus(DownloadStatus.FAILED)
return@withContext Result.failure()
}
}
}
Installing Apps
● Apps can be installed on Android devices using either Native or
Session Installer
● Intent-based installer uses Intent based installation but is
legacy and has been deprecated
● PackageInstaller is the new & default installer, allows more
granular control over the install and after install process
including updates
Intent-based Installer
● Native Installer remained default till Android 4.4
● Apps can be installed using ACTION_INSTALL_PACKAGE Intent
● ACTION_VIEW can also be used with data and type set as
"application/vnd.android.package-archive"
● Other flags can be specified as per convenience such as
EXTRA_NOT_UNKNOWN_SOURCE, EXTRA_INSTALLER_PACKAGE_NAME, etc
● It has been deprecated in favour of Session Installer
private fun xInstall(file: File) {
val intent: Intent
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent = Intent(Intent.ACTION_INSTALL_PACKAGE)
intent.data = getUri(file)
intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or
Intent.FLAG_ACTIVITY_NEW_TASK
} else {
intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.fromFile(file),
"application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true)
intent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, context.packageName)
context.startActivity(intent)
}
PackageInstaller
● Introduced on Android 5.0 and is now the default installer
● Allows installing APKs, Split-APKs, Shared libraries and more
● Developer creates a session, sets required information and flags
● Once ready, the session can be committed to the system
fun install(packageName: String, files: List<Any>) {
val packageInstaller = context.packageManager.packageInstaller
val sessionParams = SessionParams(SessionParams.MODE_FULL_INSTALL).apply {
setAppPackageName(packageName)
if (isOAndAbove()) {
setInstallReason(PackageManager.INSTALL_REASON_USER)
}
if (isNAndAbove()) {
setOriginatingUid(android.os.Process.myUid())
}
if (isSAndAbove()) {
setRequireUserAction(SessionParams.USER_ACTION_NOT_REQUIRED)
}
if (isTAndAbove()) {
setPackageSource(PACKAGE_SOURCE_STORE)
}
if (isUAndAbove()) {
setInstallerPackageName(context.packageName)
}
}
val sessionId = packageInstaller.createSession(sessionParams)
val session = packageInstaller.openSession(sessionId)
xInstall(sessionId, session, packageName, files)
}
fun xInstall(sessionId: Int, session: PackageInstaller.Session, packageName: String, files: List<Any>) {
files.forEach {
context.contentResolver.openInputStream(it)?.use { input ->
session.openWrite("${packageName}_${System.currentTimeMillis()}", 0, -1).use {
input.copyTo(it)
session.fsync(it)
}
}
}
val callBackIntent = Intent(context, InstallReceiver::class.java).apply {
action = InstallReceiver.ACTION_INSTALL_STATUS
setPackage(context.packageName)
putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, packageName)
addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
}
val flags = if (isSAndAbove())
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE else
PendingIntent.FLAG_UPDATE_CURRENT
val pendingIntent = PendingIntent.getBroadcast(
context,
sessionId,
callBackIntent,
flags
)
Log.i("Starting install session for $packageName")
session.commit(pendingIntent.intentSender)
session.close()
}
Android 14
● Multiple new APIs for PackageInstaller for better install and
updates process
● requestUserPreapproval() method to request install approval
before downloading apps
● setRequestUpdateOwnership() to claim responsibilities for future
updates without asking for confirmation
● commitSessionAfterInstallConstraintsAreMet() method allows to
constraint installs to not disrupt users
Q/A
Raipur
Thank You

More Related Content

Similar to Third-party App Stores on Android.pptx.pdf

Android tutorial
Android tutorialAndroid tutorial
Android tutorialmaster760
 
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopJava Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopKasun Dananjaya Delgolla
 
Kotlin for Android App Development Presentation
Kotlin for Android App Development PresentationKotlin for Android App Development Presentation
Kotlin for Android App Development PresentationKnoldus Inc.
 
Android Basic Tutorial
Android Basic TutorialAndroid Basic Tutorial
Android Basic TutorialSmartmonk
 
Delegating user tasks in applications
Delegating user tasks in applicationsDelegating user tasks in applications
Delegating user tasks in applicationsFriedger Müffke
 
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)Ron Munitz
 
Android App Development - 01 Introduction
Android App Development - 01 IntroductionAndroid App Development - 01 Introduction
Android App Development - 01 IntroductionDiego Grancini
 
Build and release iOS apps using Fastlane tools
Build and release iOS apps using Fastlane toolsBuild and release iOS apps using Fastlane tools
Build and release iOS apps using Fastlane toolsWise Engineering
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentalsAmr Salman
 
Pertemuan 13 - Shared Preferences and Settings - Word - Salin.pdf
Pertemuan 13 - Shared Preferences and Settings - Word - Salin.pdfPertemuan 13 - Shared Preferences and Settings - Word - Salin.pdf
Pertemuan 13 - Shared Preferences and Settings - Word - Salin.pdfHendroGunawan8
 
"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3Tadas Jurelevičius
 
Scoped storage in android 10 all you need to know
Scoped storage in android 10  all you need to knowScoped storage in android 10  all you need to know
Scoped storage in android 10 all you need to knowRobertJackson147
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
Understanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitUnderstanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitPascal Rapicault
 
Android development session
Android development sessionAndroid development session
Android development sessionEsraa Ibrahim
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial pptRehna Renu
 

Similar to Third-party App Stores on Android.pptx.pdf (20)

Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Java Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development WorkshopJava Meetup - 12-03-15 - Android Development Workshop
Java Meetup - 12-03-15 - Android Development Workshop
 
Kotlin for Android App Development Presentation
Kotlin for Android App Development PresentationKotlin for Android App Development Presentation
Kotlin for Android App Development Presentation
 
Android Basic Tutorial
Android Basic TutorialAndroid Basic Tutorial
Android Basic Tutorial
 
Delegating user tasks in applications
Delegating user tasks in applicationsDelegating user tasks in applications
Delegating user tasks in applications
 
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)The Ultimate Android Security Checklist (AnDevCon Boston 2014)
The Ultimate Android Security Checklist (AnDevCon Boston 2014)
 
Basic Android
Basic AndroidBasic Android
Basic Android
 
Android App Development - 01 Introduction
Android App Development - 01 IntroductionAndroid App Development - 01 Introduction
Android App Development - 01 Introduction
 
Build and release iOS apps using Fastlane tools
Build and release iOS apps using Fastlane toolsBuild and release iOS apps using Fastlane tools
Build and release iOS apps using Fastlane tools
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
Pertemuan 13 - Shared Preferences and Settings - Word - Salin.pdf
Pertemuan 13 - Shared Preferences and Settings - Word - Salin.pdfPertemuan 13 - Shared Preferences and Settings - Word - Salin.pdf
Pertemuan 13 - Shared Preferences and Settings - Word - Salin.pdf
 
"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3"Android" mobilių programėlių kūrimo įvadas #3
"Android" mobilių programėlių kūrimo įvadas #3
 
Scoped storage in android 10 all you need to know
Scoped storage in android 10  all you need to knowScoped storage in android 10  all you need to know
Scoped storage in android 10 all you need to know
 
Migrating JavaME Apps to Android
Migrating JavaME Apps to AndroidMigrating JavaME Apps to Android
Migrating JavaME Apps to Android
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Understanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profitUnderstanding and extending p2 for fun and profit
Understanding and extending p2 for fun and profit
 
Securing android applications
Securing android applicationsSecuring android applications
Securing android applications
 
Android development session
Android development sessionAndroid development session
Android development session
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
 

Recently uploaded

247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 

Recently uploaded (20)

247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 

Third-party App Stores on Android.pptx.pdf

  • 1. Third-party App Stores on Android Raipur
  • 2. Agenda 1. App stores 2. Third-party app stores 3. Building an app store 4. Q/A
  • 4. App Stores ● Digital distribution/hosting platform for software ● Provides users with a catalogue to browse & install software ● Allows updating software already installed ● Shares information about the software being distributed ● Optionally allows you to purchase software
  • 5. Google Play ● Primary first-party app store and repo ● Developed & distributed by Google ● Privileged system app, present on all Android devices ● Allows users to purchase software & related content/services
  • 6. Other App Stores ● Amazon’s Amazon Appstore ● Samsung’s Galaxy store ● Huawei’s AppGallery
  • 8. Third-party App Stores ● Alternate distribution platform for software than the bundled one in OS ● Uses either an existing repo or self-hosted ● Access to same system APIs as first-party app store is limited or absent
  • 9. F-Droid ● FOSS-only android app distribution platform ● Maintains owns repo and client app ● Can work with privileged system APIs via extension ● 3k+ stars on GitHub/GitLab
  • 10. Aurora Store ● Alternative FOSS client to Google Play ● Uses repo hosted by Google Play to distribute same apps ● Can work with system APIs via SU privileges or third-party installers ● 1.5k+ stars on GitLab
  • 11. Other App Stores ● Droid-ify ● Neo-Store
  • 13. Pre-requisites ● Must have an existing repo source ● Familiarity with system APIs will be a plus
  • 14. Displaying Apps ● Present relevant apps on home screen ● Allow to search for specific apps ● Divide and allow browsing apps by categories ● Present all required information about app ○ Description, supported Android version ○ Permissions and data shared ○ Screenshots, reviews and other relevant information ● Optionally consider supporting opening repo links within app
  • 15. Downloading Apps ● Apps can be either single APK, split-APK and might depend upon shared libs ● Apps can be downloaded easily using either DownloadManager API or WorkManager ● DownloadManager API is simple but allows less configuration ● WorkManager can be configured to download and trigger app installation as required
  • 16. private suspend fun downloadFile(request: Request): Result { return withContext(Dispatchers.IO) { val requestFile = File(request.filePath) try { requestFile.createNewFile() URL(request.url).openStream().use { input -> requestFile.outputStream().use { input.copyTo(it, request.size).collectLatest { p -> onProgress(p) } } } // Ensure downloaded file exists if (!File(request.filePath).exists()) { Log.e(TAG, "Failed to find downloaded file at ${request.filePath}") notifyStatus(DownloadStatus.FAILED) return@withContext Result.failure() } return@withContext Result.success() } catch (exception: Exception) { Log.e(TAG, "Failed to download ${request.filePath}!", exception) requestFile.delete() notifyStatus(DownloadStatus.FAILED) return@withContext Result.failure() } } }
  • 17. Installing Apps ● Apps can be installed on Android devices using either Native or Session Installer ● Intent-based installer uses Intent based installation but is legacy and has been deprecated ● PackageInstaller is the new & default installer, allows more granular control over the install and after install process including updates
  • 18. Intent-based Installer ● Native Installer remained default till Android 4.4 ● Apps can be installed using ACTION_INSTALL_PACKAGE Intent ● ACTION_VIEW can also be used with data and type set as "application/vnd.android.package-archive" ● Other flags can be specified as per convenience such as EXTRA_NOT_UNKNOWN_SOURCE, EXTRA_INSTALLER_PACKAGE_NAME, etc ● It has been deprecated in favour of Session Installer
  • 19. private fun xInstall(file: File) { val intent: Intent if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { intent = Intent(Intent.ACTION_INSTALL_PACKAGE) intent.data = getUri(file) intent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK } else { intent = Intent(Intent.ACTION_VIEW) intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true) intent.putExtra(Intent.EXTRA_INSTALLER_PACKAGE_NAME, context.packageName) context.startActivity(intent) }
  • 20. PackageInstaller ● Introduced on Android 5.0 and is now the default installer ● Allows installing APKs, Split-APKs, Shared libraries and more ● Developer creates a session, sets required information and flags ● Once ready, the session can be committed to the system
  • 21. fun install(packageName: String, files: List<Any>) { val packageInstaller = context.packageManager.packageInstaller val sessionParams = SessionParams(SessionParams.MODE_FULL_INSTALL).apply { setAppPackageName(packageName) if (isOAndAbove()) { setInstallReason(PackageManager.INSTALL_REASON_USER) } if (isNAndAbove()) { setOriginatingUid(android.os.Process.myUid()) } if (isSAndAbove()) { setRequireUserAction(SessionParams.USER_ACTION_NOT_REQUIRED) } if (isTAndAbove()) { setPackageSource(PACKAGE_SOURCE_STORE) } if (isUAndAbove()) { setInstallerPackageName(context.packageName) } } val sessionId = packageInstaller.createSession(sessionParams) val session = packageInstaller.openSession(sessionId) xInstall(sessionId, session, packageName, files) }
  • 22. fun xInstall(sessionId: Int, session: PackageInstaller.Session, packageName: String, files: List<Any>) { files.forEach { context.contentResolver.openInputStream(it)?.use { input -> session.openWrite("${packageName}_${System.currentTimeMillis()}", 0, -1).use { input.copyTo(it) session.fsync(it) } } } val callBackIntent = Intent(context, InstallReceiver::class.java).apply { action = InstallReceiver.ACTION_INSTALL_STATUS setPackage(context.packageName) putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, packageName) addFlags(Intent.FLAG_RECEIVER_FOREGROUND) } val flags = if (isSAndAbove()) PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE else PendingIntent.FLAG_UPDATE_CURRENT val pendingIntent = PendingIntent.getBroadcast( context, sessionId, callBackIntent, flags ) Log.i("Starting install session for $packageName") session.commit(pendingIntent.intentSender) session.close() }
  • 23. Android 14 ● Multiple new APIs for PackageInstaller for better install and updates process ● requestUserPreapproval() method to request install approval before downloading apps ● setRequestUpdateOwnership() to claim responsibilities for future updates without asking for confirmation ● commitSessionAfterInstallConstraintsAreMet() method allows to constraint installs to not disrupt users