An implementation of uninstalling the Android app pop-up browser

Source: Internet
Author: User

When you uninstall an Android app, you often pop up a webpage and do some survey statistics on your user data. Android is able to get to other apps that are uninstalled from this event, but can't get itself unloaded by this event. From the pure Java layer is impossible to achieve, This article describes a method to implement it.


Principle

In simple terms, create a background process to monitor the folder's delete events. For example, the app's package name is Com.myname.myapp, the background Process monitoring folder is/data/data/com.myname.myapp. How to monitor the folder is deleted this event is mainly used by the INotify series functions, which are described in another way of implementing process communication in JNI.


Watch out.

    1. Background process only need one on the line, do not need multiple, before I noticed that a penguin product to do this function, the background started a number of processes. How is it implemented? You can refer to the Android JNI layer to ensure that only one implementation of the process provides a way of thinking.

    2. Several key test cases: a. Clean the app's data B. Upgrade app C. Force the app to close and restart the app.


Code

GitHub Address Uninstallwatcher

Code implementation and demo have, the interface has been packaged well, to determine whether the background process is unique, a bit too simple, Welcome to complete the code .

The code is also very simple to use.

public class DemoApp extends application{@Overridepublic void OnCreate () {log.i ("Uninstalldemoapp", "onCreate"); Watchdog.init2 ("Com.bananachip.uninstall", "libwatchdog.so", watchdog.getuserserial (This), "http://www.baidu.com" ); Super.oncreate ();}}

Programmers can understand and do not explain.

In this implementation, it is simpler to judge whether the process exists, just the query process name libwatchdog.so. You should change your name when you use it.


How do I compile?

The JNI section is not compiled by Eclipse.

CD JNI

Ndk-build

Rename.bat

Run demo with Eclipse


Other

1. This article refers to other blogs, but there are a lot of problems with blogging.

2. Not all Android models will be able to pop up web pages after deleting the app, such as Xiaomi, Red rice, which can be added to the background process for additional management.


------------Welcome anticipate

------------by Jacksonke




An implementation of uninstalling the Android app pop-up browser

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.