AntiVirus kills my application

I am working on an Android application that uses Bluetooth to communicate with the nearest PC. The application works very well on my own device ( Samsung Galaxy Note 3 - CM 12.1 ), but on my beta testers this is not so.

Simply put, the application allows people to write and receive SMS from their PC (with my C # WPF application) via Bluetooth and their phone.

My beta tester uses a Samsung Galaxy Note 4 (Lollipop) drive .

At first, I thought that when its screens turn off, Android will kill MainActivity, which is held on several threads, including a supporting connection (using the inpustream.read() blocking method). This behavior does not occur on my own device: I could keep in touch for the whole night without connecting my phone.

I was warned, however, that using services would avoid such a problem, because Android does not behave the same from one device to another. So I updated my application and made my MainActivity using my MainService to create relative threads. But that didn’t change anything.

As my name says, the problem lies in its antivirus and more precisely: AVG. I don’t know how such an antivirus works on Android, and I don’t even use it. Freezing AVG with titanium redundancy on my Note 4 root galaxy, my stopepd application crashes and now works just fine, as intended.

So, I wonder why AVG decided to kill my application when the device screen turned off? How should the application behave so that it does not happen to other users using AVG or any other antivirus? What should I do so that my application does not look suspicious?

+5
source share
1 answer

I do not know exactly what AVG did for your application. But I think that AVG may not allow your application to turn on Bluetooth or use Bluetooth when the Android device is in sleep mode or sends / receives SMS. AVG is a type of anti-virus application, most of which have many resolution or energy saving restrictions, especially on Android root devices or the first application on Android devices.

Try to clarify what exactly with AVG real place in your application. Then try to solve your problems with the help of the gentle and smart.

For instance:

1.If AVG does not allow you to use BluetoothAdapter.enable () to force Bluetooth on, try using Activity.startActivityForResult () so that users can choose whether to enable Bleutooth or not.

2. If AVG does not allow you to use Bluetooth when your Android device is in sleep mode. You can try using WakeLock.acquire () to store your Android device.

3. If AVG does not allow you to use sending or receiving SMS. You can change another communication protocol, SPP or BLE or something else.

You may have heard Xiaomi. If you are an Android developer in China because Xiaomi is very popular in China, you have to deal with the adaptation with Xiaomi, and then you will find that Xiaomi is really fucking for Android developers in China.

Xiaomi has no really amazing things for the original Android. For instance:

1. AlertDialog..getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); you cannot warn the TYPE_SYSTEM_ALERT dialog on some xiaomi drives that they say nothing.

2.Xiaomi has changed many original themes.

3.Xiaomi has changed the Android alarm synchronization mechanism, while the device is a dream called Wake-Up-Alignment. This is really terrible for apps with a sync feature.

The above problems are that I met in Android development, some problems I can solve, some you have no chance to change it.

Remember that: the adaptation with Android devices is that you have to tell your users that the application works on most popular Android devices, developers are trying to get the application to work on most Android devices, but maybe this does not work on some Android devivces with customized ROMs or with some special applications of the third part. What is it true that Android.

If the problem cannot be solved, this is not a problem!

0
source

All Articles