hengsokchamroeun / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

Using command line tool to send notifications. It shows success but notification does not reach device app. #111

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Using Developement provision profile.
Enabled for Push notification.
Cofigured "Production" SSL certificate.
Downloaded the enabled provision profile.
Exported .p12 from keychain with private key and SSL certificate.
Created app that registes itself with APNS and displays device id. [able to see 
the device id and app is also shoen under the notification section in 
settings(enabled)]

Using command line tool to send notifications. It shows success but 
notification does not reached device app.

Following is message while sending notification:
 JavaPNS Folder]$ java -cp "JavaPNS_2.2.jar:lib/bcprov-jdk15-146.jar:lib/log4j-1.2.15.jar" javapns.test.NotificationTest Certificates_SSL_APNS.p12 '*******' 90f9c37e28e8c0cb67d99d7f07309170508c387d43fa82bfc1e61a90293d1e9f sandbox

Validating keystore reference: VALID  (keystore was found)
Verifying keystore content: VERIFIED  (no common mistakes detected)
0 [main] DEBUG javapns.communication.ConnectionToAppleServer  - Creating 
SSLSocketFactory
34 [main] DEBUG javapns.communication.ConnectionToAppleServer  - Creating 
SSLSocket to gateway.sandbox.push.apple.com:2195
1633 [main] DEBUG javapns.notification.PushNotificationManager  - Initialized 
Connection to Host: [gateway.sandbox.push.apple.com] Port: [2195]: 
5f70bea5[SSL_NULL_WITH_NULL_NULL: 
Socket[addr=gateway.sandbox.push.apple.com/17.149.34.66,port=2195,localport=4652
5]]
1635 [main] DEBUG javapns.notification.PushNotificationManager  - Building Raw 
message from deviceToken and payload
1647 [main] DEBUG javapns.notification.Payload  - Adding alert [JAVAPNS DEBUG 
ALERT 1
2012/03/11 17:42:25
gateway.sandbox.push.apple.com
90F9â¦1E9F [Id:1] Exp:T+86400
Enhanced format / UTF-8]
1647 [main] DEBUG javapns.notification.PushNotificationManager  - Built raw 
message ID 1 of total length 199
1648 [main] DEBUG javapns.notification.PushNotificationManager  - Attempting to 
send notification: {"aps":{"alert":"JAVAPNS DEBUG ALERT 1\n2012/03/11 
17:42:25\ngateway.sandbox.push.apple.com\n90F9\u20261E9F [Id:1] 
Exp:T+86400\nEnhanced format / UTF-8"}}
1648 [main] DEBUG javapns.notification.PushNotificationManager  -   to device: 
90f9c37e28e8c0cb67d99d7f07309170508c387d43fa82bfc1e61a90293d1e9f
3644 [main] DEBUG javapns.notification.PushNotificationManager  - Flushing
3645 [main] DEBUG javapns.notification.PushNotificationManager  - At this 
point, the entire 199-bytes message has been streamed out successfully through 
the SSL connection
3645 [main] DEBUG javapns.notification.PushNotificationManager  - Notification 
sent on first attempt
3645 [main] DEBUG javapns.notification.PushNotificationManager  - Reading 
responses
3646 [main] DEBUG javapns.notification.PushNotificationManager  - Closing 
connection
All notifications pushed successfully (1):
  [1] transmitted {"aps":{"alert":"JAVAPNS DEBUG ALERT 1\n2012/03/11 17:42:25\ngateway.sandbox.push.apple.com\n90F9\u20261E9F [Id:1] Exp:T+86400\nEnhanced format / UTF-8"}} on first attempt to token 90f9c..d1e9f

What is the expected output? What do you see instead?
As per message nofication should have been shown on device, bot nothing appears.

What version of the product are you using? On what operating system?
JavaPNS_2.2 on Red hat (case is same in test on windows7)

Please provide any additional information below.
when attempting to send notification through Production message says device is 
not registered. (does this confirms that in sandbox device is registered since 
no such message is shown)

Is it okey to use Developement provision profile with Production enabled ssl 
for sandbox tests.
Thanks for your responses.

Original issue reported on code.google.com by gupt.ra...@gmail.com on 11 Mar 2012 at 3:35

GoogleCodeExporter commented 8 years ago
Output of feedback service:

[JAVAPNS Folder]$ java -cp 
"JavaPNS_2.2.jar:lib/bcprov-jdk15-146.jar:lib/log4j-1.2.15.jar" 
javapns.test.FeedbackTest Certificates_SSL_APNS.p12 '*******' sandbox

0 [main] DEBUG javapns.communication.ConnectionToAppleServer  - Creating 
SSLSocketFactory
26 [main] DEBUG javapns.communication.ConnectionToAppleServer  - Creating 
SSLSocket to feedback.sandbox.push.apple.com:2196
2144 [main] DEBUG javapns.feedback.FeedbackServiceManager  - Found: [0]

Original comment by gupt.ra...@gmail.com on 11 Mar 2012 at 3:50

GoogleCodeExporter commented 8 years ago
Is it okey to use any machine with same provision profile to build the app or 
the app can ONLY be build on the mac where ssl certificate CSR was generated. 
having private key in the login chain. I am using 1st option do not have the 
same mac.

Original comment by gupt.ra...@gmail.com on 12 Mar 2012 at 7:29

GoogleCodeExporter commented 8 years ago
You seem to be mixing development and production stuff...  If you want to use 
the sandbox, make sure you generate a DEVELOPMENT certificate, and that your 
app is signed with it.  Once you are ready to move to production, generate a 
production certificate and sign your app with that new certificate.

Make SURE you follow the procedure documented in the wiki:  
http://code.google.com/p/javapns/wiki/PreparingCertificates

Original comment by sype...@gmail.com on 14 Mar 2012 at 4:48

GoogleCodeExporter commented 8 years ago
Thanks for the response i'll try that out one query here-
"Development Provisioning Profiles" can only access sandbox and "distribution 
ones" work with production. So is there any relevance of "Prod" SSL 
certificates in Development Provisioning Profiles and vice versa.  

Original comment by gupt.ra...@gmail.com on 15 Mar 2012 at 4:34

GoogleCodeExporter commented 8 years ago
Same comment as before....  production and development don't mix, so make sure 
you use only development stuff for the sandbox server, and production stuff for 
the production server.  When shortcuts are attempted to mix the two, it usually 
doesn't work.

Original comment by sype...@gmail.com on 17 Mar 2012 at 4:39