App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟

非淡泊无以明志,非宁静无以致远。这篇文章主要讲述App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟相关的知识,希望能为你提供帮助。
鏍囩锛?a href='http://www.mamicode.com/so/1/comm' title='comm'>comm      ring      param      create      android      des      none      strong      span     
鍙湪“ 绠$悊涓績-绉诲姩搴旂敤-搴旂敤璇︽儏-鍏宠仈灏忕▼搴忎俊鎭?rdquo; 锛屼负閫氳繃瀹℃牳鐨勭Щ鍔ㄥ簲鐢ㄥ彂璧峰叧鑱斿皬绋嬪簭鎿嶄綔銆?/p> 鍞よ捣
App鎵撳紑涓嬬▼搴忎粬鏈変袱绉嶆柟寮忥細
1锛岄€氳繃App鍒嗕韩灏忕▼搴忓崱鐗?鍒板井淇★紝鐒跺悗鍦ㄥ井淇′笂鐐瑰嚮灏忕▼搴忓崱鐗囨墦寮€灏忕▼搴忥紝杩欐槸灏忕▼搴忎篃鍙互鎵撳紑App
绗竴姝ワ細浣犻渶瑕佸埌寰俊寮€鏀惧钩鍙?灏嗕綘鐨刟pp 鍏宠仈涓婁綘鐨勫皬绋嬪簭锛?br />绗簩姝ワ細浣犲伐绋嬩腑闇€瑕佸鍏ユ湁 wechatOpenSDK
绗笁姝ワ細 鍒嗕韩灏忕▼搴忓崱鐗囩被鍨?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

App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟

文章图片
App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟

文章图片
绗竴绉嶏細鏂囧瓧绫诲瀷鍒嗕韩绀轰緥 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 =https://www.songbingjia.com/android/hdImageData; //灏忕▼搴忚妭鐐归珮娓呭ぇ鍥撅紝灏忎簬128KWXMediaMessage *message = [WXMediaMessage message]; message.title = @"灏忕▼搴弔itle"; message.description = @"灏忕▼搴廳escription"; message.mediaObject = wxminiObiect; message.thumbData = https://www.songbingjia.com/android/nil; // 鍏煎鏃х増鏈妭鐐圭殑鍥剧墖锛屽皬浜?2k锛屾柊鐗堟湰浼樺厛SendMessageToWXReq *req = [[SendMessageToWXReq alloc]init]; req.message = message; req.scene = WXSceneSession; // 鐩墠鍙敮鎸佷細璇?/span>return [WXApi sendReq:req];

View Code2锛岄€氳繃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
App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟

文章图片
App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟

文章图片
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 CodeWXMiniProgramTypeRelease 姝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锛屽苟鎼哄甫鍙傛暟鍛紝闇€濡備笅涓ゆ
App绔細闇€瑕佸垱寤篧XEntryActivty锛屽疄鐜癐WXAPIEventHandler鎺ュ彛锛岄噸鍐檕nResp鏂规硶銆傛敞鎰廇citvity闇€瑕佸湪Manifest鏂囦欢涓0鏄?android:exported="true"锛岃繖鏍锋墠鍙互琚閮ㄥ敜璧?/p>
public void onResp(BaseResp resp) { if (resp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) { WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) resp; String extraData =https://www.songbingjia.com/android/launchMiniProResp.extMsg; // 瀵瑰簲涓嬮潰灏忕▼搴忎腑鐨刟pp-parameter瀛楁鐨剉alue } }

灏忕▼搴忕锛?/h4>闇€瑕佸皢 < button> 缁勪欢 open-type 鐨勫€艰缃负 launchApp銆傚鏋滈渶瑕佸湪鎵撳紑 APP 鏃跺悜 APP 浼犻€掑弬鏁帮紝鍙互璁剧疆 app-parameter 涓鸿浼犻€掔殑鍙傛暟銆傞€氳繃 binderror 鍙互鐩戝惉鎵撳紑 APP 鐨勯敊璇簨浠躲€?/p>
< view class=鈥榮uspension鈥?gt; < button class="server_button" open-type="launchApp" app-parameter="wechat" binderror="launchAppError"> 鎵撳紑APP< /button> < /view>

 
杩欐牱App鎷垮埌鐨勫唴瀹瑰氨鏄痺echat銆?/p> 鎵╁睍 
鍐嶄笅涓€姝ョ殑闇€姹傛槸澶氫釜App璺宠浆涓€涓皬绋嬪簭锛屽啀鍒嗗埆杩斿洖涓嶅悓鐨凙pp锛涗竴涓狝pp璺宠浆涓嶅悓鐨勫皬绋嬪簭锛屾帴鍙椾笉鍚岀殑杩斿洖鍐呭銆?/p>浠嶢pp鎷夎捣灏忕▼搴忛〉闈㈢殑璺緞鏄彲浠ュ甫鍙傛暟鐨勶紝鎴戜滑灏卞埄鐢ㄨ繖涓弬鏁板垽鏂槸浠庨偅涓狝pp璺冲埌灏忕▼搴忕殑銆?/p>渚嬪锛?/p>鍚嶇О涓篴鐨凙pp璺宠浆璺緞涓猴細
"pages/index/index?type=appA"

鍚嶇О涓篵鐨凙pp璺宠浆璺緞涓猴細
"pages/index/index?type=appB"

灏忕▼搴忕鎺ユ敹鍙傛暟锛?/span>
onLoad: function (options) { console.log(options.type); //app浼犻€掕繃鏉ョ殑鍙傛暟 鍙互鍒ゆ柇a鎴栬€卋 },

 
杩欐牱App鎷垮埌鐨勫唴瀹瑰氨鏄痺echat銆?/p> 鎵╁睍 
鍐嶄笅涓€姝ョ殑闇€姹傛槸澶氫釜App璺宠浆涓€涓皬绋嬪簭锛屽啀鍒嗗埆杩斿洖涓嶅悓鐨凙pp锛涗竴涓狝pp璺宠浆涓嶅悓鐨勫皬绋嬪簭锛屾帴鍙椾笉鍚岀殑杩斿洖鍐呭銆?/p>浠嶢pp鎷夎捣灏忕▼搴忛〉闈㈢殑璺緞鏄彲浠ュ甫鍙傛暟鐨勶紝鎴戜滑灏卞埄鐢ㄨ繖涓弬鏁板垽鏂槸浠庨偅涓狝pp璺冲埌灏忕▼搴忕殑銆?/p>渚嬪锛?/p>【App鍞よ捣寰俊灏忕▼搴忓拰鍥炶皟】鍚嶇О涓篴鐨凙pp璺宠浆璺緞涓?/p>













    推荐阅读