How can i fix the pop up spam of Unfortunately,GPS speed has stopped working It keeps spamming the pop up.When i press OK,it keeps popping up again and again i tried factory reset but it didn't work!also my device keeps making shortcuts of things.
These kind of malwares are sticky! You can remove them in 2 ways.

First by flashing the phone ROM and secondly  by manually removing them from the phone memory. 

The first method requires you to flash using Odin on Windows or Heimdall on Mac, just download the flashing files/firmware.


Firmware download at SamMobile or here
Odin flasher



Second method is a bit difficult for people who are not familiar with Android partition, rooting etc. because it requires root access simply because the malwares install as system apps. 

Windows only: 


Root your phone.
Download Samsung USB drivers
Download Debloater and install it.
Open USB debugging then connect the phone to the computer 
Run Debloater by clicking on the hat icon on the desktop. 
Click on Read Device Packages, all installed apps should display.
Check every suspect app that seems not familiar to you. Warning: Carefully care about the package name. If you have doubt, don't check.
Click on Apply and the software will remove/hide/disable that app and you won't be bothered anymore.


Further information about the software can be found here

Another alternative is by using ADB commands. Requires more advanced skills:


Root phone 
Install Busybox to the phone, open it and click install. 
Install Minimal ADB and Fastboot 
Open it (A terminal window)
Type adb devices [press enter] (checks if the phone is detected)
Type adb shell[press enter]
Type mount -o remount, rw /system
Now, cd to the system partition with cd /system/data[press enter]
List all installed app: ls [press enter]
All app should be listed with package names
Remove any unwanted app: rm + appName1.apk[press enter] (apps names are case sensitive).


If your phone has a priv-app folder (/system/priv-app), cd to there as well and hunt those malware.

You may encounter situation where an app return operation not permitted, because an app grant itself the immutable attribute. This is where Busybox comes to rescue.
Do as follows:


List apps attributes: lsattr[press enter]
You should see every app with their attribute. Or a specific app's attribute: lsattr + appNamw.apk [press enter]


You only have to just clear the immutable attribute. Do as follows:
 - chattr -i + appName.apk [press enter]

Then you're good to remove that app with the rm command now.

If you have questions, feel free to ask. I'll try to help.