Dynamic Payload Examples

To create a dynamic payload for sending to another user/device:
  1. Use one of the following helper methods.
    CustomExp custom = Experience.initCustomContentWithText("{\"url\":\"http:\\somethings.com\"}");
    

    HtmlExp html = Experience.initHtmlContentWithText("<div id=\"ad\"
          style=\"width:100%;height:90px;\" >\r\n  
          <iframe\r\n     
    		src=\"http://matthewjamestaylor.com/responsive-ads/ad.html\"\r\n      
    		border=\"0\"\r\n      
    		scrolling=\"no\"\r\n     
    		allowtransparency=\"true\"\r\n     
    		width=\"100%\"\r\n     
    		height=\"100%\"\r\n     
    		style=\"border:0;\">\r\n  
          </iframe>\r\n
    </div>");

    ImageExp image = Experience.initImageContentWithUrl("https:\\encrypted-tbn1.gstatic.com/
    			images?q=tbn:ANd9GcQTh2cCg6qf3MCmeWekAtnYzVdPEbIqmSjB7ohlv2ThP6sOw9IKZQ");
    

    UrlExp url = Experience.initUrlContentWithUrl("http:\\engadget.com");

    VideoExp video = Experience.initVideoContentWithProvider("youtube",
          FMDisplayType.Fullscreen,"https://www.youtube.com/watch?v=ysh9vRsiBHM");
    
  2. Call one of the methods on that experience to send it over to the server for queueing.
    custom.sendExperienceToDeviceId(deviceId);           
    custom.sendExperienceToUsername(username);