-
Send Push Notification to iPhone device from Java Server Side
almost 11 years ago
-
almost 9 years ago
import java.net.URL;
-
-
almost 9 years ago
H Ravindra, you can find import statement as below:
import javapns.Push; import javapns.communication.exceptions.CommunicationException; import javapns.communication.exceptions.KeystoreException; import javapns.notification.PushedNotification; import javapns.notification.ResponsePacket;
-
-
almost 9 years ago
It is showing the following exception-javapns.communication.exceptions.InvalidKeystorePasswordException: Invalid keystore password! Verify settings for connecting to Apple
-
-
almost 9 years ago
I'm not able to provide you any straight answer....can you please tell me what are you getting in resource variable?or you are getting any error on that line? Please confirm this on first then I'll answer your further questions.
-
-
almost 9 years ago
please give me a straight answer to my question,I have pasted p12 file in build/clasess folder of my project..so what i have to write in below lines 1)URL resource = iphone.class.getResource("/"); 2)String path = resource.getPath().replace("build/classes/", "Krishna.p12");.please leave a reply
-
-
almost 9 years ago
just one straight question..i have copied p12 file and pasted it in the build/classes folder of my project..so what i have to write in these two lines 1)URL resource = iphone.class.getResource("/"); 2)String path = resource.getPath().replace("build/classes/", "/Krishna.p12");
-
-
almost 9 years ago
/C:/Users/omsairam/iphone/build/classes/ log4j:WARN No appenders could be found for logger (javapns.notification.Payload). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. KeystoreExceptionInvalid keystore reference. Path does not refer to a valid file: C:\Users\omsairam\iphone\build\classesjavapns.communication.exceptions.InvalidKeystoreReferenceException: Invalid keystore reference. Path does not refer to a valid file: C:\Users\omsairam\iphone\build\classes at javapns.communication.KeystoreManager.validateKeystoreParameter(KeystoreManager.java:220) at javapns.communication.AppleServerBasicImpl.
(AppleServerBasicImpl.java:31) at javapns.notification.AppleNotificationServerBasicImpl. (AppleNotificationServerBasicImpl.java:57) at javapns.notification.AppleNotificationServerBasicImpl. (AppleNotificationServerBasicImpl.java:42) at javapns.notification.AppleNotificationServerBasicImpl. (AppleNotificationServerBasicImpl.java:28) at javapns.Push.sendPayload(Push.java:170) at javapns.Push.alert(Push.java:47) at iphone.sendPushNotificationForiPhone(iphone.java:21) at iphone.main(iphone.java:58) -
-
almost 9 years ago
Did you try to print the resource.getPath(), I just wanted to see what are you getting in that variable? Please do that, just write System.out.println(resource.getPath()); after line 17.
-
-
almost 9 years ago
-
-
almost 9 years ago
i have attached clearly all my code and also shown where i provided the p12 file in the project..so please let me know about the errors in the code..my problem is iam not understanding what to write in lines 16 and 17
-
-
almost 9 years ago
Can please tell me what you are getting in resource variable? Please sysout the resource.getPath() and do let me know, after that I'll be able to tell you what to do.
-
-
almost 9 years ago
-
-
almost 9 years ago
Yes, or if you can provide direct path to your p12 file then you don't need to write those lines.
-
-
almost 9 years ago
ok then if i keep p12 file in my WEB-INF/classes/ folder is there need of below lines in my code?? 1)URL resource = iphone.class.getResource("/"); 2)String path = resource.getPath().replace("WEB-INF/classes/", "keystore/whami_push.p12");
-
-
almost 9 years ago
Actually I have put my p12 file inside my webapps folder, that's why I'm getting path to reassure here first then replacing that path with the path to p12 file. Hope this will answer you question.
-
-
almost 9 years ago
please put me a reply,iam waiting here since a long time
-
-
almost 9 years ago
By the way What is meant by resource path of project???
-
-
almost 9 years ago
in place of ??? you will pass device App Id on which you want to send notification.
-
-
almost 9 years ago
public static void main(String args[]) { iphone o=new iphone(); o.sendPushNotificationForiPhone("Hello World",???); } this is the main function i have in my code..what should be written in the place of ???
-
-
almost 9 years ago
you are awesome_/_
-
-
almost 9 years ago
Okay put List<PushedNotification> instead of List at line 10 and then test.
-
-
almost 9 years ago
List and List are same only know???
-
-
almost 9 years ago
ok last error in my code is in 11th line it is showing that typemismatch:cannot convert from element type object to Pushednotifications
-
-
almost 9 years ago
Okay, NP. For UserService, you will have to use your class name in which you are going to use this code.
-
-
almost 9 years ago
and iam new to programming so sorry for asking everything
-
-
almost 9 years ago
thank you.,but after importing java.net.url it is throwing arror as UserService cannot be resolved to a type
-
-
almost 9 years ago
but it is still asking import statement for URL in line 5
-
-
almost 9 years ago
can you post the import statements
-
28 Comment(s)