is it possible to send a push notification without using the alert attribute in a json using iOS? -


i trying send json format doesn't have "alert" attribute. thing is, when try remove alert attribute, notification won't appear. there way can handle this? in advance

p.s i've tried use action, still doesn't show (i think possible in android)

yes, can it. possible send push notification without alert. can register application badge notifications, in case provider server won't able send alerts or sounds.

the notification payload

each push notification carries payload. payload specifies how users alerted data waiting downloaded client application. maximum size allowed notification payload 256 bytes; apple push notification service refuses notification exceeds limit. remember delivery of notifications “best effort” , not guaranteed.

for each notification, providers must compose json dictionary object strictly adheres rfc 4627. dictionary must contain dictionary identified key aps. aps dictionary contains 1 or more properties specify following actions:

an alert message display user

a number badge application icon with

a sound play

note says 1 or more of properties. alert property optional. can send notification empty aps dictionary (i.e. send custom properties).

the following example shows empty aps dictionary; because badge property missing, current badge number shown on application icon removed. acme2 custom property array of 2 integers.

{  "aps" : {  },  "acme2" : [ 5,  8 ]  } 

the alert user see alert asks him/her whether allow push notifications. alert displayed first time app launched after installation.

in below example register non alert notifications (badges , sounds only) :

registering remote notifications

- (void)applicationdidfinishlaunching:(uiapplication *)app {   // other setup tasks here....   [[uiapplication sharedapplication] registerforremotenotificationtypes:(uiremotenotificationtypebadge | uiremotenotificationtypesound)];  }    // delegation methods  - (void)application:(uiapplication *)app didregisterforremotenotificationswithdevicetoken:(nsdata *)devtoken {  const void *devtokenbytes = [devtoken bytes];  self.registered = yes;  [self sendproviderdevicetoken:devtokenbytes]; // custom method  }    - (void)application:(uiapplication *)app didfailtoregisterforremotenotificationswitherror:(nserror *)err {  nslog(@"error in registration. error: %@", err);  } 

hope you.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -