I am using PHP to connect to apn
s to send some notifications to multiple devices, although the question is more conceptual so it doesn\'t have to be specific to
I see what you want and rather, i did face the same problem, what worked for me was the reverse engineering. I just looked into the library and checked for the function which validates the deviceToken. So while creation of dummy device token i just made sure that the generated token is valid as per the library.
The following code will let you generate valid device Tokens, now its on you to how many millions of tokens to generate using this function.
def generateRandomDeviceTokenAndAppendItToJson(tokenLength: Int) {
val randomlyGeneratedDeviceToken = new StringBuilder()
randomlyGeneratedDeviceToken.append(" \"")
(1 to tokenLength) foreach {
times: Int =>
if (tokenLength equals Device.Apple)
randomlyGeneratedDeviceToken.append(validCharacter().toString.charAt(0))
else
randomlyGeneratedDeviceToken.append(Random.alphanumeric.head)
}
randomlyGeneratedDeviceToken.append("\",")
println(randomlyGeneratedDeviceToken)
writer.write(randomlyGeneratedDeviceToken.toString())
}
private def validCharacter(): Int = {
val a = Random.alphanumeric.head
if ('0' <= a && a <= '9')
return (a - '0')
else if ('a' <= a && a <= 'f')
return ((a - 'a') + 10)
else if ('A' <= a && a <= 'F')
return ((a - 'A') + 10)
validCharacter()
}
The apple deviceToken is of 64 character so you will need to iterate on it for 64 times.