鍙湪“绠$悊涓績-绉诲姩搴旂敤-搴旂敤璇︽儏-鍏宠仈灏忕▼搴忎俊鎭?rdquo;锛屼负閫氳繃瀹℃牳鐨勭Щ鍔ㄥ簲鐢ㄥ彂璧峰叧鑱斿皬绋嬪簭鎿嶄綔銆?/p>
鍞よ捣
App鎵撳紑涓嬬▼搴忎粬鏈変袱绉嶆柟寮忥細
1锛岄€氳繃App鍒嗕韩灏忕▼搴忓崱鐗?鍒板井淇★紝鐒跺悗鍦ㄥ井淇′笂鐐瑰嚮灏忕▼搴忓崱鐗囨墦寮€灏忕▼搴忥紝杩欐槸灏忕▼搴忎篃鍙互鎵撳紑App
绗笁姝ワ細 鍒嗕韩灏忕▼搴忓崱鐗囩被鍨?br />瀹樻柟鏂囨。锛?a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317332&token=&lang=zh_CN" rel="nofollow" target="_blank">https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317332&token=&lang=zh_CN
绗竴绉嶏細鏂囧瓧绫诲瀷鍒嗕韩绀轰緥
SendMessageToWXReq *req = [[SendMessageToWXReq alloc]init];
req.text = @"鍒嗕韩鍐呭";
req.bText = YES;
req.scene = WXSceneSession; // 鐩墠鍙敮鎸佷細璇濆舰寮?/span>
[WXApi sendReq:req];
绗簩绉嶏細App 涓诲姩鍒嗕韩灏忕▼搴忓崱鐗囷細?? 灏忕▼搴忔祴璇曠増涓嶈兘鍒嗕韩
WXMiniProgramObject *wxminiObiect = [WXMiniProgramObject object];
wxminiObiect.webpageUrl = webpageUrl; //鍏煎浣庣増鏈殑缃戠粶閾炬帴
wxminiObiect.userName = userName;//灏忕▼搴忕殑鍘熷ID
wxminiObiect.path = path;// 鎸囧畾鎵撳紑灏忕▼搴忕殑鏌愪竴涓〉闈㈢殑URL璺緞
wxminiObiect.hdImageData = hdImageData; //灏忕▼搴忚妭鐐归珮娓呭ぇ鍥撅紝灏忎簬128K
WXMediaMessage *message = [WXMediaMessage message];
message.title = @"灏忕▼搴弔itle";
message.description = @"灏忕▼搴廳escription";
message.mediaObject = wxminiObiect;
message.thumbData = nil; // 鍏煎鏃х増鏈妭鐐圭殑鍥剧墖锛屽皬浜?2k锛屾柊鐗堟湰浼樺厛
SendMessageToWXReq *req = [[SendMessageToWXReq alloc]init];
req.message = message;
req.scene = WXSceneSession; // 鐩墠鍙敮鎸佷細璇?/span>
return [WXApi sendReq:req];
View Code
2锛岄€氳繃App涓诲姩鐨勮皟鐢╝pi 鎵撳紑灏忕▼搴忥紝杩欐椂鍊欏皬绋嬪簭涔熷彲浠ユ墦寮€App
瀹樻柟鏂囨。锛?a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21526646385rK1Bs&token=&lang=zh_CN" target="_blank">https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21526646385rK1Bs&token=&lang=zh_CN
WXLaunchMiniProgramReq *launchMiniProgramReq = [WXLaunchMiniProgramReq object];
launchMiniProgramReq.userName = @"gh_3413cfa14bae"; //鎷夎捣鐨勫皬绋嬪簭鐨勫師濮婭D
launchMiniProgramReq.path = @"pages/index/index"; //鎷夎捣灏忕▼搴忛〉闈㈢殑鍙甫鍙傝矾寰勶紝涓嶅~榛樿鎷夎捣灏忕▼搴忛椤?/span>
launchMiniProgramReq.miniProgramType = WXMiniProgramTypeRelease; //鎷夎捣灏忕▼搴忕殑绫诲瀷
[WXApi sendReq:launchMiniProgramReq];
//鎴栬€?/span>
String appId = "wxd930ea5d5a258f4f"; // 濉簲鐢ˋppId
IWXAPI api = WXAPIFactory.createWXAPI(context, appId);
WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
req.userName = "gh_d43f693ca31f"; // 濉皬绋嬪簭鍘熷id
req.path = path; //鎷夎捣灏忕▼搴忛〉闈㈢殑鍙甫鍙傝矾寰勶紝涓嶅~榛樿鎷夎捣灏忕▼搴忛椤?/span>
req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE; // 鍙€夋墦寮€ 寮€鍙戠増锛屼綋楠岀増鍜屾寮忕増
api.sendReq(req);
View Code
WXMiniProgramTypeRelease 姝e紡鐗?nbsp; WXMiniProgramTypeTest 寮€鍙戠増 WXMiniProgramTypePreview 浣撻獙鐗?/span>
鍥炶皟
褰撳皬绋嬪簭浠?APP 鍒嗕韩娑堟伅鍗$墖鐨勫満鏅墦寮€锛堝満鏅?/span>鍊?1036锛孉PP 鍒嗕韩灏忕▼搴忔枃妗?ios / android锛?鎴栦粠 APP 鎵撳紑鐨勫満鏅墦寮€鏃讹紙鍦烘櫙鍊?1069锛夛紝灏忕▼搴忎細鑾峰緱鎵撳紑 APP 鐨勮兘鍔涳紝姝ゆ椂鐢ㄦ埛鐐瑰嚮鎸夐挳鍙互鎵撳紑鍒嗕韩璇ュ皬绋嬪簭鍗$墖/鎷夎捣璇ュ皬绋嬪簭鐨?APP銆傚嵆灏忕▼搴忎笉鑳芥墦寮€浠绘剰 APP锛屽彧鑳?/span> 璺冲洖 APP銆?/p> options.scene鏄?036锛岃繖涓満鏅痠d琛ㄧずapp鍒嗕韩銆?options.scene鏄?069锛岃繖涓満鏅痠d琛ㄧず浠巃pp鎵撳紑銆?/span> 鎸夊井淇℃枃妗d腑鎻忚堪锛屼粠灏忕▼搴忎腑璺冲洖App鍙兘閫氳繃鐐瑰嚮灏忕▼搴忎腑鐨勬寜閽柟鍙烦鍥烇紝濡備綍瀹炵幇鐐瑰嚮鎸夐挳璺冲洖App锛屽苟鎼哄甫鍙傛暟鍛紝闇€濡備笅涓ゆ 闇€瑕佸垱寤篧XEntryActivty锛屽疄鐜癐WXAPIEventHandler鎺ュ彛锛岄噸鍐檕nResp鏂规硶銆傛敞鎰廇citvity闇€瑕佸湪Manifest鏂囦欢涓0鏄?android:exported="true"锛岃繖鏍锋墠鍙互琚閮ㄥ敜璧?/p> public void onResp(BaseResp resp) { 闇€瑕佸皢 App绔細
if (resp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) resp;
String extraData =launchMiniProResp.extMsg; // 瀵瑰簲涓嬮潰灏忕▼搴忎腑鐨刟pp-parameter瀛楁鐨剉alue
}
}灏忕▼搴忕锛?/h4>