Huawei Safety Detect checkURL API threat return empty list even when using malicious url for testing

Issue

Im trying to check if url is malicious in my app. But the output always return that the link is safe even when i put malicious link. Im developing the app using Android Studio and use both GMS and HMS library. Im running the app on my device which is Samsung and its working fine except for the problem i mention above. Help me please.
And one more thing, I’ve downloaded the appGallery on my phone and install hms core. But do i still need to convert gms library to hms library?
Thank you.

This is the response code.

 @Override
                public void onSuccess(UrlCheckResponse urlCheckResponse) {
                    

                    List<UrlCheckThreat> list = urlCheckResponse.getUrlCheckResponse();
                    if (list.isEmpty()) {
                        // No threats found.
                        testRes.setText("No threats found.");
                    } else {
                        for (UrlCheckThreat threat : list){
                            int type = threat.getUrlCheckResult();

                            if(type == UrlCheckThreat.MALWARE){
                                //threat.getUrlCheckResult();
                                testRes.setText("Malware found!");
                            }
                            else {
                                if (type == UrlCheckThreat.PHISHING)
                                    //threat.getUrlCheckResult();
                                    testRes.setText("Phishing found!");
                            }
                        }

                    }

                }

Solution

Apparently, the API to check list of malicious URL took time to function. The response code was functioning well and can detect the malicious URL. Thank you for all the responses.

Answered By – Yamin

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published