Sometimes it just happens: You are browsing the internet on your phone, and suddenly a message appears saing your smart phone is infected by a virus. Basic advice on what to do is simple: Do not panic. Although the message may be flashing red, the phone may vibrate, and maybe even the messages stubbornly stays on your display whatever you are trying to get rid of, it does not mean that your phone has a serious problem. But you can have the problem if you panic and do something inappropriate. So - what now?
Is it a virus on your smartphone? Or just a scam?This problem is known to users of phones with Android, iOS and others. The message about the virus in the phone seems serious (even if its translation into any language may be far from perfect), and usually it tries every possible way to prevent you to left it. It just wants to force you to "hear" what it "advises".
The easiest way how this message - like "your phone has been infected with a virus," "your system is heavily damaged by four virus," "your phone was infected with a virus while you were visiting porn sites" and the like - appears on your phone is this: you went to a website that does nothing more than that haunts it's visitors. How you got there? Tapping (maybe unintendedly) on a link on another page, tapping on an ad, but sometimes another page can automatically send you there.
Why threaten website visitors? Usually for money. These web sites usually offer a link to download an "antivirus software". At best it is a real antivirus program, or at least a harmless application that will just take your money "to protect" you. In the worst case, this "virus protection" app is a virus. And once you download it, things start to happen (especially when you unthinkingly confirm all rights to manage your mobile phone to the app when installing it).
But back to the web page with the message. First: When you see it, think. What is the top address in the address bar of your browser? (You can not see it? Usually it is sufficient to swipe down from the top of the display. The address is too long? Try select History - in the browser menu - there should be visible beginning of the address, something like adresawebu.com.) Is it something suspicious at first sight? Maybe something like npy4ytjdm8.pw? Do you want to believe this page scanned your mobile phone and found that you visited a porn site and then examining carefully found that your Android (iOS etc.) smart phone got a virus? Found traces of a virus attack? Probably not, right?
A standard Mobile Internet Browser doesn't allow anything like this to websites in the first place. That would be very bad if any website could obtain detailed information from your mobile phone. A bug in your browser obviously could allow websites to perform something they should not, but usually not even the viewer has enough permissions to do too much "bad" activity - as it is prevented by your operating system, typically Android or iOS, to do it. Yes, yes, and there may be bugs in them too, but we should not be too paranoid.
So - if your browser will pop up that your Android phone - and even your specific type, like the Samsung Galaxy S7, S6, etc., Huawei P8, P9, Honor 7, 8, 4c, iPhone 5, 6, 7 etc. (because any website can check the type of your phone) - infected by a virus (or viruses), it is - with a probability so high that it borders on certainty - a scam. A scam to entice you to download a harmful - or least expensive - program (application).
So, now what? Delete browsing history, and turn off (completely) your browser. That should be enough to help you not to return to the scam web page again. Although the page maybe just annoying (but for many people it's frustrating when they have to deal with pop-up windows, vibrating cell phone and every possible effort of the fraudulent site not to close it or to move to another page). If the site still remains somewhere, you can uninstall and then reinstall back your web browser.
And if you have a really founded suspicion that you have a cell phone with a virus? It makes sense to look for some really trusted antivirus software from a well known manufacturer. Alternatively, if you consider the situation serious, you can completely erase and reinstall your smartphone. But that is really the last solution, to which most of those who just visited a questionable Web site showing a questionable warning about a virus - will never have to use.