Copy link to clipboard
Copied
I'm trying to set up apple's push notification on my new CF server. I have a set of files that I need to use for this to work. However, I cannot get Coldfusion to "pick" them up and use the classes. I've tried for 6 hours to add a class path. My code to use the class looks like this: com.notnoop.apns. My error is that it cannot find the classpath. I've tried putting the com folder into the (cf install directory)/lib and tried manually adding the class path but no luck. Help please.
<!-- alert user -->
<cffunction name="alertUser" access="remote" returntype="string" output="no">
<cfargument name="send_token" type="string" required="yes">
<cfset returnString = "Notification Sent">
<cfset APNS = createObject( "java", "com.notnoop.apns.APNS" )>
<cfset APNSService = createObject( "java", "com.notnoop.apns.APNS" ).newService()
.withCert("/secretLink", "******")
.withSandboxDestination()
.build() />
<cfset payload = createObject( "java", "com.notnoop.apns.APNS" ).newPayload()
.badge(1)
.alertBody("Alert")
.actionKey("View")
.sound("PushNotification.caf")
.build()/>
<cfset token = '#send_token#'>
<cfset APNSNotification = createObject ("java", "com.notnoop.apns.SimpleApnsNotification").init(javacast("string",token),javacast("string",payload)) />
<cfset APNSService.push(APNSNotification)>
<cfreturn returnString >
</cffunction>
<!-- -->
<!-- -->
<!-- -->
After just re-reading your question I think I have figured it out. This sentence:
" I've tried putting the com folder into the (cf install directory)/lib and tried manually adding the class path but no luck. Help please."
Indicates to me that you downloaded the source code, but did not compile it.
Java is not like ColdFusion. You cannot just put source code into a directory and expect it to run. You *must* compile it first.
The link I included in the other post has a precompiled version of the libr
...Copy link to clipboard
Copied
It seems to be working fine for me after putting it into my {CF}/lib dir and restarting ColdFusion.
Let me ask you a few questions (sorry if any of them insult your intelligence)
1. Did you download the source code? If so, did you compile it?
2. Did you download a .jar?
3. Did you get the jar with the dependencies? (https://github.com/downloads/notnoop/java-apns/apns-0.1.5-jar-with-dependencies.jar)
4. Did you remember to restart ColdFusion?
5. Are you running ColdFusion in standard or multiserver mode?
6. What is the exact error message?
Copy link to clipboard
Copied
Is there any similar push notification solution but this time for the Android?
Something similar to this tutorial but using the new Android GCM:
Thanks in advance
Talal
Copy link to clipboard
Copied
After just re-reading your question I think I have figured it out. This sentence:
" I've tried putting the com folder into the (cf install directory)/lib and tried manually adding the class path but no luck. Help please."
Indicates to me that you downloaded the source code, but did not compile it.
Java is not like ColdFusion. You cannot just put source code into a directory and expect it to run. You *must* compile it first.
The link I included in the other post has a precompiled version of the library with the needed dependencies. Put *that* into your /lib dir and restart CF. Delete that com folder so that it does not cause any trouble while you're at it.
Copy link to clipboard
Copied
Does the entire zip stay zipped up and added to the directory? I'm really confused as to what actually goes into the lib folder.
Copy link to clipboard
Copied
*Just* the .jar file that I just linked for you, as is. That's the only thing that needs to go in the lib folder. No .zip files are needed and you don't need to unzip anything.
Copy link to clipboard
Copied
Ahhhh, got it. It downloads as a .zip file. You have to change the extension to .jar. Then upload and restart CF. I think it just worked. I'll test some more. Thank you so much!
Copy link to clipboard
Copied
It downloaded as a .jar for me (On a Mac). Weird, but glad you got it going. Good luck.