Get mobile device ID/Serial Number


  • Posts: 97
This is a mobile specific question, both IOS and Android.

I looked at all of the blocks and extensions and cannot seam to find this code. I would like to be able to capture the Device ID# or Serial Number, to send out to a website for tracking purposes. I know its possible to send text to a url. But how to retrieve the ID#/Serial of the device?


  • *
  • Posts: 1961
Even if it can be done, I have something in the back of my mind telling me that this would be in breach of Apple's T&Cs for iOS devices, and that your game would be rejected from the App Store. I don't think you are allowed to track Apple device IDs.

I may be wrong, but do your research before making the effort.
Visit - the only published book for learning Stencyl.


  • Posts: 97
so how do you track things like in app purchases to a specific user or device?


  • Posts: 150
Apple and Google are doing that for you. You only need to setup IAP's correctly and use the blocks created for that.


  • Posts: 97
ok, how about if you have a timed item, say they purchase an upgrade, but that upgrade only lasts for say 24 hours.

How is something like that tracked so that when the item expires it is removed from the players inventory.


  • *
  • Posts: 430
Keeping track of global time can be done fairly easily within Stencyl. Here's how you can accomplish what you have explained:

1. Download and install the Date Extension.
2. Enable this extension in your game, then save, close and reopen.
3. When the player purchases the timed upgrade, set a Number-type Game Attribute using the extension's 'current timestamp' block.
4. To check if the 24 hours has passed, use (current timestamp - your game attribute) >= 86400000. This will return true if 24 hours or more have passed since the game attribute was set. (Hint: 86,400,000 is 24 hours in milliseconds.)

If you experience any problems with this, post them and we will be glad to help. :)
Fontstruct - Stencyl - Website (in progress)

Proud Member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.


  • Posts: 97
what you say makes some sense, I am worried about hacking the save file though. Also if using the devices time stamp, what if somebody figures out how it is being done, and just changes the clock on the device, so the timestamp goes back a day. This would invalidate the function wouldn't it.



  • Posts: 399
There is actually a device ID that you are able to read. Apple added the "Advertisement ID" (or something like that) which developers can call instead of the serial number of the device. On Android there is something similar, but I don't remember, how it's called.
There are many possible cases why you need this number and it's not just for advertisement. It'S for anything that requires a unique identification of a device, like it's used for sending push notifications (which is also not possible with Stencyl even after years).
Anyway, I would like to know as well, how to get that number in stencyl.

You get it very simply in xCode.
Unlimited push for free:

The entire Appstore in your Browser:


  • *
  • Posts: 9470
There are many possible cases why you need this number and it's not just for advertisement.
Apple allows you to use the IDFA for only three reasons:
1. Serve advertisements within the app.
2. Attribute this app installation to a previously served advertisement.
3. Attribute an action taken within this app to a previously served advertisement


  • Posts: 97
i guess the only option left to stencyl, although I wanted to have an offline game is to have the game lookup a url, that runs an insert query to the DB the first time the game is run to generate a unique ID, then to store the ID in a game variable and use it to track all future requests from the game.

2 problems with this,

1. if player is not on internet, cannot play game
2. if player uninstalls app, save file is erased and then if they decide to reinstall later tracking is lost.

I suppose the 3rd option is to require players to login to FB and use that account to track them, again they need to be online, and then they are forced to use FB and if player doesn't have FB they cannot play, but it would solve the problem of tracking.

Which is why device SN would make sense as this number is persistent even if the app is uninstalled and reinstalled.

Ok so I like stencyl because of its relative ease of use. But it has major limitations if you want to create any kind of commercial game.


  • *
  • Posts: 9470
This has nothing to do with Stencyl and everything to do with Apple not wanting devs to have a permanent link to a device.  There's a reason they got rid of the UDID.


  • Posts: 97
that just sux. They wanna sell shit, but they don't want people to be able to use the shit