示例#1
0
文件: Demo.java 项目: chentaoct/test3
 public void sendAndroidFilecast() throws Exception {
   AndroidFilecast filecast = new AndroidFilecast(appkey, appMasterSecret);
   // TODO upload your device tokens, and use '\n' to split them if there
   // are multiple tokens
   String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb");
   filecast.setFileId(fileId);
   filecast.setTicker("Android filecast ticker");
   filecast.setTitle("中文的title");
   filecast.setText("Android filecast text");
   filecast.goAppAfterOpen();
   filecast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
   client.send(filecast);
 }
示例#2
0
文件: Demo.java 项目: chentaoct/test3
 public void sendIOSFilecast() throws Exception {
   IOSFilecast filecast = new IOSFilecast(appkey, appMasterSecret);
   // TODO upload your device tokens, and use '\n' to split them if there
   // are multiple tokens
   String fileId = client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb");
   filecast.setFileId(fileId);
   filecast.setAlert("IOS 文件播测试");
   filecast.setBadge(0);
   filecast.setSound("default");
   // TODO set 'production_mode' to 'true' if your app is under production
   // mode
   filecast.setTestMode();
   client.send(filecast);
 }
示例#3
0
  public DiscussionWidget(final Artifact artifact, boolean readOnly) {
    this.artifact = artifact;
    this.readOnly = readOnly;

    DecoratedDisclosurePanel discussionPanel = new DecoratedDisclosurePanel(constants.Discussion());
    discussionPanel.setWidth("100%");

    commentList.setWidth("100%");
    VerticalPanel discussionLayout = new VerticalPanel();
    discussionLayout.setWidth("90%");

    newCommentLayout.setWidth("100%");
    refreshDiscussion();
    showNewCommentButton();

    discussionLayout.add(newCommentLayout);
    discussionLayout.add(commentList);

    discussionPanel.setContent(discussionLayout);

    pushNotify =
        new ServerPushNotification() {
          public void messageReceived(PushResponse response) {
            if ("discussion".equals(response.messageType)
                && artifact.getUuid().equals(response.message)) {
              System.err.println("Refreshing discussion...");
              refreshDiscussion();
            }
          }
        };

    PushClient.instance().subscribe(pushNotify);

    initWidget(discussionPanel);
  }
示例#4
0
文件: Demo.java 项目: chentaoct/test3
  public void sendAndroidGroupcast() throws Exception {
    AndroidGroupcast groupcast = new AndroidGroupcast(appkey, appMasterSecret);
    /*
     * TODO Construct the filter condition: "where": { "and": [
     * {"tag":"test"}, {"tag":"Test"} ] }
     */
    JSONObject filterJson = new JSONObject();
    JSONObject whereJson = new JSONObject();
    JSONArray tagArray = new JSONArray();
    JSONObject testTag = new JSONObject();
    JSONObject TestTag = new JSONObject();
    testTag.put("tag", "test");
    TestTag.put("tag", "Test");
    tagArray.put(testTag);
    tagArray.put(TestTag);
    whereJson.put("and", tagArray);
    filterJson.put("where", whereJson);
    System.out.println(filterJson.toString());

    groupcast.setFilter(filterJson);
    groupcast.setTicker("Android groupcast ticker");
    groupcast.setTitle("中文的title");
    groupcast.setText("Android groupcast text");
    groupcast.goAppAfterOpen();
    groupcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
    // TODO Set 'production_mode' to 'false' if it's a test device.
    // For how to register a test device, please see the developer doc.
    groupcast.setProductionMode();
    client.send(groupcast);
  }
示例#5
0
文件: Demo.java 项目: chentaoct/test3
  public void sendIOSGroupcast() throws Exception {
    IOSGroupcast groupcast = new IOSGroupcast(appkey, appMasterSecret);
    /*
     * TODO Construct the filter condition: "where": { "and": [
     * {"tag":"iostest"} ] }
     */
    JSONObject filterJson = new JSONObject();
    JSONObject whereJson = new JSONObject();
    JSONArray tagArray = new JSONArray();
    JSONObject testTag = new JSONObject();
    testTag.put("tag", "iostest");
    tagArray.put(testTag);
    whereJson.put("and", tagArray);
    filterJson.put("where", whereJson);
    System.out.println(filterJson.toString());

    // Set filter condition into rootJson
    groupcast.setFilter(filterJson);
    groupcast.setAlert("IOS 组播测试");
    groupcast.setBadge(0);
    groupcast.setSound("default");
    // TODO set 'production_mode' to 'true' if your app is under production
    // mode
    groupcast.setTestMode();
    client.send(groupcast);
  }
示例#6
0
文件: Demo.java 项目: chentaoct/test3
 public void sendAndroidCustomizedcastFile() throws Exception {
   AndroidCustomizedcast customizedcast = new AndroidCustomizedcast(appkey, appMasterSecret);
   // TODO Set your alias here, and use comma to split them if there are
   // multiple alias.
   // And if you have many alias, you can also upload a file containing
   // these alias, then
   // use file_id to send customized notification.
   String fileId =
       client.uploadContents(appkey, appMasterSecret, "aa" + "\n" + "bb" + "\n" + "alias");
   customizedcast.setFileId(fileId, "alias_type");
   customizedcast.setTicker("Android customizedcast ticker");
   customizedcast.setTitle("中文的title");
   customizedcast.setText("Android customizedcast text");
   customizedcast.goAppAfterOpen();
   customizedcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
   // TODO Set 'production_mode' to 'false' if it's a test device.
   // For how to register a test device, please see the developer doc.
   customizedcast.setProductionMode();
   client.send(customizedcast);
 }
示例#7
0
文件: Demo.java 项目: chentaoct/test3
  public void sendIOSBroadcast() throws Exception {
    IOSBroadcast broadcast = new IOSBroadcast(appkey, appMasterSecret);

    broadcast.setAlert("IOS 广播测试");
    broadcast.setBadge(0);
    broadcast.setSound("default");
    // TODO set 'production_mode' to 'true' if your app is under production
    // mode
    broadcast.setTestMode();
    // Set customized fields
    broadcast.setCustomizedField("test", "helloworld");
    client.send(broadcast);
  }
示例#8
0
文件: Demo.java 项目: chentaoct/test3
 public void sendAndroidBroadcast() throws Exception {
   AndroidBroadcast broadcast = new AndroidBroadcast(appkey, appMasterSecret);
   broadcast.setTicker("Android broadcast ticker");
   broadcast.setTitle("中文的title陈涛");
   broadcast.setText("Android broadcast text");
   broadcast.goAppAfterOpen();
   broadcast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
   // TODO Set 'production_mode' to 'false' if it's a test device.
   // For how to register a test device, please see the developer doc.
   broadcast.setProductionMode();
   // Set customized fields
   broadcast.setExtraField("test", "helloworld");
   client.send(broadcast);
 }
示例#9
0
文件: Demo.java 项目: chentaoct/test3
 public void sendIOSUnicast() throws Exception {
   IOSUnicast unicast = new IOSUnicast(appkey, appMasterSecret);
   // TODO Set your device token
   unicast.setDeviceToken("xx");
   unicast.setAlert("IOS 单播测试");
   unicast.setBadge(0);
   unicast.setSound("default");
   // TODO set 'production_mode' to 'true' if your app is under production
   // mode
   unicast.setTestMode();
   // Set customized fields
   unicast.setCustomizedField("test", "helloworld");
   client.send(unicast);
 }
示例#10
0
文件: Demo.java 项目: chentaoct/test3
 public void sendAndroidUnicast() throws Exception {
   AndroidUnicast unicast = new AndroidUnicast(appkey, appMasterSecret);
   // TODO Set your device token
   unicast.setDeviceToken("At1YGf_Zn1uhx4QjBOroGn267OXMRJcdyM7ol3mTjKep");
   unicast.setTicker("Android unicast ticker");
   unicast.setTitle("中文的title陈涛");
   unicast.setText("Android unicast text");
   unicast.goAppAfterOpen();
   unicast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);
   // TODO Set 'production_mode' to 'false' if it's a test device.
   // For how to register a test device, please see the developer doc.
   unicast.setProductionMode();
   // Set customized fields
   unicast.setExtraField("test", "helloworld");
   client.send(unicast);
 }
示例#11
0
文件: Demo.java 项目: chentaoct/test3
 public void sendIOSCustomizedcast() throws Exception {
   IOSCustomizedcast customizedcast = new IOSCustomizedcast(appkey, appMasterSecret);
   // TODO Set your alias and alias_type here, and use comma to split them
   // if there are multiple alias.
   // And if you have many alias, you can also upload a file containing
   // these alias, then
   // use file_id to send customized notification.
   customizedcast.setAlias("alias", "alias_type");
   customizedcast.setAlert("IOS 个性化测试");
   customizedcast.setBadge(0);
   customizedcast.setSound("default");
   // TODO set 'production_mode' to 'true' if your app is under production
   // mode
   customizedcast.setTestMode();
   client.send(customizedcast);
 }
示例#12
0
 @Override
 protected void onUnload() {
   super.onUnload(); // To change body of overridden methods use File | Settings | File Templates.
   PushClient.instance().unsubscribe(pushNotify);
 }