- Создание Android Live Wallpapers
- В поисках правды
- Рисуем
- Методы жизненного цикла Engine
- Scheduler
- Service & Engine
- AndroidManifest и другие заклинания
- Как добавить
- Причем тут Android Watch?!
- Что получилось
- Благодарности
- Wallpaper Service. Engine Class
- Definition
- Remarks
- Constructors
- Properties
- Methods
- Explicit Interface Implementations
- Extension Methods
- Wallpaper Service Class
- Definition
- Remarks
- Constructors
- Fields
- Properties
- Methods
- Explicit Interface Implementations
- Extension Methods
Создание Android Live Wallpapers
Мне нужно отображать на экране телефона техническую информацию о его состоянии, точнее, о его состоянии в составе тестового пула. Видеть эту информацию я хочу всегда, то есть на Home screen, и без дополнительных телодвижений.
Способов, которые никак не повлияют на выполнение других приложения, всего два: Widget или Live wallpaper. Я выбрал Live wallpaper, они же «живые обои», потому что они автоматически попадают на все страницы Home screen, и даже на Lock screen. Эта статья содержит практические рекомендации, как создавать «живые обои».
В поисках правды
Документации о «живых обоях» кот наплакал. С момента первого (и единственного) анонса в блоге, случившегося больше 9 лет назад, Гугл не сделал ни одного внятного примера или codelab-а на эту тему. Пришлось разбираться.
Сначала основы. Внутренняя механика Андроида такова, что на устройство мы можем установить только приложение, и устройство всех приложений одинаково. Поскольку «живые обои» — это тоже приложение, то выбор управляющего компонента не велик, и стоит ожидать, что это будет Service. Найти его легко: это WallpaperService.
Экземпляров «живых обоев» может быть несколько, и жизненный цикл у них будет не такой, как у Activity или View. Соответственно, должен быть еще один базовый класс. Это WallpaperService.Engine (и он обязательно inner для WallpaperService!). Если вглядеться, то он окажется таким же поставщиком событий жизненного цикла, как Activity, Service и иже с ними.
Жизненный цикл «живых обоев» выглядит так:
Из этого списка становится понятно, когда можно/нужно перерисовать картинку (либо начать перерисовывать, если у вас анимация), и когда пора прекратить всю активность и не тратить батарейку.
Метод onSurfaceRedrawNeeded() выделяется среди остальных, читайте ниже. Также в помощь есть метод isVisible() (который в Котлине превращается в свойство isVisible ).
Теперь можно собирать этот конструктор. Начну с конца.
Рисуем
Рисовать придется самим на Canvas, никаких layout и inflater нам не будет. Как получить Canvas из SurfaceHolder и как на нем рисовать — за рамками этой статьи, ниже есть простой пример.
Методы жизненного цикла Engine
Все методы жизненного цикла, кроме onSurfaceRedrawNeeded , не требуют немедленной перерисовки. Поэтому хорошим тоном будет перерисовку поставить в очередь.
Обратите внимание на onSurfaceRedrawNeeded, который передает нам вызов одноименного коллбэка SurfaceHolder, который возникает при изменении размера и аналогичных событиях. Этот колбэк позволяет выполнить перерисовку немедленно, не допустив показа пользователю старой (и уже неверной) картинки. Система гарантирует, что пока не произошел возврат из этого метода, вывод на экран будет приостановлен.
Scheduler
Я люблю переопределять Handler, а не гонять в нем Runnable. На мой взгляд, так изящней.
В случае, если у вас анимация или регулярное обновление, то нужно будет сделать регулярную постановку сообщения в очередь (postAtTime() и postDelayed() вам в помощь). Если данные обновляются эпизодически, достаточно для обновления вызвать planRedraw() .
Service & Engine
Собирается эта марешка из Service и Engine вот так:
AndroidManifest и другие заклинания
Заклинаниями в разработке софта я называю то, что невозможно понять, но нужно точно повторить.
В . /app/src/main/res/xml должен лежать XML файл с описанием «живых обоев». Имя этого файла должно быть указано в AndroidManifest (ищите в примере ниже слово foobarwallpaper )
Не потеряйте в описании Service-а permission , meta-data и intent-filter :
Как добавить
«Живые обои» прячутся, поэтом подсказка. Описываю, как это выглядит на моем Samsung.
Для начала long press где-нибудь на Home screen, телефон перейдет в режим настройки рабочих столов, появится иконка Wallpapers.
Нажимаем на иконку Wallpapers, несколько разделов, нам нужен My wallpapers, жмем надпись View all в правом верхнем углу раздела, открывается список во весь экран.
Жмем «три точки» вызова меню, в нем пункт LIve wallpapers (у меня он единственный), появляется список доступных «живых обоев».
Выбираем наши обои, и выбираем «Home and lock screen».
Появится «превью», которое уже отрисовывается нашим приложением (чтобы распознать этот момент, есть метод isPreview()), жмем Set as wallpaper… И ничего не видим, потому что возвращаемся в список доступных обоев.
Жмем «Home» и наслаждаемся.
Причем тут Android Watch?!
Интересное наблюдение по ходу, что Faces в Android Watch сделаны по точно такой же схеме (с точностью, что у них свои базовые классы со своей реализацией): такие же Service + Engine, почти те же метаданные и intent filter для Service в манифесте (в которых слово wallpaper встречается четыре раза:), также надо писать свой шедулер на основе Handler-а.
В базовых классах Watch Faces есть готовый onDraw() , куда передается Canvas, и есть invalidate() для его вызова. Но это не принципиальное различие, а реализованная часть бойлерплейта.
В отличие от Live Wallpaper, для Watch Faces есть примеры, в них можно покопаться (ссылки здесь, в самом начале).
Что получилось
Скриншотики для приложения, которое красит экран в зеленый цвет, имеют мало смысла. Но пара фоток, что на базе этого получилось сделать для боевого стенда, под спойлером.
Стикеры — это оставшаяся система обнаружения проблем предыдущего поколения.
Благодарности
Если бы не эти две статьи, я бы блуждал в потьмах намного дольше. Не представляю себе, как их можно было написать аж в 2010 году при таком качестве документации?!
Источник
Wallpaper Service. Engine Class
Definition
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The actual implementation of a wallpaper.
Remarks
Portions of this page are modifications based on work created andВ shared by the Android Open Source ProjectВ and used according to terms described in theВ Creative Commons 2.5 Attribution License.
Constructors
A constructor used when creating managed representations of JNI objects; called by the runtime.
Properties
Returns the runtime class of this Object .
(Inherited from Object)
Convenience for DesiredMinimumHeight, returning the height that the system would like this wallpaper to run in.
Convenience for DesiredMinimumWidth, returning the width that the system would like this wallpaper to run in.
The handle to the underlying Android instance.
(Inherited from Object)
Returns true if this engine is running in preview mode — that is, it is being shown to the user before they select it as the actual wallpaper.
Return whether the wallpaper is currently visible to the user, this is the last value supplied to OnVisibilityChanged(Boolean).
Provides access to the surface in which this wallpaper is drawn.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
Methods
Creates and returns a copy of this object.
(Inherited from Object)
Indicates whether some other object is «equal to» this one.
(Inherited from Object)
Returns a hash code value for the object.
(Inherited from Object)
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
(Inherited from Object)
Wakes up a single thread that is waiting on this object’s monitor.
(Inherited from Object)
Wakes up all threads that are waiting on this object’s monitor.
(Inherited from Object)
Called once to initialize the engine.
Called when an application has changed the desired virtual size of the wallpaper.
Called right before the engine is going away.
Called to inform you of the wallpaper’s offsets changing within its contain, corresponding to the container’s call to SetWallpaperOffsets(IBinder, Single, Single).
Called as the user performs touch-screen interaction with the window that is currently showing this wallpaper.
Called to inform you of the wallpaper becoming visible or hidden.
Sets the Handle property.
(Inherited from Object)
Control whether this wallpaper will receive notifications when the wallpaper has been scrolled.
Control whether this wallpaper will receive raw touch events from the window manager as the user interacts with the window that is currently displaying the wallpaper.
Returns a string representation of the object.
(Inherited from Object)
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
(Inherited from Object)
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
(Inherited from Object)
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
(Inherited from Object)
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
Performs an Android runtime-checked type conversion.
Источник
Wallpaper Service Class
Definition
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A wallpaper service is responsible for showing a live wallpaper behind applications that would like to sit on top of it.
Remarks
Portions of this page are modifications based on work created andВ shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
A constructor used when creating managed representations of JNI objects; called by the runtime.
Fields
Use with #getSystemService(String) to retrieve a android.view.accessibility.AccessibilityManager for giving the user feedback for UI events through the registered event listeners.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.accounts.AccountManager for receiving intents at a time of your choosing.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.ActivityManager for interacting with the global system state.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.AlarmManager for receiving intents at a time of your choosing.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.AppOpsManager for tracking application operations on the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve an android.app.appsearch.AppSearchManager for indexing and querying app data managed by the system.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.appwidget.AppWidgetManager for accessing AppWidgets.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.AudioManager for handling management of volume, ringer modes and audio routing.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.BatteryManager for managing battery state.
(Inherited from Context)
Flag for #bindService : If binding from an app that is visible or user-perceptible, lower the target service’s importance to below the perceptible level.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.biometrics.BiometricManager for handling biometric and PIN/pattern/password authentication.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.blob.BlobStoreManager for contributing and accessing data blobs from the blob store maintained by the system.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.bluetooth.BluetoothManager for using Bluetooth.
(Inherited from Context)
Service to capture a bugreport.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.camera2.CameraManager for interacting with camera devices.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.view.accessibility.CaptioningManager for obtaining captioning properties and listening for changes in captioning preferences.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.telephony.CarrierConfigManager for reading carrier configuration values.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.content.ClipboardManager for accessing and modifying the contents of the global clipboard.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.companion.CompanionDeviceManager for managing companion devices
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.ConnectivityDiagnosticsManager for performing network connectivity diagnostics as well as receiving network connectivity information from the system.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.ConnectivityManager for handling management of network connections.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.ConsumerIrManager for transmitting infrared signals from the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.content.pm.CrossProfileApps for cross profile operations.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.admin.DevicePolicyManager for working with global device policy management.
(Inherited from Context)
Use with #getSystemService(String) to access android.view.displayhash.DisplayHashManager to handle display hashes.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.display.DisplayManager for interacting with display devices.
(Inherited from Context)
Use with #getSystemService(String) to access android.content.pm.verify.domain.DomainVerificationManager to retrieve approval and user state for declared web domains.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.DownloadManager for requesting HTTP downloads.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.DropBoxManager instance for recording diagnostic logs.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.telephony.euicc.EuiccManager to manage the device eUICC (embedded SIM).
(Inherited from Context)
Use with #getSystemService(String) to retrieve an android.security.FileIntegrityManager .
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.fingerprint.FingerprintManager for handling management of fingerprints.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a GameManager .
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.HardwarePropertiesManager for accessing the hardware properties service.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.view.inputmethod.InputMethodManager for accessing input methods.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.input.InputManager for interacting with input devices.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.IpSecManager for encrypting Sockets or Networks with IPSec.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.job.JobScheduler instance for managing occasional background tasks.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.KeyguardManager for controlling keyguard.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.content.pm.LauncherApps for querying and monitoring launchable apps across profiles of a user.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.view.LayoutInflater for inflating layout resources in this context.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.location.LocationManager for controlling location updates.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.MediaCommunicationManager for managing android.media.MediaSession2 .
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.metrics.MediaMetricsManager for interacting with media metrics on the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.projection.MediaProjectionManager instance for managing media projection sessions.
(Inherited from Context)
Use with #getSystemService to retrieve a android.media.MediaRouter for controlling and managing routing of media.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.session.MediaSessionManager for managing media Sessions.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.midi.MidiManager for accessing the MIDI service.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.usage.NetworkStatsManager for querying network usage stats.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.nfc.NfcManager for using NFC.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.NotificationManager for informing the user of background events.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.nsd.NsdManager for handling management of network service discovery
(Inherited from Context)
Use with #getSystemService(String) to access a PeopleManager to interact with your published conversations.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.PerformanceHintManager for accessing the performance hinting service.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.PowerManager for controlling power management, including «wake locks,» which let you keep the device on while you’re running long tasks.
(Inherited from Context)
android.print.PrintManager for printing and managing printers and print tasks.
(Inherited from Context)
Flag for #registerReceiver : The receiver can receive broadcasts from Instant Apps.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.content.RestrictionsManager for retrieving application restrictions and requesting permissions for restricted operations.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.role.RoleManager for managing roles.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.SearchManager for handling searches.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.SensorManager for accessing sensors.
(Inherited from Context)
The Intent that must be declared as handled by the service.
Name under which a WallpaperService component publishes information about itself.
Use with #getSystemService(String) to retrieve a android.content.pm.ShortcutManager for accessing the launcher shortcut service.
(Inherited from Context)
Flag for #stopForeground(int) : if set, the notification previously provided to #startForeground will be detached from the service.
(Inherited from Service)
Flag for #stopForeground(int) : if set, the notification previously provided to #startForeground will be removed.
(Inherited from Service)
Use with #getSystemService(String) to retrieve a android.os.storage.StorageManager for accessing system storage functions.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.usage.StorageStatsManager for accessing system storage statistics.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.health.SystemHealthManager for accessing system health (battery, power, memory, etc) metrics.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.telecom.TelecomManager to manage telecom-related features of the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve an android.telephony.ims.ImsManager .
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.telephony.TelephonyManager for handling management the telephony features of the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.telephony.SubscriptionManager for handling management the telephony subscriptions of the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a TextClassificationManager for text classification services.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.view.textservice.TextServicesManager for accessing text services.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.media.tv.TvInputManager for interacting with TV inputs on the device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.UiModeManager for controlling UI modes.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.app.usage.UsageStatsManager for querying device usage stats.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.hardware.usb.UsbManager for access to USB devices (as a USB host) and for controlling this device’s behavior as a USB device.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.UserManager for managing users on devices that support multiple users.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.VibratorManager for accessing the device vibrators, interacting with individual ones and playing synchronized effects on multiple vibrators.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.os.Vibrator for interacting with the vibration hardware.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.VpnManager to manage profiles for the platform built-in VPN.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a com.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.wifi.aware.WifiAwareManager for handling management of Wi-Fi Aware.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.wifi.p2p.WifiP2pManager for handling management of Wi-Fi peer-to-peer connections.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.wifi.rtt.WifiRttManager for ranging devices with wifi.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.net.wifi.WifiManager for handling management of Wi-Fi access.
(Inherited from Context)
Use with #getSystemService(String) to retrieve a android.view.WindowManager for accessing the system’s window manager.
(Inherited from Context)
Properties
Return the application that owns this service.
(Inherited from Service)
Return the context of the single, global Application object of the current process.
(Inherited from ContextWrapper)
Return the full application info for this context’s package.
(Inherited from ContextWrapper)
Return an AssetManager instance for your application’s package.
(Inherited from ContextWrapper)
Attribution can be used in complex apps to logically separate parts of the app.
(Inherited from Context)
Returns the absolute path to the application specific cache directory on the filesystem.
(Inherited from ContextWrapper)
Returns the runtime class of this Object .
(Inherited from Object)
Return a class loader you can use to retrieve classes in this package.
(Inherited from ContextWrapper)
Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code.
(Inherited from ContextWrapper)
Return a ContentResolver instance for your application’s package.
(Inherited from ContextWrapper)
Get the display this context is associated with.
(Inherited from Context)
Returns the absolute path to the directory on the primary external filesystem (that is somewhere on ExternalStorageDirectory where the application can place cache files it owns.
(Inherited from ContextWrapper)
Returns the absolute path to the directory on the filesystem where files created with OpenFileOutput(String, FileCreationMode) are stored.
(Inherited from ContextWrapper)
If the service has become a foreground service by calling #startForeground(int, Notification) or #startForeground(int, Notification, int) , #getForegroundServiceType() returns the current foreground service type.
(Inherited from Service)
The handle to the underlying Android instance.
(Inherited from Object)
Indicates whether this Context is restricted.
(Inherited from Context)
Returns true if the context is a UI context which can access UI components such as WindowManager , android.view.LayoutInflater LayoutInflater or android.app.WallpaperManager WallpaperManager .
(Inherited from Context)
Return an Executor that will run enqueued tasks on the main thread associated with this context.
(Inherited from Context)
Return the Looper for the main thread of the current process.
(Inherited from ContextWrapper)
Returns the absolute path to the directory on the filesystem similar to FilesDir.
(Inherited from ContextWrapper)
Return the primary external storage directory where this application’s OBB files (if there are any) can be found.
(Inherited from ContextWrapper)
Return the package name that should be used for android.app.AppOpsManager calls from this context, so that app ops manager’s uid verification will work with the name.
(Inherited from Context)
Return the full path to this context’s primary Android package.
(Inherited from ContextWrapper)
Return PackageManager instance to find global package information.
(Inherited from ContextWrapper)
Return the name of this application’s package.
(Inherited from ContextWrapper)
Return the full path to this context’s primary Android package.
(Inherited from ContextWrapper)
Return the set of parameters which this Context was created with, if it was created via #createContext(ContextParams) .
(Inherited from Context)
Return a Resources instance for your application’s package.
(Inherited from ContextWrapper)
Return the Theme object associated with this Context.
(Inherited from ContextWrapper)
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
Methods
Set the base context for this ContextWrapper.
(Inherited from ContextWrapper)
Same as #bindService(Intent, ServiceConnection, int) with executor to control ServiceConnection callbacks.
(Inherited from Context)
Connect to an application service, creating it if needed.
(Inherited from ContextWrapper)
Determine whether the calling process of an IPC or you have been granted a particular permission.
(Inherited from ContextWrapper)
Determine whether the calling process of an IPC or you has been granted permission to access a specific URI.
(Inherited from ContextWrapper)
Determine whether the calling process of an IPC or you has been granted permission to access a list of URIs.
(Inherited from Context)
Determine whether the calling process of an IPC you are handling has been granted a particular permission.
(Inherited from ContextWrapper)
Determine whether the calling process and user ID has been granted permission to access a specific URI.
(Inherited from ContextWrapper)
Determine whether the calling process and user ID has been granted permission to access a list of URIs.
(Inherited from Context)
Determine whether the given permission is allowed for a particular process and user ID running in the system.
(Inherited from ContextWrapper)
Determine whether a particular process and user ID has been granted permission to access a specific URI.
(Inherited from ContextWrapper)
Check both a Uri and normal permission.
(Inherited from ContextWrapper)
Determine whether a particular process and user ID has been granted permission to access a list of URIs.
(Inherited from Context)
Creates and returns a copy of this object.
(Inherited from Object)
Return a new Context object for the current Context but attribute to a different tag.
(Inherited from Context)
Return a new Context object for the current Context but whose resources are adjusted to match the given Configuration.
(Inherited from ContextWrapper)
Creates a context with specific properties and behaviors.
(Inherited from Context)
Return a new Context object for the current Context but whose resources are adjusted to match the metrics of the given Display.
(Inherited from ContextWrapper)
Return a new Context object for the given application name.
(Inherited from ContextWrapper)
Creates a Context for a non-activity window.
(Inherited from Context)
Creates a Context for a non-activity window.
(Inherited from Context)
Returns an array of strings naming the private databases associated with this Context’s application package.
(Inherited from ContextWrapper)
Delete an existing private SQLiteDatabase associated with this Context’s application package.
(Inherited from ContextWrapper)
Delete the given private file associated with this Context’s application package.
(Inherited from ContextWrapper)
Print the Service’s state into the given stream.
(Inherited from Service)
If neither you nor the calling process of an IPC you are handling has been granted a particular permission, throw a SecurityException.
(Inherited from ContextWrapper)
If the calling process of an IPC or you has not been granted permission to access a specific URI, throw SecurityException.
(Inherited from ContextWrapper)
If the calling process of an IPC you are handling has not been granted a particular permission, throw a SecurityException.
(Inherited from ContextWrapper)
If the calling process and user ID has not been granted permission to access a specific URI, throw SecurityException.
(Inherited from ContextWrapper)
If the given permission is not allowed for a particular process and user ID running in the system, throw a SecurityException.
(Inherited from ContextWrapper)
If a particular process and user ID has not been granted permission to access a specific URI, throw SecurityException.
(Inherited from ContextWrapper)
Enforce both a Uri and normal permission.
(Inherited from ContextWrapper)
Indicates whether some other object is «equal to» this one.
(Inherited from Object)
Returns an array of strings naming the private files associated with this Context’s application package.
(Inherited from ContextWrapper)
Returns a color associated with a particular resource ID and styled for the current theme.
(Inherited from Context)
Returns a color state list associated with a particular resource ID and styled for the current theme.
(Inherited from Context)
Retrieve, creating if needed, a new directory in which the application can place its own custom data files.
(Inherited from ContextWrapper)
Returns a drawable object associated with a particular resource ID and styled for the current theme.
(Inherited from Context)
Returns absolute paths to application-specific directories on all external storage devices where the application can place cache files it owns.
(Inherited from ContextWrapper)
Returns the absolute path to the directory on the primary external filesystem (that is somewhere on ExternalStorageDirectory) where the application can place persistent files it owns.
(Inherited from ContextWrapper)
Returns absolute paths to application-specific directories on all external storage devices where the application can place persistent files it owns.
(Inherited from ContextWrapper)
Returns absolute paths to application-specific directories on all external storage devices where the application can place media files.
(Inherited from ContextWrapper)
Returns the absolute path on the filesystem where a file created with OpenFileOutput(String, FileCreationMode) is stored.
(Inherited from ContextWrapper)
Returns a hash code value for the object.
(Inherited from Object)
Returns absolute paths to application-specific directories on all external storage devices where the application’s OBB files (if there are any) can be found.
(Inherited from ContextWrapper)
Retrieve and hold the contents of the preferences file ‘name’, returning a SharedPreferences through which you can retrieve and modify its values.
(Inherited from ContextWrapper)
Returns a localized string from the application’s package’s default string table.
(Inherited from Context)
Returns a localized string from the application’s package’s default string table.
(Inherited from Context)
Return the handle to a system-level service by class.
(Inherited from Context)
Return the handle to a system-level service by name.
(Inherited from ContextWrapper)
Return a localized, styled CharSequence from the application’s package’s default string table.
(Inherited from Context)
Return a localized, styled CharSequence from the application’s package’s default string table.
(Inherited from Context)
Grant permission to access a specific Uri to another package, regardless of whether that package has general permission to access the Uri’s content provider.
(Inherited from ContextWrapper)
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
(Inherited from Object)
Wakes up a single thread that is waiting on this object’s monitor.
(Inherited from Object)
Wakes up all threads that are waiting on this object’s monitor.
(Inherited from Object)
Retrieve styled attribute information in this Context’s theme.
(Inherited from Context)
Retrieve styled attribute information in this Context’s theme.
(Inherited from Context)
Retrieve styled attribute information in this Context’s theme.
(Inherited from Context)
Retrieve styled attribute information in this Context’s theme.
(Inherited from Context)
Implement to return the implementation of the internal accessibility service interface.
Called by the system when the device configuration changes while your component is running.
(Inherited from Service)
Called by the system when the service is first created.
(Inherited from Service)
Must be implemented to return a new instance of the wallpaper’s engine.
Called by the system to notify a Service that it is no longer used and is being removed.
(Inherited from Service)
This is called when the overall system is running low on memory, and actively running processes should trim their memory usage.
(Inherited from Service)
Called when new clients have connected to the service, after it had previously been notified that all had disconnected in its #onUnbind .
(Inherited from Service)
Called by the system every time a client explicitly starts the service by calling android.content.Context#startService , providing the arguments it supplied and a unique integer token representing the start request.
(Inherited from Service)
This is called if the service is currently running and the user has removed a task that comes from the service’s application.
(Inherited from Service)
Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.
(Inherited from Service)
Called when all clients have disconnected from a particular interface published by the service.
(Inherited from Service)
Open a private file associated with this Context’s application package for reading.
(Inherited from ContextWrapper)
Open a private file associated with this Context’s application package for writing.
(Inherited from ContextWrapper)
Open a new private SQLiteDatabase associated with this Context’s application package.
(Inherited from ContextWrapper)
Open a new private SQLiteDatabase associated with this Context’s application package.
(Inherited from ContextWrapper)
Add a new ComponentCallbacks to the base application of the Context, which will be called at the same times as the ComponentCallbacks methods of activities and other components are called.
(Inherited from Context)
Register a BroadcastReceiver to be run in the main activity thread.
(Inherited from ContextWrapper)
Register to receive intent broadcasts, to run in the context of scheduler .
(Inherited from ContextWrapper)
(Inherited from ContextWrapper)
Remove all permissions to access a particular content provider Uri that were previously added with M:Android.Content.Context.GrantUriPermission(System.String,Android.Net.Uri,Android.Net.Uri).
(Inherited from ContextWrapper)
Broadcast the given intent to all interested BroadcastReceivers.
(Inherited from ContextWrapper)
Broadcast the given intent to all interested BroadcastReceivers, allowing an optional required permission to be enforced.
(Inherited from ContextWrapper)
Version of SendBroadcast(Intent) that allows you to specify the user the broadcast will be sent to.
(Inherited from ContextWrapper)
Version of SendBroadcast(Intent, String) that allows you to specify the user the broadcast will be sent to.
(Inherited from ContextWrapper)
Broadcast the given intent to all interested BroadcastReceivers, allowing an array of required permissions to be enforced.
(Inherited from Context)
Version of SendBroadcast(Intent) that allows you to receive data back from the broadcast.
(Inherited from ContextWrapper)
Perform a #sendBroadcast(Intent) that is «sticky,» meaning the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of #registerReceiver(BroadcastReceiver, IntentFilter) .
(Inherited from ContextWrapper)
Perform a #sendBroadcast(Intent) that is «sticky,» meaning the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of #registerReceiver(BroadcastReceiver, IntentFilter) .
(Inherited from Context)
(Inherited from ContextWrapper)
Sets the Handle property.
(Inherited from Object)
Set the base theme for this context.
(Inherited from ContextWrapper)
Same as StartActivities(Intent[], Bundle) with no options specified.
(Inherited from ContextWrapper)
Launch multiple new activities.
(Inherited from ContextWrapper)
Same as StartActivity(Intent, Bundle) with no options specified.
(Inherited from ContextWrapper)
Launch a new activity.
(Inherited from ContextWrapper)
If your service is started (running through Context#startService(Intent) ), then also make this service run in the foreground, supplying the ongoing notification to be shown to the user while in this state.
(Inherited from Service)
If your service is started (running through Context#startService(Intent) ), then also make this service run in the foreground, supplying the ongoing notification to be shown to the user while in this state.
(Inherited from Service)
Start executing an Instrumentation class.
(Inherited from ContextWrapper)
Like StartActivity(Intent, Bundle), but taking a IntentSender to start.
(Inherited from ContextWrapper)
Request that a given application service be started.
(Inherited from ContextWrapper)
Remove this service from foreground state, allowing it to be killed if more memory is needed.
(Inherited from Service)
Remove this service from foreground state, allowing it to be killed if more memory is needed.
(Inherited from Service)
Stop the service, if it was previously started.
(Inherited from Service)
Stop the service, if it was previously started.
(Inherited from Service)
Stop the service if the most recent time it was started was startId .
(Inherited from Service)
Request that a given application service be stopped.
(Inherited from ContextWrapper)
Returns a string representation of the object.
(Inherited from Object)
Disconnect from an application service.
(Inherited from ContextWrapper)
Remove a ComponentCallbacks object that was previously registered with #registerComponentCallbacks(ComponentCallbacks) .
(Inherited from Context)
Unregister a previously registered BroadcastReceiver.
(Inherited from ContextWrapper)
For a service previously bound with #bindService or a related method, change how the system manages that service’s process in relation to other processes.
(Inherited from Context)
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
(Inherited from Object)
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
(Inherited from Object)
Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.
(Inherited from Object)
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
Performs an Android runtime-checked type conversion.
Источник