# Precautions
# 1 Memory
# 1.1 Memory requirements
Do not exceed 35M for more than 90% of the time period of CPU operation. CPU usage shall not exceed 10% overall.
# 1.2 Memory usage principle
- The maximum memory that can be used by a single App is 48M. If exceeded, the memory overflow will be reported.
- Be careful to use memory allocation under the native level to prevent memory leaks.
- It is prohibited to apply large memory under the native level to avoid exceeding the 48M memory limit.
- Try to use an image with a well-matched size, and use the resource cache appropriately.
- Try to use the background service independent process running method.
- Reuse the resources that come with the system.
- Avoid creating objects in the onDraw method.
- Optimize the layout hierarchy, reduce memory consumption and ensure that View is not overdrawn.
# 2. Power optimization
- Use the wake-up lock with caution, and remember to release it after using it for special requirements.
- Be sure to check the status of the network for services that need to request the network, and avoid retrying work in a repeated manner.
- The background service should merge or reduce the necessary wake-up work.
- To avoid the situation where the screen is always on, there must be a time limit for screen-always-on.
- Minimize log printing.
- Avoid static broadcast monitoring.
# 3. Installation package size
- If the ROM of the watch model reaches up to 4G and above: the size of the installation package should not exceed 30M, and the space occupied after installation should not exceed 40M.
- If the ROM of the watch model is 512M: the size of the installation package should not exceed 10M, and the space occupied after installation should not exceed 15M.
# 4. Hot updates disabled
All new features are required to be reviewed by the imoo App store, and hot updates shall not be allowed.
# 5. Storage specifications
- After an App is uninstalled, data related to that App can be completely deleted.
- Third-party App storage can only be implemented under the package name /sdcard/Android/data/third-party/or package name directory /data/data/.
- The third party itself needs to handle the matters after data has been deleted. If the downloaded music has been deleted, the playlist should not be displayed.
- When the user cleans up the space, the watch will delete the package name /sdcard/Android/data/and package name directory /data/data/.
- In principle, after the user cleans up the space, the space occupied by the third-party App should be the same as before its initial installation.
# 6. Traffic usage
As traffic consumption is an issue to which users pay close attention, reminders and management of traffic usage need to be supported.
# 6.1 Reminders and restrictions for traffic usage
- For the first time using network traffic, the user must be reminded by Toast.
- When the network is disconnected, the audio needs to be paused. When the network is connected, playback is not allowed to be resumed, leaving the pause state intact.
- In principle, the favorite broadcast audio should be cached as much as possible. When quickly switching to other audio, the stopping of mediaPlayer should be called in an active manner and the caching of the previous audio should be cancelled, thereby reducing traffic consumption.
# 6.2 Traffic switch
The imoo parent-end App currently controls the traffic switch of a single App on the watch, and the usage experience of the App requires further attention when traffic is disabled.
- Related files for traffic switch
See the attachment "Java files for traffic switch"
- The code determines whether it is currently disabled or not
NetworkPolicyForApp networkPolicyForApp = new NetworkPolicyForApp(context);
boolean isDisabled = networkPolicyForApp.isMobileTrafficDisabled("packageName");
# 7. Audio focus conflict
# 7.1 Apps with sound playback should correctly handle the acquisition and loss of audio focus
Achieve the acquisition of audio focus before starting playback. In case of the loss of audio focus, pause playback.
# 7.2 Audio playback sequence
- The watch does not allow two or more audio files to be played simultaneously.
- Audio playback follows a sequence. If a new application for audio focus occurs, the previous active one will pause automatically.
# 7.3 Audio cache problem
Asynchronous caching can easily result in ANR. It is preferable to use the synchronous caching method to enable sub-thread synchronous caching.