06-18-2012 05:24 AM
Hi all,
I want to know about Server Side application requirements.
"Please clear me If I am wrong here.."
Uptill I have done :
Solved! Go to Solution.
06-18-2012 05:34 AM
06-18-2012 05:50 AM
Thanks Simon for your quick response.
I have got some sample code from Push development forum:
public class ServerPushSample {
private static String password = "xxxxxx";
private static String targetURL = "https://pushapi.eval.blackberry.com/mss/PD_pushReq uest";
private static final String APP_ID = "xxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
public static void main(String[] args) throws PushSDKException, BadMessageException, UnauthorizedException {
try{
//Arraylist that will hold list of all devices to which is Push needs to be send
List<String> pins = new ArrayList<String>();
//add our Device PIN Number
pins.add("Kanak");
//generate unique ids
IdGenerator idGenerator = new IdGeneratorImpl();
//An instance of the Push PAP request message control using uniqueId, appid, and list of PINs
PushMessageControl pushMessageControl = new PushMessageControl(idGenerator, APP_ID, pins);
//Content to be pushed
Content content = new TextContent("My First Test Notification Text");
//PapService instance which is initialized by PapServiceImpl, required to
//send PAP 2.1/2.0 XML to a Push Proxy Gateway (PPG) and parse the PAP XML responses.
PapService papService = new net.rim.pushsdk.pap.PapServiceImpl();
PushSDKProperties properties = getProperties();
HttpClientImpl client = new HttpClientImpl();
client.setPushSDKProperties(properties);
papService.setHttpClient(client);
papService.setPushSDKProperties(properties);
try{
PushResponse response = papService.push(APP_ID, password, APP_ID, pushMessageControl, content);
System.out.println("response : "+response.getDescription());
}catch(NullPointerException ex){
ex.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
private static PushSDKProperties getProperties() {
PushSDKProperties p = new PushSDKPropertiesImpl();
p.setPpgAddress(targetURL);
p.setUsingPublicPush(true);
p.setHttpIsPersistent(false);
p.setHttpConnectionTimeout(60000);
p.setHttpReadTimeout(120000);
p.setUsingXmlParserDtdValidation(false);
return p;
}
}
Is it a right PAP format?
06-18-2012 05:57 AM
06-18-2012 06:06 AM
Thanks for confirming Simon, I have some large data more tha 8 KB and images too, which I need to push on my device, how can I do that?
06-18-2012 06:53 AM
06-18-2012 06:55 AM
ok. got it thanks a lot..