Android APP cannot receive push messages when switched to the background. androidapp

Source: Internet
Author: User

Android APP cannot receive push messages when switched to the background. androidapp

1. After the Android process is killed, the active mechanism of message reception in the background is protected. There is no good mechanism for the moment to stay active under any circumstances

Android native systems can use the home key to kill the process. If it is forced to stop, you can only manually start the application on your own.

For third-party applications such as miui, Kill processes cannot be started by default.
If it is a root native system, there is no way to kill the process. In this case, the push cannot be received.

 

If it is a native system, there is no root, as long as it is not forced to stop, other built-in stop methods can be self-started, generally restored within 10 s


Currently, the following third-party systems are known to affect applications:
Xiaomi [MIUI]
Auto-start management: add the application to the auto-start management list. Otherwise, the process cannot be enabled after the process is killed or restarted.
Notification Bar Setting: by default, notifications in the notification bar are displayed for the application. If the notification is disabled, no notification is displayed.

Huawei [Emotion]
Auto-start management: add the application to the "auto-start management" list. Otherwise, the process will not be enabled after the process is killed or restarted. You can only manually enable the application.
Background application protection: You need to manually add the application to this list. Otherwise, the application process is automatically killed when the device goes to sleep. You can resume operation only when the application is manually enabled.
Notification management: three application statuses are available: prompt, allow, and disable. If the application is disabled, no notifications will be sent to the notification bar.

Meizu Flyme]
Auto-start management: You need to add the application to the auto-start management list. Otherwise, kill the process or restart the system to enable the process.
Notification bar push: If the Application Notification is disabled, no message is displayed.

VIVO [Funtouch OS]
One-click memory cleaning: You need to add the application to the White List. Otherwise, the "one-click acceleration" provided by the system will kill the process.
Auto Start management: You need to add the application to the "auto start management" list in "I manager". Otherwise, the process will not start automatically after the mobile phone is restarted. However, the process is forcibly killed. Even if the list is added, subsequent processes cannot be started by themselves.

OPPO [ColorOS]
Freeze Application Management: You need to add the application to the pure background. Otherwise, messages cannot be received in time when the screen is locked.

Auto-start management: When you add an application to the auto-start management list, you also need to go to settings-Application-running to lock the application process. Otherwise, the process will not be enabled after the process is killed or started, only applications can be manually Enabled

 

Currently, the push's active/standby mechanism is basically

1. Relying on receiving and calling of System broadcast

Commonly used: 1. Screen Lock unlock broadcast 2. Network status change broadcast 3. Installation Package broadcast, uninstall package broadcast 4. Storage mounting unmount Broadcast

Android. intent. action. USER_PRESENT
Android.net. conn. CONNECTIVITY_CHANGE
Android.net. wifi. RSSI_CHANGED
Android.net. wifi. STATE_CHANGE
Android.net. wifi. WIFI_STATE_CHANGED

Android. intent. action. MEDIA_UNMOUNTED
Android. intent. action. MEDIA_REMOVED
Android. intent. action. MEDIA_CHECKING
Android. intent. action. MEDIA_EJECT

2. Different apps on the same mobile phone use the same SDK to pull each other

Through the LBE Security Master, you can see QQ through push, JPUSH, Xiaomi push, Open Platform interface broadcast, Sina SAE cloud push, qq browser push status broadcast, multiple push methods, such as mobile QQ Broadcast Reception, wake up each other

Can I try using QQ.

Try to use com. tencent. mm package name. On meizu NOTE2, a service is created in another zzh, and the test is printed every second in the service. It is found that the service can continue to be executed normally after the menu is closed, in this case, the APP continues to run in the cache process, and the cache process is closed completely.

QQ when I killed QQ in the running and cache processes on meizu NOTE2, and no other QQ can wake up, QQ cannot receive push messages.

3. Can I try to rely on a mobile phone's own PUSH Service?

Determine whether the current push method is successful one by one. If the push method fails, change to the next push method.

You can also report the login information after logging on to the APP. Based on the feedback, You can first use the PUSH Service of the current mobile phone.

Meizu does not have its own PUSH Service.

4. How to kill the 360 mobile assistant?

Find a root mobile phone. If not, find a 360-click root. After the adb shell enters, run the su command. After the root permission is obtained, go to data/app, copy the base.apk file in my Taobao com.qihoo.appstorefile to a usable folder (for example,/mnt/sdcard/tmp), and then adb pull/mnt/sdcard/tmp c, compile the code by decompiling to see the implementation.

It is found that there is a deamon daemon library, libCoreDaemon. so to see how to use it. It has been found that the library cannot be loaded, System. loadLibrary ("CoreDaemon"); an error is reported and loading fails.

 

 

1. Try the package name used on meizu and find that the APP is disabled through the menu, and the background service can still be executed
2. decompile the 360 JAVA code and check the active mechanism. If you do not understand it, try to use its third-party code and find that it cannot be loaded.
3. Try to integrate the two pushes, Xin Ge and JPUSH, and find that the survival rate is still not high
4. Try to integrate message push from multiple mobile phone systems and find no push services such as VIVO and meizu
5. Try to wake up the alarm, and the alarm will not work when the alarm is disabled at 5.1 with the APP
6. Find an example on GITHUB. If JNI is enabled, neither the front-end service nor the dual-JAVA Service will work.
7. After trying ROOT, the system permission is not used as ROOT.
8. Two apps use different users, and one of them is disabled to pull another one.
9. Try or QQ broadcast, which can wake up our APP and no broadcast can wake up
10. Try to set up a receiver to receive broadcasts from all the pushed daemon to start our own service. LBE shows that there are mutual wake-up paths, but no wake-up service does not wake up.

 

 

Basically, I made a new attempt.

Problem 1. Where does JNI run? Start the service to confirm whether the C process exists after the APP is closed through the Task Manager
A dynamic link library file is an unexecutable binary program file that allows the program to share the code and other resources necessary to execute special tasks, but to load it to a resource file in the memory, only test and java belong to the same process, different threads
JAVA Virtual Machine is similar to a sandbox. application processes share the same JAVA core library of zygote. Android processes and threads are actually consistent with liunx Process Management. In Android, fork creates processes and clone creation threads.
Am startservice-n com. uhealth. member/cn. jpush. android. service. DaemonService package name/Class Name
Push is through
Am startservice-a cn. jpush. android. intent. DaemonService wake up each other
When meizu fails to start the static registration broadcast receiver process, it does not start, that is, it sets
Service:
PackageManagerService parses the APK and is responsible for installation and directory production under/data. It stores information about all components in the memory (Acitivity, Service) and provides external data query.
ActivityManagerService manages ActivityRecord, TaskRecord, and processRecord, and checks whether a new process needs to be created based on uid and processname. When a new process is created, a message is sent to zygote and an Application is bound to the new process, then start Activity or Service
Question 2: Can I start it?
Flyme3.1 enable auto-start upon startup: You can choose Settings> application control> enable startup.
In Flyme4.0, you can choose Settings> Application Management> (click the software you want to set)> permission management> auto start. Then, click Close or open. Enable auto-start. You can restart it.
The so-called self-start management means that the static registered broadcast receiver process cannot receive broadcasts when it is not started. When the DEMO program is started automatically, it will also start automatically when it receives the sent broadcast.
Externally exposed services can be started through broadcast.

Problem 3:

Try to generate the sub-process of the sub-process, and then kill the sub-process to see if 360 of the sub-process exceptions dependent on init can be formed.
360 is not connected by generating a child process and killing the parent process
Create two processes through the JAVA layer, two JAVA services in two processes, one java service service1 to wake up another JAVA service service2, and one C thread will be started in service2, create its sub-processes, and then run the command to kill the process of service2. The sub-process becomes the sub-process of init. The sub-process is always running, and then close the DEMO program through the task manager, not self-started

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.