HarmonyOS application development-preferences and background notification management

Preferences Today, as the mobile Internet is booming, mobile applications have brought great convenience to our lives. The essence of these conveniences lies in the interconnection of data. Therefore, data storage plays a very important role in application development, and HarmonyOS application development is no exception. This chapter takes the preferences of HarmonyOS as an […]

USB Preferences-Android13

USB Preferences 1. USB preference setting interface and entrance 2. USB function settings 2.1 USB function corresponding mode 2.2 Click Settings 2.3 Broadcast monitoring refresh 3. Log switch 3.1 Evet log 3.2 Log switch in code 3.3 Key logs 4. Abnormal 1. USB preference interface and entrance Settings>Connected devices>USB packages/apps/Settings/src/com/android/settings/connecteddevice/usb/UsbDetailsFragment.java packages/apps/Settings/res/xml/usb_details_fragment.xml private static List<UsbDetailsController> createControllerList(Context […]

Android-SharedPreferences detailed usage

Directory SharedPreferences 1. Introduction 2. Understand 1 data storage 2 Data reading 3 common methods 3.1 getSharedPreferences() 3.2 edit() 3.4 remove() remove data 3.5 clear() clears data 3.6 commit() submits and saves data 3. Basic use 1 an example 4. Monitoring 5. Performance analysis 6. Points of attention during use 1 Get the SharedPreferences object […]

Android source code analysis: Analysis of SharedPreferences

Android source code analysis: Analysis of SharedPreferences Introduction SharedPreferences is a lightweight data persistence method in Android. It may also be the first special local data persistence method we come into contact with when learning Android. This article will analyze the principle of SharedPreferences from the source code perspective. Source code analysis Generally we use […]

SharedPreferences stores small amounts of application configuration data

SharedPreferences are a simple way in Android to store small amounts of application configuration data. SharedPreferences is a mechanism for lightweight data storage on the Android platform. It provides simple methods to save and get basic types of data, such as boolean, float, int, long and string. Note: SharedPreferences does not support storing large amounts […]

Reflection to modify other APP SharedPreferences data

Reflection to modify other APP SharedPreferences data Prerequisites Available codes Prerequisite The device is rooted, otherwise the data/data directory cannot be accessed Problem symptoms: HIE_Find(com.estrongs.android.pop) APP can directly open the usb storage device, but the usb device node name changes after each plug and unplug, and the last opened path will always be remembered when […]

Android 11 removes the three menus [Bluetooth], [Cast], and [Files received via Bluetooth] in the connection preferences.

Encountered a project that does not require WiFi or Bluetooth. The customer requested that the Bluetooth-related function menu items in Settings be removed. Because the hardware is not attached, the software corresponding to it must also be removed, because the IC chip is Bluetooth and WiFi is two-in-one, so in fact WiFi is also not […]

Performance Optimization: How to Completely Solve the Caton Caused by SharedPreferences

Background After launching the ANR monitoring platform, a lot of ANR logs have been collected online. From the flame graph information, the function is blocked on QueuedWork related functions. This article mainly introduces the reasons for this phenomenon and how to solve this problem. The solution introduced in this article has been put on github […]

android jetpack DataStore (java) instead of SharedPreferences

Table of Contents How to use Preferences DataStore? import dependencies Create a Preferences DataStore read content write content How to use Proto DataStore? import dependencies create proto Create a Serializer Use DataStore DataStore provides two different implementations: Preferences DataStore and Proto DataStore. Preferences DataStore stores and accesses data using keys Proto DataStore stores data as […]

Android experiment nine – use SharedPreferences to store simple data

Complete the following procedures (the main Activity interface is shown in Figure 1): Click the “Parameter Settings” button in Figure 1 to start the Activity shown in Figure 2. After the user enters the user name in Figure 2, click the “OK” button to close the Activity (you need to use SharedPreferences.Editor Save the username), […]