Access media files from shared storage | Android Developers

文章推薦指數: 80 %
投票人數:10人

On devices that run Android 10 (API level 29) and higher, these files are ... You can read the contents of this synthetic volume, but you cannot modify the ... Platform AndroidStudio GooglePlay Jetpack Kotlin Docs Games Language English BahasaIndonesia Español–AméricaLatina Português–Brasil 中文–简体 日本語 한국어 Signin Documentation Overview Guides Reference Samples Design&Quality Platform AndroidStudio GooglePlay Jetpack Kotlin Docs Overview Guides Reference Samples Design&Quality Games AppBasics Introduction BuildyourfirstappOverviewCreateanAndroidprojectRunyourappBuildasimpleuserinterfaceStartanotheractivity Appfundamentals AppresourcesOverviewHandleconfigurationchanges LocalizationLocalizeyourappTestyourappwithpseudolocalesUnicodeandinternationalizationsupportLanguageandlocaleresolutionComplexXMLresources ResourcetypesOverviewAnimationColorstatelistDrawableLayoutMenuStringStyleFontMoretypes AppmanifestfileOverview Devices DevicecompatibilityOverviewScreencompatibilityoverviewSupportdifferentpixeldensitiesSupportdisplaycutoutsDeclarerestrictedscreensupport MultipleAPKsupportOverviewCreatemultipleAPKsfordifferentAPIlevelsCreatemultipleAPKsfordifferentscreensizesCreatemultipleAPKsfordifferentGLtexturesCreatemultipleAPKswithseveraldimensionsSupportdifferentlanguagesandculturesSupportdifferentplatformversionsFiltersonGooglePlay Tablets,largescreens,andfoldablesGetstartedwithlargescreens BuildresponsiveUIsSupportdifferentscreensizesNavigationforresponsiveUIsMigrateyourUItoresponsivelayoutsActivityembeddingMulti-windowsupportInputcompatibilityonlargescreens BuildforfoldablesLearnaboutfoldablesMakeyourappfoldawareTestyourapponfoldables WearGetstartedPrinciplesofWearOSdevelopmentUpgradetothelatestversionofWearOSWearOSversusmobiledevelopmentSetupJetpackComposeonWearOSUseJetpackComposeonWearOSWearOSdeveloperpathwayOngoingActivitiesWearOSuserinterfaceTilesExposedatatocomplications GettingstartedCreateandrunawearableappDebugaWearOSappCaptureWearUIscreenshotsAppearinRecentsandAppResume OverlaysOverviewUsetheWearUIlibraryHandledifferentwatchshapesScreenoptionsCreatelistsNavigationExitfullscreenactivitiesonWearShowconfirmationsPlayingaudioonwearablesWetmodeKeepyourappvisibleonWearAuthenticationStandaloneapp NotificationsNotificationsonWearOSBridgingoptionsfornotifications HandlingdataSendandsyncdataonWearOSNetworkaccessandsynconWearOSAccesstheWearableDataLayerTransferassetsSendandreceivemessagesHandledatalayereventsSyncdataitemswiththeDataLayerAPIRequestpermissionsDetectlocation UserinputPhysicalbuttonsRotaryinputCreateinputmethodeditorsinWearVoice WatchFaceStudioWatchFaceStudioKeyboardshortcutsManageaWatchFaceStudioprojectCreateawatchfacewithWatchFaceStudioBuildcomplicationsinWatchFaceStudioTagexpressionsLanguagesettingsAlways-oninWatchFaceStudioGyroeffectsBuildanduploadfromWatchFaceStudioTestyourwatchfaceFAQ HealthservicesOverviewActivedataandexercisePassivedataupdatesUsesyntheticdataprovidersHealthPlatformAPI DesignIntroductionDesignprinciplesGettingstartedInteractiontypesNotificationsComplicationsTilesOverlaysOngoingactivitiesConfirmationoverlayDisconnectionindicatorsPermissionmessagesSelectioncontrolsLaunchandlatencyNavigationPermissionsSigninHardwarebuttonsColorTypographyIconsDownloads ComponentsWearMaterialThemingButtonsChipsTogglechipsCardsListsCurvedtextsSwipetodismissScrollindicatorsPickersPageviewersSlidersProgressindicator CreatingwatchfacesOverviewDesignwatchfacesBuildawatchfaceserviceDrawwatchfacesWatchfacecomplicationsAddingcomplicationstoawatchfaceCreatinginteractivewatchfacesProvideconfigurationactivitiesAddresscommonissuesImproveperformacewithhardwareaccelerationOptimizeperformanceandbatterylifeWearappqualityPackageWearOSappsDistributetoWearOSCreateWearOSappsforChinaWearOSreleasenotes AndroidTVOverview BuildTVAppsOverviewGetstartedwithTVappsAndroidXTVlibrariesHandleTVhardwareManageTVcontrollersBuildTVlayoutsOn-screenkeyboardCreateTVnavigationBestpracticesfordrivingengagementonGoogleTV BuildTVplaybackappsOverviewCreateacatalogbrowserProvideacardviewBuildadetailsviewUseLeanbacktransportcontrolsPlaybackcontrolsonTVDisplayaNowPlayingcardAddaguidedstepIntroducefirst-timeuserstoyourappEnablebackgroundplaybackAudiocapabilitiesManageframerates HelpusersfindcontentonTVOverview RecommendTVcontentOverviewChannelsonthehomescreenVideoprogramattributesAudioprogramattributesGameprogramattributes WatchNextAddprogramsAttributesGuidelinesforappdevelopersGuidelinesforTVprovidersPreviewvideosRecommendationsinAndroidNandearlierMakeTVappssearchableSearchwithinTVApps BuildTVgamesOverviewUseStreamProtectforlatency-sensitivestreamingapps BuildTVinputservicesOverviewDevelopaTVinputserviceWorkwithchanneldataManageTVuserinteractionSupporttime-shiftingSupportcontentrecordingTVAppschecklist TVAccessibilityAccessibilitybestpracticesTalkBackevaluationexamplesAdoptsystemcaptionsettingsCustomviewaccessibilitysupportCustomviewaccessibilitysampleAndroid12DeveloperPreviewforTV AndroidforCarsOverview BuildmediaappsforcarsBuildmediaappsforcarsAddsupportforAndroidAutoAddsupportforAndroidAutomotiveOSBuildmessagingappsforAndroidAuto Buildnavigation,parking,andchargingappsforcarsUsingtheAndroidforCarsAppLibraryBuildparkingandchargingappsforcarsBuildnavigationappsforcarsAddsupportforAndroidAutoTestAndroidappsforcarsGooglePlayservicesNotificationsonAndroidAutomotiveOS AndroidThingsOverviewPlatformdifferencesGoogleservices SupportedhardwareOverviewNXPi.MX7DRaspberryPi3 AdvancedsetupOverviewManuallyflashanimageRecoveradeviceConnectingtoWi-Fiwithadb Buildapps CreateaThingsappOverviewCreateaprojectConnectthehardwareInteractwithperipheralsIntegrateperipheraldrivers CommunicatewithwirelessdevicesBluetoothLoWPAN ConfiguredevicesSettingsUpdates InteractwithperipheralsOverviewGPIOPWMI2CSPIUARTNativePIOCLItoolIntegratenativecode Builduser-spacedriversOverviewLocationInputSensorsLoWPANSamples ManagedevicesOverviewCreateaproductConfigureaproduct CreateabuildOverviewManageapps PushanupdateOverviewAutomaticupdatesMonitoranalytics TermsConsoleTermsofServiceSDKLicenseAgreementAndroidThingsConsole ChromeOSdevicesOverviewBuildingappsforChromeOSOptimizingAppsforChromeOSPreparingyourdevelopmentenvironmentAppManifestCompatibilityforChromebooksChromeOSDeviceSupportforAppsAppRenderingDifferencesonChromebooksWindowmanagementAdaptingGamesonChromeOSSmoothanimationonChromeOSTestCasesforAndroidAppsonChromeOS Apparchitecture Introduction Guidetoapparchitecture ArchitectureComponents UIlayerlibraries ViewbindingOverviewMigratefromKotlinsyntheticstoviewbinding DatabindinglibraryOverviewGetstartedLayoutsandbindingexpressionsWorkwithobservabledataobjectsGeneratedbindingclassesBindingadaptersBindlayoutviewstoArchitectureComponentsTwo-waydatabinding Lifecycle-awarecomponentsHandlelifecyclesViewModelLiveDataSaveUIstatesSavedStatemoduleforViewModelUseKotlincoroutineswithlifecycle-awarecomponents PagingLibraryOverviewLoadanddisplaypageddataPagefromnetworkanddatabaseTransformdatastreamsManageandpresentloadingstatesTestyourPagingimplementationMigratetoPaging3 Paging2OverviewDisplaypagedlistsLoadpageddata DatalayerlibrariesDataStore WorkManagerOverviewGettingStarted How-ToGuidesDefiningyourWorkRequestsWorkstatesManagingworkObservingintermediateWorkerprogressChainingworktogetherTestingWorkerimplementationIntegrationtestswithWorkManagerDebuggingWorkManager AdvancedConceptsConfigurationandInitialization ThreadinginWorkManagerOverviewThreadinginWorkerThreadinginCoroutineWorkerThreadinginRxWorkerThreadinginListenableWorkerSupportforlong-runningworkersMigratingfromFirebaseJobDispatcherMigratingfromGCMNetworkManager Appentrypoints ActivitiesIntroductiontoactivitiesTheactivitylifecycleActivitystatechangesTestyouractivitiesTasksandbackstackProcessesandapplifecycleParcelablesandbundlesLoadersRecentsscreenRestrictionsonstartingactivitiesfromthebackground AppshortcutsOverviewCreateshortcutsAddcapabilitiesManageshortcutsBestpracticesforshortcuts AppnavigationPrinciplesofnavigationDesignfordifferentformfactorsHandleconfigurationchanges NavigationcomponentOverviewGettingstartedCreatedestinationsDesignnavigationgraphsNestedgraphsGlobalactionsNavigatetoadestinationConditionalnavigationPassdatabetweendestinationsCreateadeeplinkforadestinationAnimatetransitionsbetweendestinationsUpdateUIcomponentswithNavigationUIKotlinDSLInteractprogrammaticallyNavigatewithfeaturemodulesBestpracticesformulti-moduleprojectsTestnavigationAddnewdestinationtypesMigratetotheNavigationcomponent FragmentsOverviewCreateafragmentFragmentmanagerFragmenttransactionsAnimatetransitionsbetweenfragmentsFragmentlifecycleSavingstatewithfragmentsCommunicatewithfragmentsWorkingwiththeappbarDisplayingdialogswithDialogFragmentDebugyourfragmentsTestyourfragments ApplinksOverviewEnablinglinkstoappcontentVerifyapplinksCreateapplinksforinstantappsCreateswipeviewswithtabsusingViewPagerCreateswipeviewswithtabsusingViewPager2Providecustombacknavigation DependencyinjectionOverviewManualdependencyinjectionDependencyinjectionwithHiltHiltinmulti-moduleappsHiltandJetpackintegrationsHilttestingguideHiltandDaggerannotationscheatsheet DaggerDaggerbasicsUsingDaggerinAndroidappsUsingDaggerinmulti-moduleapps AppStartup Coretopics AppcompatibilityOverviewCompatibilityframeworktoolsRestrictionsonnon-SDKinterfaces InteractwithotherappsOverviewSendingtheusertoanotherappGettingaresultfromanactivityAllowingotherappstostartyouractivity PackagevisibilityOverviewKnowwhichpackagesarevisibleautomaticallyDeclarepackagevisibilityneedsFulfillcommonusecasesTestpackagevisibility IntentsandintentfiltersOverviewCommonintents UserinterfaceOverview LayoutsOverviewBuildaresponsiveUIwithConstraintLayout AddmotiontoyourlayoutwithMotionLayoutOverviewCarouselwithMotionLayoutMotionLayoutexamples MotionLayoutXMLreferenceOverviewCreatealistwithRecyclerViewAdvancedRecyclerViewcustomizationCreateacard-basedlayoutCreateatwopanelayout ImprovinglayoutperformanceOverviewOptimizinglayouthierarchiesRe-usinglayoutswithDelayedloadingofviewsLinearlayoutAdapterviewRelativelayout CustomviewcomponentsOverviewCreatingacustomviewclassImplementingcustomdrawingMakingtheviewinteractiveOptimizingtheviewDesigningforfoldables LookandfeelMaterialdesignStylesandthemesDarkthemeRoundedcornersAdaptiveiconsAddafloatingactionbuttonCreateshadowsandclipviews TextAutosizingTextViewsDownloadablefontsFontsinXML EmojiSupportmodernemojiEmojicompatibilityMagnifierwidgetSpansButtonsCheckboxesRadiobuttonsTogglebuttonsSpinnersPickersTooltips NotificationsOverviewCreateanotificationCreateanexpandablenotificationDisplaytime-sensitivenotificationsStartanactivityfromanotificationCreateagroupofnotificationsCreateandmanagenotificationchannelsModifyanotificationBadgeCreateacustomnotification SplashscreensOverviewMigrateyourexistingsplashscreenConversationsBubbles AddtheappbarOverviewSetuptheappbarAddandhandleactionsAddanupactionUseactionviewsandactionproviders ControlthesystemUIvisibilityOverviewDimthesystembarsHidethestatusbarHidethenavigationbarEnablefullscreenmodeRespondtoUIvisibilitychanges Supportingswipe-to-refreshOverviewAddingswipe-to-refreshtoyourappRespondingtoarefreshgestureToastsoverview Pop-upmessagesoverviewOverviewBuildanddisplayapop-upmessageAddanactiontoamessageDialogsMenus SettingsOverviewOrganizeyoursettingsCustomizeyoursettingsUsesavedvaluesBuildahierarchyincodeHandleotherformfactorsPreferencecomponentsandattributes SearchOverviewCreatingasearchinterfaceAddingrecentquerysuggestionsAddingcustomsuggestionsSearchableconfiguration AddingsearchfunctionalityOverviewSettingupthesearchinterfaceStoringandsearchingfordataRemainingbackwardcompatibleCopyandpasteDraganddropPicture-in-picturesupport Creatingbackward-compatibleUIsOverviewAbstractingthenewAPIsProxyingtothenewAPIsCreatinganimplementationwitholderAPIsUsingtheversion-awarecomponentDevicecontrol HomechannelsformobileappsOverviewMediaHomeBooksMediaHomeVideo AppwidgetsOverviewCreateasimplewidgetEnhanceyourwidgetCreateanadvancedwidgetUsewidgetcollectionsProvideflexiblewidgetlayoutsEnablewidgetconfigurationBuildanappwidgethost Animations&transitionsOverviewIntroductiontoanimationsPropertyanimationoverviewAnimatedrawablegraphicsRevealorhideaviewusinganimationMoveaviewusinganimationMoveaviewusingaflinganimationEnlargeaviewusingazoomanimationAnimatemovementusingspringphysicsAutoanimatelayoutupdatesAnimatelayoutchangesusingatransitionCreateacustomtransitionanimationStartanactivityusingananimationSlidebetweenfragmentsusingViewPagerSlidebetweenfragmentsusingViewPager2MigratefromViewPagertoViewPager2Additionalresources Images&graphicsOverviewDrawablesoverviewVectordrawablesoverviewHandlingbitmapsSelectingcolorswiththepaletteAPIReducingimagedownloadsizesHardwareaccelerationOpenGLES DisplayinggraphicswithOpenGLESOverviewBuildinganOpenGLESenvironmentDefiningshapesDrawingshapesApplyingprojectionandcameraviewsAddingmotionRespondingtotouchevents RenderingOverviewReducingoverdrawPerformanceandviewhierarchiesAnalyzingwithprofileGPUrenderingEnhancinggraphicswithwidecolorcontent Audio&videoAudio&videooverviewMediacontrolsSupportedmediaformatsMediacodecs MediaapparchitectureMediaapparchitectureoverviewUsingamediasession BuildinganaudioappAudioappoverviewBuildingamediabrowserserviceBuildingamediabrowserclientMediasessioncallbacksUsingthemediacontrollertestapp BuildingavideoappVideoappoverviewBuildingavideoplayeractivityMediasessioncallbacksCompatiblemediatranscodingRespondingtomediabuttonsHandlingchangesinaudiooutputManageaudiofocus TheGoogleAssistantTheGoogleAssistantandmediaappsMediaappsonGoogleAssistantdrivingmode RoutingbetweendevicesRoutingoverviewMediaRouteroverviewMediaRouteProvideroverviewControlamplitudewithVolumeShaperMediaPlayeroverviewMediaRecorderoverviewExoPlayerSharingaudioinputCapturevideoandaudioplaybackFramerateBestpracticesforsharingvideoAdditionalResourcesforMedia ServicesOverviewForegroundservicesBoundservicesAIDLoverview BackgroundtasksOverviewBackgroundthreadsBackgroundoptimizations BroadcastsOverviewImplicitBroadcastExceptions ManagedeviceawakestateOverviewKeepthedeviceawakeSchedulealarms PermissionsOverviewEvaluatewhetheryourappneedspermissionsDeclareapppermissionsRequestapppermissionsExplainaccesstomoresensitiveinformationApppermissionsbestpracticesPermissionsusedonlyindefaulthandlersRestrictinteractionswithotherappsDefinecustompermissions Appdata&filesOverviewStorageoverviewSavetoapp-specificstorage SavetosharedstorageOverviewMediaDocumentsandotherfilesDatasetsManageallfilesonastoragedeviceSavekey-valuedata SavedatainalocaldatabaseOverviewDefinedatausingentitiesAccessdatausingDAOsDefinerelationshipsbetweenobjectsWriteasynchronousDAOqueriesCreateviewsintoadatabasePrepopulateyourdatabaseMigrateyourdatabaseTestanddebugyourdatabaseReferencecomplexdataMigratefromSQLitetoRoomSavedatausingSQLiteStorageusecasesandbestpractices SharingsimpledataOverviewSendingsimpledatatootherappsReceivingsimpledatafromotherapps SharingfilesOverviewSettingupfilesharingSharingafileRequestingasharedfileRetrievingfileinformation SharingfileswithNFCOverviewSendingfilestoanotherdeviceReceivingfilesfromanotherdevice PrintingfilesOverviewPrintingphotosPrintingHTMLdocumentsPrintingcustomdocuments ContentprovidersOverviewContentproviderbasicsCreatingacontentproviderOpenfilesusingstorageaccessframeworkCreateacustomdocumentproviderAppinstalllocation Userdata&identityOverviewAddsign-inworkflowShowabiometricauthenticationdialog AutofillframeworkOverviewOptimizeyourappforautofillBuildautofillservicesIntegrateautofillwithkeyboardsIdentifydeveloper-ownedappsReviewhowyourappcollectsandsharesuserdataAuditdataaccessGetauser-resettableadvertisingIDCalendarprovideroverview ContactsproviderOverviewRetrievingalistofcontactsRetrievingdetailsforacontactModifyingcontactsusingintentsDisplayingthequickcontactbadgeAccounttransfer DatabackupOverviewBackupuserdataBackupkey-valuepairsTestbackupandrestoreBestpracticesforuniqueidentifiers RememberandauthenticateusersOverviewRememberyouruserAuthenticatetoOAuth2servicesCreateacustomaccounttype UserlocationOverviewRequestlocationpermissionsGetthelastknownlocationChangelocationsettingsRequestlocationupdatesAccesslocationinthebackgroundCreateandmonitorgeofencesDetectwhenusersstartanactivityOptimizelocationforbatteryTestlocationworkflowsMigratetolocationandcontextAPIsAddmaps Touch&inputOverviewInputevents UsingtouchgesturesOverviewDetectcommongesturesTracktouchandpointermovementsAnimateascrollgestureSupportnavigationgesturesImplementedge-to-edgeHandlemulti-touchgesturesDragandscaleManagetoucheventsinaViewGroup HandlingkeyboardinputOverviewSpecifyingtheinputmethodtypeHandlinginputmethodvisibilitySupportingkeyboardnavigationHandlingkeyboardactions SupportinggamecontrollersOverviewHandlingcontrolleractionsSupportingcontrollersacrossAndroidversionsSupportingmultiplegamecontrollers InputmethodeditorsCreatinganinputmethodImagekeyboardReceiverichcontentSpellingchecker CameraXOverviewCameraXarchitectureConfigurationPreviewImageanalysisImagecaptureVideocaptureExtensionsAPITransformoutputUsecaserotationsCameraXdevices Camera2OverviewCameracapturesessionsandrequestsCameraenumerationUsemultiplecamerastreamssimultaneouslyCamerapreviewonlargescreensMulti-CameraAPIExtensionsAPI CameraOverviewTakingphotosRecordingvideosControllingthecameraCameraAPI SensorsOverviewSensorsoverviewMotionsensorsPositionsensorsEnvironmentsensorsRawGNSSmeasurements ConnectivityOverview PerformingnetworkoperationsOverviewConnecttothenetworkManagenetworkusageReadingnetworkstateOptimizenetworkdatausageParseXMLdata TransmitnetworkdatausingVolleyOverviewSendasimplerequestSetupRequestQueueMakeastandardrequestImplementacustomrequest PerformnetworkoperationsusingCronetOverviewSendasimplerequestCronetrequestlifecycle Reference org.chromium.netOverviewCallbackException CronetEngineOverview CronetEngine.BuilderOverviewLibraryLoaderCronetExceptionInlineExecutionProhibitedExceptionNetworkExceptionQuicExceptionUploadDataProviderUploadDataProvidersUploadDataSink UrlRequestOverviewBuilderCallbackStatusStatusListener UrlResponseInfoOverviewHeaderBlockEnhanceyourappswith5GBuildclient-serverapplicationswithgRPC TransferringdatawithoutdrainingthebatteryOverviewOptimizedownloadsforefficientnetworkaccessMinimizetheeffectofregularupdatesAvoidredundantdownloadsModifypatternsbasedontheconnectivitytype ReducenetworkbatterydrainOverviewCollectingnetworktrafficdataAnalyzingdatatrafficOptimizeuser-initiatednetworkuseOptimizeapp-initiatednetworkuseOptimizeserver-initiatednetworkuseOptimizinggeneralnetworkuse TransferdatausingSyncAdaptersOverviewCreateaStubAuthenticatorCreateaStubContentProviderCreateaSyncAdapterRunaSyncAdapter BluetoothOverviewSetupBluetoothFindBluetoothdevicesConnectBluetoothdevicesTransferBluetoothdataBluetoothpermissionsBluetoothprofilesCompaniondevicepairing BluetoothLowEnergyOverviewFindBLEdevicesConnecttoaGATTserverTransferBLEdata NFCOverviewNFCbasicsAdvancedNFCHost-basedcardemulationoverview TelecomOverviewBuildacallingappPreventcallerIDspoofingTelephonyIDs Wi-FiWi-FiscanningoverviewWi-Fipeer-to-peerWi-FiAwareoverviewWi-FilocationwithRTTLocalOnlyHotspot Wi-FiinfrastructureWi-FiinfrastructureoverviewWi-FisuggestionAPIforinternetconnectivityWi-FiNetworkRequestAPIforpeer-to-peerconnectivityPasspointSavenetworksandPasspointconfigurations USBOverviewAccessoryoverviewHostoverviewVPNSessioninitiationprotocoloverview DiscoverandconnectOverviewUsenetworkservicediscoveryCreateP2PconnectionswithWi-FiUseWi-FiP2PforservicediscoveryWi-FiEasyConnectOpenMobileAPIreadersupport RenderscriptOverviewAdvancedRenderScriptMigratefromRenderScript RuntimeAPIreferenceOverviewNumericaltypesObjecttypesConversionfunctionsMathematicalconstantsandfunctionsVectormathfunctionsMatrixfunctionsQuaternionfunctionsAtomicupdatefunctionsTimefunctionsandtypesAllocationdataaccessfunctionsObjectcharacteristicsfunctionsKernelinvocationfunctionsandtypesInput/outputfunctionsDebuggingfunctionsGraphicsfunctionsandtypesIndex Web-basedcontentOverviewBuildingwebappsinWebViewManagingWebViewobjectsLoadlocalcontentDarkenwebcontentUserprivacyinWebViewcrashreportingMigratingtoWebViewinAndroid4.4SupportingdifferentscreensinwebappsDebuggingwebappsBestpracticesforwebapps AndroidAppBundlesOverviewConfigurethebasemoduleBuildandtestyourappbundleAddcodetransparencyTheappbundleformatFrequentlyaskedquestions GooglePlayGooglePlayBillingPlayCoreLibrary PlayAssetDeliveryOverviewIntegrateassetdelivery(Kotlin&Java)Integrateassetdelivery(native)Integrateassetdelivery(Unity)TargettexturecompressionformatsTestassetdelivery PlayFeatureDeliveryOverviewConfigureinstall-timedeliveryConfigureconditionaldeliveryConfigureon-demanddeliveryOn-demanddeliverybestpracticesConfigureinstantdeliveryAdditionalresources In-appreviewsOverviewIntegrateusingKotlinorJavaIntegrateusingnativecodeIntegrateusingUnityTestin-appreviews In-appupdatesOverviewSupportin-appupdates(KotlinorJava)Supportin-appupdates(Native)Supportin-appupdates(Unity)Testin-appupdates GooglePlayInstantOverviewofGooglePlayInstant GetstartedwithinstantappsCreateaninstant-enabledappbundleUXbestpracticesforapps GetstartedwithinstantgamesOverviewUnitypluginUXbestpracticesforgamesMigratetoAndroidAppBundlesImplementclouddeliveryofassetsSupportGooglePlayGamesServicesInstantPlaygamesInstantPlaygameschecklistReducethesizeofyourinstantapporgameAddadstoyourinstantapporgameProvidemultipleentrypoints IntegratewithFirebaseAddGoogleAnalyticsforFirebasetoyourinstantappUseFirebaseDynamicLinkswithinstantappsTechnicalrequirementschecklistGooglePlayInstantpolicy ResourcesReferenceCodesamplesSDKreleasenotesInstantAppIntents SupportKnownissuesStackOverflowPlayDeveloperAPI PlayInstallReferrerOverview PlayInstallReferrerLibraryOverviewReferenceReleasenotesPlayInstallReferrerAPIPlayIntegrityAPI ApplicationLicensingOverviewLicensingOverviewSettingUpforLicensingAddingServer-SideVerificationAddingClient-SideVerificationLicensingReferenceAPKExpansionFiles AppActions SlicesOverviewGettingStartedSlicetemplates On-devicesearch Games ToolsAndroidStudio AndroidGameDevelopmentExtensionforVisualStudioOverviewQuickstartConfigureaprojectDebuggerMeasureappperformanceSamplesReleasenotesAndroidNDK AndroidGPUInspectorOverviewQuickstart SystemprofilingOverviewViewasystemprofile AnalyzeasystemprofileFrameprocessingtimesMemoryefficiencyTexturememorybandwidthusageVertexmemorybandwidthusageThreadscheduling GPUperformancecountersArmMaliQualcommAdrenoImaginationPowerVR FrameprofilingOverview AnalyzeaframeprofileMostexpensiverenderpassesVertexformatsShaderperformance FrameProfilerUIPerformancepaneCommandspaneFramebufferpaneGeometrypaneReportpaneShaderpaneMemorypaneStatepaneTexturespaneTexturepanePipelineviewpaneSupportedVulkanextensionsTroubleshoot CustomizeorportgameenginesOverview GettingstartedIntegrateGameActivityConfiguregraphicsUnderstandAndroidgameloops ProcessinputeventsAddtouchsupportSupporttextinput SupportgamecontrollersOverviewUsethegamecontrollerlibraryUsecustomcontrollerdevicemappingsAddmousesupportSupportsensorinput AchieveproperframepacingOverview FramepacinginOpenGLESIntegrateUpdateyourbuildsettingsAddframepacingfunctionsVerifyframepacingimprovement FramepacinginVulkanIntegrateUpdateyourbuildsettingsAddframepacingfunctionsVerifyframepacingimprovementReference IntegrateAndroidPerformanceTunerOverviewRunthedemoappEnabletheAPIUpdateyourbuildsettingsDefineannotations,fidelityparameters,andsettingsAddframetimingfunctionsAddloadingtimerecordingfunctionsValidate,package,andpublishtheAPKTroubleshootcommonerrorsAdvancedusageReference OutputaudioOverviewUpdatebuildsettingsUseOboeCodesamplesFullOboeguide ManagememoryOverviewDebugnativememoryuseDeliverassetsDetectanddiagnosecrashes UseprebuiltorturnkeygameenginesOverview DevelopwithDefoldInstallandconfigureprojectsforAndroidSupportmultipleformfactorsandscreensizesExporttoAndroid DevelopwithGodotInstallandconfigureprojectsforAndroidGodotrendereroptionsSupportmultipleformfactorsandscreensizesExporttoAndroid DevelopwithUnityOverviewCreateanAndroidAppBundlewithUnityIntegratePlayAssetDeliveryUnityLightinginMobileGames UseAndroidPerformanceTunerOverviewEnabletheAPIIntegratethepluginInitializethelibraryandverifyoperationDefineannotations,fidelityparameters,andqualitylevelsAddloadingtimerecordingfunctionsRunthemonitorappReviewandpublishTroubleshootcommonerrorsReferenceDevelopwithUnrealRequestinguserpermissionsSecureyourgame Gamebestpractices MaximizedeviceavailabilitySupport64-bitarchitecturesDevelopgamesforallscreensSign-in,savegames,andmorewithPlayGamesServices ArtassetsGeometrybestpractices OpenGLandVulkanDeviceorientationefficientlyinVulkanVertexdatamanagement GameModeOverviewOptimizewithGameModeAPIGameModeinterventions OptimizeCPU,memory,andgraphicstoolsAndroidPerformanceTuner GuidesImprovegameperformanceReducegamesize DistributeOverviewReleasewithGooglePlayInstantPlayasyoudownload Bestpractices TestingOverviewFundamentalsoftestingSetupproject BuildingeffectiveunittestsOverviewBuildinglocalunittestsBuildinginstrumentedunittests AutomatingUItestsOverviewTestingUIforasingleappTestingUIformultipleapps TestingappcomponentintegrationsOverviewTestingyourserviceTestingyourcontentproviderTestingUIperformance EspressoOverviewSetupinstructionsBasicsRecipesMultiprocessAccessibilitycheckingListsIntentsWebIdlingresourceCheatsheetAdditionalresourcesUIAutomatorAppCrawlerJUnit4RulesAndroidJUnitRunnerReleasenotesAdditionalresources PerformanceOverviewPerformanceclass AndroidVitalsOverviewStuckPartialWakeLocksExcessiveWakeupsExcessiveBackgroundWi-FiScansExcessiveBackgroundNetworkUsageANRsCrashesSlowRenderingFrozenFramesPermissionDenialsAppStartupTimeAppStandbyBucketsAppHibernationProcessesandThreadsOverviewBetterPerformancethroughThreading OptimizingforBatteryLifeOverviewOptimizeforDozeandAppStandbyMonitorthebatterylevelandchargingstateMonitorconnectivitystatusandconnectionmeteringDetermineandmonitorthedockingstateandtypePowermanagementrestrictionsProfilebatteryusagewithBatterystatsandBatteryHistorianAnalyzepowerusewithBatteryHistorianTestingpower-relatedissuesReduceyourappsize ManagememoryOverviewofMemoryManagemementMemoryAllocationamongProcessesManageYourApp'sMemory SystemtracingOverviewCaptureatracefromthecommandlineCaptureatraceonadeviceNavigateareportDefinecustomeventsCustomtraceeventsinnativecodeInspectGPUrenderingDesigningforSeamlessnessKeepingYourAppResponsivePerformanceTipsSMPPrimerforAndroidVerifyingAppBehaviorontheAndroidRuntime(ART) AccessibilityOverview BuildandtestappsforaccessibilityMakeappsmoreaccessiblePrinciplesforimprovingappaccessibilityTestyourapp'saccessibility AdvancedtopicsMakecustomviewsmoreaccessibleCreateyourownaccessibilityserviceAdditionalresources PrivacyPrivacybestpractices SecurityAppsecuritybestpracticesSecuritytipsSecuritywithdataSecuritywithdataacrossadditionalAndroidversionsSecuritywithHTTPSandSSLNetworksecurityconfigurationUpdatingyoursecurityprovidertoprotectagainstSSLexploits ProtectingagainstsecuritythreatswithSafetyNetOverviewSafetyNetAttestationAPISafetyNetSafeBrowsingAPISafetyNetreCAPTCHAAPISafetyNetVerifyAppsAPICryptographyAndroidKeystoreSystemVerifyinghardware-backedkeypairswithkeyattestationAndroidProtectedConfirmationSupportingDirectBootRunningembeddedDEXcodeAppsecurityimprovementprogram BuildforBillionsOverviewConnectivityDevicecapabilityDatacostBatteryconsumptionUIandcontent BuildforEnterpriseOverviewDeveloperguideWorkprofilesSetupmanagedconfigurations AppfeedbackSendappfeedbacktoEMMsTestappfeedbackWorkcontactsDevicemanagementpolicies DevicemanagementOverviewBuildadevicepolicycontroller DedicateddevicesOverviewLocktaskmodeMultipleusersCookbookDevicecontrolNetworkingandtelephonySecuritySystemupdatesNetworkactivitylogging AndroidversionsOverviewAndroid12Android11Android10Android9Android8.0Android7.0Deviceadministration AndroidDevelopers Docs Guides Accessmediafilesfromsharedstorage Toprovideamoreenricheduserexperience,manyappsallowuserstocontribute andaccessmediathat'savailableonanexternalstoragevolume.Theframework providesanoptimizedindexintomediacollections,calledthemediastore, thatallowsforretrievingandupdatingthesemediafilesmoreeasily.Even afteryourappisuninstalled,thesefilesremainontheuser'sdevice. Note:Ifyourappworkswithmediafilesthatprovidevaluetotheuseronly withinyourapp,it'sbesttostoretheminapp-specificdirectorieswithin externalstorage. Tointeractwiththemediastoreabstraction,usea ContentResolverobjectthatyou retrievefromyourapp'scontext: Kotlin valprojection=arrayOf(media-database-columns-to-retrieve) valselection=sql-where-clause-with-placeholder-variables valselectionArgs=values-of-placeholder-variables valsortOrder=sql-order-by-clause applicationContext.contentResolver.query( MediaStore.media-type.Media.EXTERNAL_CONTENT_URI, projection, selection, selectionArgs, sortOrder )?.use{cursor-> while(cursor.moveToNext()){ //UseanIDcolumnfromtheprojectiontoget //aURIrepresentingthemediaitemitself. } } Java String[]projection=newString[]{ media-database-columns-to-retrieve }; Stringselection=sql-where-clause-with-placeholder-variables; String[]selectionArgs=newString[]{ values-of-placeholder-variables }; StringsortOrder=sql-order-by-clause; Cursorcursor=getApplicationContext().getContentResolver().query( MediaStore.media-type.Media.EXTERNAL_CONTENT_URI, projection, selection, selectionArgs, sortOrder ); while(cursor.moveToNext()){ //UseanIDcolumnfromtheprojectiontoget //aURIrepresentingthemediaitemitself. } Thesystemautomaticallyscansanexternalstoragevolumeandaddsmediafiles tothefollowingwell-definedcollections: Images,includingphotographsandscreenshots,whicharestoredinthe DCIM/andPictures/directories.Thesystemaddsthesefilestothe MediaStore.Imagestable. Videos,whicharestoredintheDCIM/,Movies/,andPictures/ directories.Thesystemaddsthesefilestothe MediaStore.Videotable. Audiofiles,whicharestoredintheAlarms/,Audiobooks/,Music/, Notifications/,Podcasts/,andRingtones/directories.Additionally,the systemrecognizesaudioplayliststhatareintheMusic/orMovies/ directories,aswellasvoicerecordingsthatareintheRecordings/ directory.Thesystemaddsthesefilestothe MediaStore.Audiotable. Therecordingsdirectoryisn'tavailableonAndroid11(APIlevel30)and lower. Downloadedfiles,whicharestoredintheDownload/directory.On devicesthatrunAndroid 10(APIlevel29)andhigher,thesefilesarestoredinthe MediaStore.Downloads table.Thistableisn'tavailableonAndroid9(APIlevel28)andlower. Themediastorealsoincludesacollectioncalled MediaStore.Files.Itscontents dependonwhetheryourappusesscoped storage,availableonappsthattarget Android 10orhigher: Ifscopedstorageisenabled,thecollectionshowsonlythephotos,videos, andaudiofilesthatyourapphascreated.Mostdeveloperswon'tneedtouse MediaStore.Filestoviewmediafilesfromotherapps,butifyouhavea specificrequirementtodoso,youcandeclaretheREAD_EXTERNAL_STORAGE permission.It'srecommended,however,thatyouusetheMediaStore APIstoopenfilesthatyourapphasn'tcreated. Ifscopedstorageisunavailableornotbeingused,thecollectionshowsall typesofmediafiles. Requestnecessarypermissions Beforeperformingoperationsonmediafiles,makesureyourapphasdeclaredthe permissionsthatitneedstoaccessthesefiles.Keepinmind,however,that yourappshouldn'tdeclarepermissionsthatitdoesn'tneedoruse. Storagepermission Thepermissionsmodelforaccessingmediafilesinyourappdependsonwhether yourappusesscopedstorage,availableonappsthattarget Android 10orhigher. Scopedstorageenabled Ifyourappusesscopedstorage,itshouldrequeststorage-related permissionsonlyfordevicesthatrunAndroid9(APIlevel28)orlower.Youcan applythisconditionbyaddingtheandroid:maxSdkVersionattributetothe permissiondeclarationinyourapp'smanifestfile: Don'tunnecessarilyrequeststorage-relatedpermissionsfordevicesthatrun Android 10orhigher.Yourappcancontributetowell-defined mediacollections,includingthe MediaStore.Downloads collection,withoutrequestinganystorage-relatedpermissions.Ifyou're developingacameraapp,forexample,youdon'tneedtorequeststorage-related permissionsbecauseyourappownstheimagesthatyou're writingtothemediastore. Toaccessfilesthatotherappshavecreated,thefollowingconditionsmusteach betrue: Yourapphasbeengrantedthe READ_EXTERNAL_STORAGE permission. Thefilesresideinoneofthefollowingwell-definedmediacollections: MediaStore.Images MediaStore.Video MediaStore.Audio Note:AslongasafileisviewablefromtheMediaStore.Images, MediaStore.Video,orMediaStore.Audioqueries,it'salsoviewableusingthe MediaStore.Filesquery. IfyourappwantstoaccessafilewithintheMediaStore.Downloadscollection thatyourappdidn'tcreate,youmustusetheStorageAccessFramework.Tolearn moreabouthowtousethisframework,seetheguideonhowtoaccessdocuments andotherfiles. Scopedstorageunavailable IfyourappisusedonadevicethatrunsAndroid9orlower,orifyourapphas temporarilyoptedoutofscoped storage,youmust requestthe READ_EXTERNAL_STORAGE permissiontoaccessmediafiles.Ifyouwanttomodifymediafiles,youmust requestthe WRITE_EXTERNAL_STORAGE permission,aswell. Note:Ifyourapp'susecaseisn'tcoveredbyscopedstorage,filea featurerequestand temporarilyoptoutofscoped storage. Medialocationpermission IfyourapptargetsAndroid10(APIlevel29)orhigher,inorderforyourapp toretrieveunredactedExifmetadatafromphotos,youneedtodeclarethe ACCESS_MEDIA_LOCATION permissioninyourapp'smanifest,thenrequestthispermissionatruntime. Caution:BecauseyourequesttheACCESS_MEDIA_LOCATIONpermissionatruntime, thereisnoguaranteethatyourapphasaccesstounredactedExifmetadatafrom photos.Yourapprequiresexplicituserconsentinordertogainaccesstothis information. Checkforupdatestothemediastore Toaccessmediafilesmorereliably,particularlyifyourappcachesURIsor datafromthemediastore,checkwhetherthemediastoreversionhaschanged comparedtowhenyoulastsyncedyourmediadata.Toperformthischeckfor updates,call getVersion(). Thereturnedversionisauniquestringthatchangeswheneverthemediastore changessubstantially.Ifthereturnedversionisdifferentfromthelastsynced version,rescanandresyncyourapp'smediacache. Completethischeckatappprocessstartuptime.There'snoneedtocheckthe versioneachtimeyouquerythemediastore. Don'tassumeanyimplementationdetailsregardingtheversionnumber. Note:Themediastoreversionnumberdoesn'tchangeasaresultofapp-side changes,suchaswhenanappaddsamediafile.There'saseparate methodtohelpyoudetectupdatestomediafiles. Queryamediacollection Tofindmediathatsatisfiesaparticularsetofconditions,suchasaduration of5minutesorlonger,useanSQL-likeselectionstatementsimilartotheone showninthefollowingcodesnippet: Kotlin //NeedtheREAD_EXTERNAL_STORAGEpermissionifaccessingvideofilesthatyour //appdidn'tcreate. //Containerforinformationabouteachvideo. dataclassVideo(valuri:Uri, valname:String, valduration:Int, valsize:Int ) valvideoList=mutableListOf



請為這篇文章評分?