Push notifications segmentation
- Get link
- X
- Other Apps
we using php create api mobile , pusher trigger events. need send notifications specific users identified unique id.
can please explain how it?
to generate unique id each user installs app can use code:
from on can retrieved keychain using:code:+ (nsstring *)generateuuid { cfuuidref uuid = cfuuidcreate(null); cfstringref idstring = cfuuidcreatestring(null, uuid); cfrelease(uuid); return [(nsstring *)idstring autorelease]; } //add keychain - (void) blah { [sskeychain setpassword:[self generateuuid] forservice:@"your.bundle.identifier" account:@"user"]; }
that uuid same across user's devices assuming use icloud keychain, or if new phone , restore backup stay same.code:- (void) blah { nsstring*uuidstring =[sskeychain passwordforservice:@"your.bundle.identifier" account:@"user"]; }
more interesting, generate random 32 character string alphanumeric characters, add unix timestamp (a number representing milliseconds since january 1st 1970) end of string. apply sha-256 hash it. have totally unique identifier.
here's favorite method using sha-256 produce hashed string:
personally dislike php , prefer node.js things this. there push notification libraries out there node.js make incredibly easy.code:#include <commoncrypto/commondigest.h> -(nsstring*) sha256:(nsstring *)clear{ const char *s=[clear cstringusingencoding:nsasciistringencoding]; nsdata *keydata=[nsdata datawithbytes:s length:strlen(s)]; uint8_t digest[cc_sha256_digest_length]={0}; cc_sha256(keydata.bytes, keydata.length, digest); nsdata *out=[nsdata datawithbytes:digest length:cc_sha256_digest_length]; nsstring *hash=[out description]; hash = [hash stringbyreplacingoccurrencesofstring:@" " withstring:@""]; hash = [hash stringbyreplacingoccurrencesofstring:@"<" withstring:@""]; hash = [hash stringbyreplacingoccurrencesofstring:@">" withstring:@""]; return hash; }
make sure make easy turn off push notifications app. don't make users go settings > notifications, make easier that. , don't send many notifications (try stay below 1 notification per every 4-5 days), unless making messaging platform or push notifications crucial. after all, apps send many push notifications users tend uninstalled pretty quickly, , users resent they'll give app 1 star review.
more interesting tactic use a/b testing. it's pretty easy implement. send 2 (or more) versions of same push notification users, , can learn sorts of things users more engaged.
Forums iPhone, iPad, and iPod Touch iOS Programming
- iPhone
- Mac OS & System Software
- iPad
- Apple Watch
- Notebooks
- iTunes
- Apple ID
- iCloud
- Desktop Computers
- Apple Music
- Professional Applications
- iPod
- iWork
- Apple TV
- iLife
- Wireless
- Get link
- X
- Other Apps
Comments
Post a Comment