SIM Toolkit broken on CyanogenMod 7 on Samsung Galaxy S

Note: Since I posted this I’ve learned a lot more about this problem. There’s a lot of misinformation going around, so I’d like to set the record straight: Android supports SIM Toolkit. Period. The code for Stk.apk is in every single copy of the Android Open Source Code repository, go look for yourselves (for example, on github). — Alan, March 3, 2012


SIM Toolkit is a technology that allows applications to live on a SIM card. It’s commonly used by telecommunications providers to implement value-added services, such as bank transactions, balance inquiries, bill payment, etc. In Kenya we use it all the time with M-PESA, the mobile payment system offered by Safaricom.

It’s been broken in CyanogenMod 7 on the Galaxy S for… ever. In the early days of CM7 it was the Stk.apk application itself which wasn’t signed properly (or something), so it never appeared in the application drawer despite being present in the system. Around the same time as the Galaxy S family of devices became officially supported in CM7, the SIM Toolkit application finally showed up in the application drawer; this led lots of people to believe that the SIM Tooklit was actually working.

Working, but broken…

Unfortunately, “working” is a little more than the application simply launching. As I had never heard of SIM Toolkit until I came to Kenya in 2007, I understand while people can’t really wrap their brains around what it is, why it’s useful, and why I think it’s broken (even though the menu does indeed pop up!).

In this video I attempt to use the SIM Toolkit to buy 50 shillings of pre-pay airtime from my M-PESA account using the SIM Toolkit application. It’s hard to describe, but towards the end, after I confirm to “Buy airtime,” the confirmation never comes. It’s only when I click the M-PESA menu item again the the dialog pops up. I never receive an SMS saying the purchase was successful, nor is my account deducted, or my pre-pay airtime balance credited.

The phone was on a clean installation of CyanogenMod 7 nightly #89, running the stock kernel. If anyone’s interested I can attach radio logs or upload a video of SIM Toolkit working properly on a stock Samsung Gingerbread ROM.

39 thoughts on “SIM Toolkit broken on CyanogenMod 7 on Samsung Galaxy S

  1. Hi, I got here through I a google search. I would just like to let you know I have the same problem; galaxy s, cyanogenmod 7, sim tool kit does appear, the menus seem to work, it says “sending message” but there is never any response to the requests.
    Because I need stk to log into my internet bank, it is kind of annoying that flashing to the otherwise oh so delightful cyanogenmod broke it.
    I did an attempt at compiling the stk framework to do some debugging, but after installing the package the wouldn’t boot until I put the old one back, so I felt it was best to stop the experimenting at that. Have you seen any official bug reports for this? All I could find was cm5 stuff…

    1. Hahah, I don’t blame CyanogenMod for breaking it, as most of the developers and users are in the US, and they don’t use SIM Toolkit there! In fact, I had never heard of the damn thing until I moved to Kenya.

      Regarding bug reports, I’m not exactly sure how to report it, because the CM forum specifically states that we shouldn’t post bug reports regarding the nightlies. That’s why I posted it here, and on the XDA forums… hopefully someone will see it!

  2. I have a nokia C3 and since you talked about the sim tool kit as the one used in Mpesa, i would like to know how the same can be activated on my phone. My phone was able to access the Mpesa menu but it suddenly stopped being active and so all the time i want to use the Mpesa service I have to remove the simcard and put it into a different phone. I took it to the Nokia center, it was sorted out bt the same problem has recurred. Am told it has something to do with this simtool kit…..all the other icons on the menu are working except this one that is related to the service provider….any permanent solution to this?

    1. Sorry, Ben, this post has nothing to do with SIM Toolkit on the Nokia. It’s specifically talking about CyanogenMod 7 (and Android distribution). 🙂

  3. hi, i have experienced the same problem. I currently have cynogenmod-7-10092011-Nightly for my Galaxy S. I had DarkysRom v10.2 before and toolkit worked fine. Have you found a solution….Thanks

    1. CyanogenMod and “Darky’s ROM” are completely different. Darky’s “ROM” is nothing more than a Samsung ROM with a different theme and some extra applications added/removed. CyanogenMod is a community-driven project which is built from the publicly-available Android source code posted by Google (“AOSP”). As I understand it, Samsung’s ROM includes some extra work to the RIL (radio interface layer) that interacts with the GSM network and the SIM. Unfortunately that part is proprietary, so we don’t have access to that… there’s nothing we can do, unless Samsung opens up that particular code.

  4. Its broken on a lot more architectures than just Galaxy S. Galaxy 5 and Huawei U8150 for sure too.

    1. I wouldn’t be surprised if it was broken on the Galaxy 5; it seems like Samsung use some proprietary RIL code which we don’t have access to. It does work on my U8150, I use it in CM7 quite often on mine… which ROM are you running?

  5. I can confirm that it’s also broken on the LG-G2X (Wind). It’s listed when I launch the “Manage Applications” process but no app in the app drawer.

    1. In the case of the Samsung Galaxy S it’s due to some proprietary parts of the Radio Interface Layer (RIL). I don’t doubt it’s the same on your LG G2X… 🙁

  6. Yup i installed CM7 mod on my Samsung Galaxy S Vibrant T959 and it works with orininal 2.1-2.2 but keeps crashing on my CM7 mod to the point i cant even use my phone crashed every 2 seconds so i jsut flashed my phone back.

  7. i installed the stable rom for the SGS and i started to have the same SIM toolkit error. its really annoying. anyone who got the solution yet. and also at times some apps bring on the force close message if i try to load them other times they load ok. know wat could be the issue to this and how i can solve it?

    1. I’ve given up on this; there’s no solution for the SIM Toolkit bug on Samsung GT-I9000 when running a ROM based on AOSP. We are missing some proprietary parts for the RIL which work with Samsung’s baseband.

  8. Hi Allan,

    Nice work here. I installed CM7 on a Droid 2 Global that someone shipped in from the states which I use with my Safcom line. Problem is; it doesn’t have STK. I tried installing stk.apk from my SD Card but installation failed. CM7 for the droid doesn’t come with STK. Do you think there’s a way out for me? Perhaps a stk.apk for CM7 downloadable from somewhere? (though I have googled without success). I’d be happy to hear from you on this.


    1. Heh, I keep forgetting to update this post with more information… I have no idea what a Droid 2 Global uses for its hardware, but I bet it’s in the same boat as the Galaxy S, etc: lack of proprietary radio interface layer code to control certain aspects of the modem hardware.

      It’s really simple: SIM Toolkit is supported by Google in Android. It’s only that the vendors ship versions of Android which contain proprietary drivers. Some of those drivers can be required for low-level things like 3D acceleration, wireless, and modem functionality. The companies are under zero legal obligation to provide this to us. We’re just shit out of luck. Having said that, though, my $80 Huawei U8150 (IDEOS) has a working SIM Toolkit under CyanogenMod, probably because Huawei uses a simple hardware radio. I dunno!

  9. Found this after scouring Google for a while. I have exactly the same problem – moved to Nairobi 3 weeks ago from the UK, Nexus S in pocket. Went to register for mpesa, but no joy. Can confirm you’re spot on – haven’t found a single successful report of how to get it working.

    Does the Galaxy S default ROM have STK and working? Wonder if (given it’s for the right phone) if you could pull it out of Samsung’s ROM and push it onto your CM build. Might work for mine as well as it’s basically the same phone.

    1. I have never used a Nexus S, but I assume it has the same problem as the Galaxy S when running ROMs based on the Android Open Source Project (the problem being the proprietary RIL components). Samsung stock ROMs have a working SIM Toolkit. For what it’s worth, I’ve heard that the Galaxy Nexus has a working SIM Toolkit (source:

      As I’ve said a million times, Stk.apk is just an app which makes calls to Android’s radio interface layer, which in turn must have support from some libraries which interface with the modem firmware. People saying that “Android doesn’t have a SIM Toolkit” have zero clue what they’re talking about.

      1. Yes – I’m not running a custom rom though – am on the 2.3.6 OTA update direct from Google.

        Given that 2 out of 3 of the “Google phones” (Nexus One and Nexus S) are both reportedly problematic with the STK it’s entirely unreasonable to say “Android doesn’t have STK”. With the various other handsets, it’s the handset maker adding it (or the carrier I’d imagine as is the case with Safaricom here).

        Given how widespread the use of STK is around the world (although less so in mainland Europe and not at all in the USA from what I’ve read) I’d like to see Google attach a condition to having access to the Android market requiring the inclusion of a functioning STK. Problem solved!

        1. Nope, Android supports SIM Toolkit. In fact, here’s the code from in the Android source code repository itself:

          SIM Toolkit isn’t being added by the handset makers… it’s part of Android. What I was explaining above is that Stk.apk is a simple application which relies on the functionality of the device’s baseband (modem), and it’s libraries. Samsung’s RIL is notoriously closed; it’s the reason the Replicant project, who strive to create 100% FREE version of Android, have written their own “SamsungRIL” which can do basic telephony, SMS, data, etc, but cannot provide the functionality Stk.apk needs yet.

          Related reading:

        2. Ah I see. Thanks for clarifying. Surprising it’s missing from the Nexus S as it’s a Samsung Phone.

  10. I had the same issue with my xperia x10 with a custom mod. looked for the sdk.apk file for the version of adroid (2.3.3) I have then saved it on my memory card. used a root explorer to move it into system/app. then installed it from there and it works.

  11. Anyone gotten any sim toolkit to work on Cyanogenmod 9 (ICS) on any Samsung (any series, galaxy, S2 etc)? It’s the only reason I’m yet to switch to ICS, the hassle of looking for a working sim toolkit on these samsung’s is such a pain.

    1. Read my many, many comments in this thread. Samsung GSM radios use a proprietary radio-interface layer which doesn’t work on AOSP-based ROMs. Basic functionality works, but unfortunately SIM Toolkit is not “basic” functionality. With Samsung you need to stick to STOCK ROMs if you want SIM Toolkit to work.

      The Replicant project is working on a reverse-engineered SamsungRIL, but it’s not done, and who knows if they’ll get around to implementing the functionality needed for Stk.apk to work.

  12. Hi,
    thanks for the information about custom rooms and Samsung sim toolkit. Just before finding your blog I was already prepared to attempt to write one that works but that seems impossible.

    I’ll try and check out the Replicant project and see if its possible to apply what they are doing for galaxy s2.

    1. Or you could just buy an open phone (like a Google phone), where you don’t have to fight for your right to use the hardware the way you want to… unless writing a new radio interface layer sounds fun, then by all means, go ahead! 😉

  13. Hi,
    I found this site year ago when searching stk solution for cyanogenmod7 sgs2. Finally I can say that I managed to get it work on sgs2 cyanogenmod9. It should work on galaxy tab(smdk4210) also!
    So far I’m not github user and I can not provide source. Will contact codeworkx maybe he can suggest how to proceed.
    Right now I can provide Update.Zip witch will replace framework.jar, framework-res.apk and Stk.apk

    1. Wow, that’s great news. I’ve got a CM9 build of the Tab 7 Plus (smdk4210) here right now, I could test your patch. 🙂 I’d love to see the code.

      1. I created github account and forked android_frameworks_base and upload my changes to this repo. I don’t want to upload it directly to cyanogenmod not yet. I’m not sure what happens other devices:)

        Basically what I did was dex2jar stock framework.jar and then used “jad” to convert *.class files to *.java and then compared logcat from stock to cm.
        2 weeks and voila.
        And here is the link to my repo
        be patient I’m still learning github and I hope to get my changes up by tomorrow. Till then you can try my file

        1. Ok, I only have a Galaxy Tab 7 Plus (smdk4210 of course, and I’m using the SMDK4210 RIL in CM9), so I can’t flash your framework stuff… but lemme try to kang your patch and test locally.

        2. I just tested your patch on my Tab 7 Plus and buying credit from our Kenyan provider (Safaricom) using SIM Toolkit works. This is something that never works on AOSP-based ROMs. I did see some errors in the logcat, though:

          D/CAT     ( 2063): StkAppService: RES_ID_CONFIRM
          D/CAT     ( 2063): CatService: encodeOptionalTags() Unsupported Cmd:33
          D/CAT     ( 2063): CatService: TERMINAL RESPONSE: 810301210102028281830100

          Regardless, the request was successful.

  14. Hello,was anyone able to solve this on cm7?Am stuck on stock based roms for my galaxy mini since am in campus and need mpesa…funny thing it works on cm10 and cm10.1 but those builds are rather unstable since armv6 is weak…

      1. The dropbox link for sgs2 framework above is down. Can some one help provide a simple noob step by step tutorial for dummies for installation for this simtoolkit problem on sgs2? Some of us are only seeing greek when it comes to the code lingo . I am currently on Jellybean 4.2.1 on my sgs2 and the sim toolkit appears to be in the /system/apk folder but it doesnot appear in the app drawer. In the past the only custom rom that contained a working stk.apk was spike pure ics4.0 for sgs2.

        1. If you’re on Android 4.2.1 you must be on CM10.1, right? I seem to recall there is a problem with Stk on Samsung devices on the latest CM10.1 builds, I noticed it on one of my Samsungs as well. It’ll get fixed eventually, I’m assuming.

  15. You are right i am on CM10.1, the dorimanx kernel seems tobe less Stable . I can see stk.apk in /system/app but it never shows up in app drawer. Iam using Revolt JB a kang ROM which reportedly has cherry picks from AOSp CM10 and i think stock JB.
    Meanwhile how is the replicant project coming?

Comments are closed.