[AT&T Samsung Galaxy S 4 General] GalaxyMasterI337:
Background

I found my AT&T Samsung Galaxy S4 in a hotel room I was staying in. It was just my luck, too, considering my S2 on T-Mobile had just undergone it's own death due to the screen not working, and I didn't have the cash to buy another phone. So my plan was to SIM unlock my new (kind of!) S4 and use it on my T-Mobile plan, with my T-Mobile SIM card. I had already factory reset the thing, rooted it (Towelroot + SuperSU) and installed Safestrap. I also found out it was on NB1, which, after a lot of research, meant I couldn't do the things some other users could because of the locked bootloader.

After my stay at the hotel was over, I went home. I tried the following methods to unlock it, but none would work. Here are the methods and their respective errors. These are all designed for the I337 (our phone) and some even explicitly say they'll work on NB1, but they obviously didn't.

http://xdaforums.com/showthread.php?t=2282683

Pressing *#0011# worked, but following the instructions, nothing changed, and it would stay on the first screen.

http://xdaforums.com/showthread.php?t=2514607

I had rooted with Towelroot, installed SuperSU, and then tried RegionLock Away. It said it was successful, but my SIM was still invalid.

http://www.droidviews.com/how-to-sim-unlock-t-mobile-att-galaxy-s4-sgh-m919-sgh-i337/

Apparently, you need an AT&T SIM for the *#267, etc. code to work. I didn't have one, so it didn't launch the ServiceMode menu.

Then, I read something on XDA about the ServiceMode menu working properly after installing MF3 modems, so I flashed the MF3 modems via Safestrap, and tried the codes again, but they didn't work. Having lost all hope, I almost went to buy an unlock code. But I didn't. Because I'm stubborn. So, instead, I decided to try RegionLock one more time, and voila, it worked. I'm pretty sure it was the MF3 modem that caused it to work, but I'm going to list out every step I took for this to work, just in case.

TL;DR: If you want to SIM unlock your AT&T Samsung Galaxy S4, but the codes nor RegionLock has been working for you, you don't have an AT&T SIM card *AND* you're on NB1, this should work for you. This should also probably work on MK2 and NC1.

I am not to be held responsible if you mess up your precious S4 during the course of this guide in any way.

Also, all of the files needed (all of them) are available at the bottom.

HOW TO SIM UNLOCK YOUR NB1 GALAXY S4 IF ALL ELSE FAILS

**MAKE SURE THERE IS NO SIM CARD WHATSOEVER IN YOUR PHONE UNTIL SAID TO PUT ONE IN**

1.) Install stock NB1

For this guide, we obviously need *stock* NB1 on our S4. Either backup and do a full factory reset if you're already on it, or flash NB1 via Odin. I'm not going to show you step by step how to flash NB1 via Odin onto your Galaxy S4, so I'll link to a guide if you need it.

http://xdaforums.com/showthread.php?t=2663545

2.) Root your S4

Now we need to root our Galaxy S4. Go into Settings, click on the 'More' tab, and then click on 'Security'. Now, change the security level to 'Normal' and check 'Unknown Sources'. Exit out of Settings. Now, download the two included files, one is Towelroot, and the other is SuperSU. Install Towelroot (click on it in the Notification bar, or in the Downloads app), and after it's installed, open it and click 'make it ra1n'. If your phone didn't reboot, you're good to go. You can exit Towelroot now. Next, download, install, and run SuperSU. It's also included at the bottom. Click 'Normal Mode' when it asks how you want to update the binary. When that's done, it will ask you if you want to disable KNOX. Click yes, and it should say KNOX is disabled. Now you can reboot your phone. If it keeps trying to disable KNOX for more than a couple of minutes, reboot your phone. After you've rebooted it, open SuperSU again regardless of whether or not KNOX was disabled. Click yes if it asks you to disable KNOX again, and it should work this time.

3.) Installing Safestrap

Us NB1 users aren't so lucky- we still have a locked bootloader. That means we can't install normal recoveries like CWM or TWRP. However, we can install Safestrap. From the bottom, download the included Safestrap APK and install it. Open it, click 'Install' and grant it root access. Let it finish, and if you are now able to click the 'Reboot' option below 'Uninstall', it worked. Don't reboot.

NOTE: If the 'Reboot' option is still greyed out after you 'Install' Safestrap, that means it didn't install. DO NOT PANIC! There is a very quick fix to this. Simply go to the Play Store and download 'SELinux Mode Changer'. After it's installed, open it, grant it root access, and change the mode to 'Permissive'. Now, open Safestrap again, click 'Install', and after it's finished, the option to reboot should be available. That means it worked. :)

4.) Let's talk about MF3, baby!

Download the included MF3 Modules ZIP file from the link down below. The ZIP was too big to attach to this post. Now turn off your device. Boot it back up, and you should see a screen with a little robot. Press the menu key under 'Recovery' to boot into Safestrap. Now, click 'Install' in Safestrap, and navigate to your Downloads folder, where the MF3 Modules ZIP file is located. Select it, and install it. Now, reboot to 'System'. When you see the robot screen again, press the back key under 'System' to boot into Android.

http://d-h.st/ReU

5.) Installing RegionLock Away

Now, we have to install and flash RegionLock Away. It was originally created to remove region locks on the Note 3, but various S4 users reported it to SIM unlock their phone, and after following the steps above, it will SIM unlock your S4 as well! Download the included RegionLock Away APK from below, install it, and click 'Remove Region Lock' (I believe that's what the button says). Grant it root access, and when it asks you to reboot, accept it.

6.) This is the best part...

We get to sit and wait. Once your phone boots up again, unlock it and go to the dialer. Type *#0011# (this isn't what you think it is) and wait until ServiceMode pops up (it should take a while). Once it pops up, wait at least 60 seconds and then remove your battery. Now, put your alternative (non-AT&T) SIM card in it. Put your battery back in, put your back on again, and turn your phone on.

7.) No, THIS is the best part!

Tired of that 'Invalid SIM card', or 'No SIM card' error? So was I. Well, a weight has just been lifted off of your shoulders. Once you unlock your device (on the lock screen, not the SIM- that's what we've just done!), you shouldn't see one of those anymore. Instead, if you're using, say, a T-Mobile SIM, you should see T-Mobile on the status bar after a couple of seconds. Try texting someone, calling someone, using the internet. Another bonus is that the APNs should be preconfigured, so now it'll work out of the box.

8.) No, no, no... We're not done yet!

Now, we need to re-flash the NB1 modems. You don't have to, but it's recommended. On your device, download the NB1 Modules ZIP that is provided below and then reboot into your device, and once you're on the Robot screen, click the menu button under 'Recovery'. Now click Install, and navigate to the Downloads folder where your NB1 Modules ZIP should be and install it. Reboot into System now, and when you're at the Robot screen again, click the back key under 'System'. Nothing should change when Android boots up. Your SIM unlock should still work, and your apps, etc. should be just how you left them.

http://d-h.st/4p8

Now we're done. Feels nice, doesn't it?

BUT WAIT, THERE'S MORE!

You don't have to stay on the stock ROM anymore! You can flash any Safestrap ROM from the link below and still have SIM unlock! And, if/when the NB1 bootloader gets an unlock and you can finally install recoveries other than Safestrap, you will also be able to install ROMs other than Safestrap ready ones! Now, here's a link on how to install Safestrap ROMs, as well as a list of them. Be careful not to install ROMs for other carriers- only install ones for the i9500, i337, ATT, or if they say NB1. There is a guide hanging around here somewhere for installing ROMs from other carriers, however. But again, I'm too lazy to put that one up for you.

http://xdaforums.com/showthread.php?t=2616221

Now, NOW we're really done.

This whole process shouldn't have taken more than half an hour, and if you were already on NB1, you shouldn't have even needed to touch a computer. This whole process gave you an unlocked NB1 S4 in half an hour, using nothing but this guide and your common sense. ;)

Remember, hit thanks, reply if you've tried it, or if there's a problem with this guide.

Also, I'm new to (posting on) XDA and the S4 area in general, so go easy on me. :D