华为AppGallery常用跳转与链接详解
當前華為應用市場(AppGallery,以下簡稱AG)的功能越來越全,頁面也越來越多,隨著而來的,是對于個各種頁面跳轉的需求越來越旺盛。
但是,華為AppGallery所提供的鏈接的種類、功能、使用場景越來越多,不熟悉的人看到這各種鏈接,肯定會非常頭大。下面根據我的使用是理解,做了一些AppGallery常用鏈接與跳轉場景的整理,僅供大家參考。
?
下面各種鏈接的介紹,主要按照使用場景來劃分,如有錯誤,還請大家指正。
?
1、跳轉到AG首頁
典型使用場景:需要從開發者應用內,拉起跳轉到應用市場首頁,讓用戶自行搜索相關的應用或者活動。
使用方法:使用Intent的action方法,具體動作為:
| 1 | action:com.huawei.appmarket.intent.action.MainActivity |
?
相關代碼示例:
public void launchAGHomePage() {Intent intent = new Intent("com.huawei.appmarket.intent.action.MainActivity");startActivity(intent);}?
?2、跳轉到AG應用詳情頁
2.1?應用內通過Intent跳轉
典型使用場景:應用內拉起跳轉到應用詳情頁,應用用戶進行評分評論等操作。
使用方法:使用Intent的action方法,具體可分為兩類:
1、?通過APPID:
| 1 2 3 | action:com.huawei.appmarket.appmarket.intent.action.AppDetail.?withid setPackage("com.huawei.appmarket"); name:?“appId”,?value:?“C100170981” |
2、通過包名:
| 1 2 3 | action:com.huawei.appmarket.intent.action.AppDetail setPackage("com.huawei.appmarket"); name:?“APP_PACKAGENAME”,?value:?“com.huawei.browser” |
?
注意點:如果使用方式1即APPID的方式,比使用包名的方式,action中多了appmarket以及withid參數。
參數介紹? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
| ? 參數名 | ? 參數類型 | ? 備注與取值 |
| ? appId | ? String | ? 在AGC頁面“我的應用 –> 應用信息”中的APP ID并加上字母C(例如華為瀏覽器的APPID:C100170981) |
| ? APP_PACKAGENAME | ? String | ? 應用包名,例如華為瀏覽器的包名:com.huawei.browser |
?
相關代碼示例:
// 1、通過APPID:
public void launchAppDetilPage1() {Intent intent = new Intent("com.huawei.appmarket.appmarket.intent.action.AppDetail.withid");intent.setPackage("com.huawei.appmarket");intent.putExtra("appId", "C100170981");startActivity(intent);}// 2、通過包名packageName”
public void launchAppDetilPage2() {Intent intent = new Intent("com.huawei.appmarket.intent.action.AppDetail");intent.setPackage("com.huawei.appmarket");intent.putExtra("APP_PACKAGENAME", "com.huawei.browser");startActivity(intent);}?
2.2?通過URL跳轉
典型使用場景:用戶通過分享的URL鏈接等場景,直接點擊URL跳轉到應用詳情頁。
具體方法:鏈接地址為:
| 1 | hiapplink://com.huawei.appmarket?appId=yourAppID&channelId=yourChannelId&referrer=yourReferrer |
?
注意點:斜體加粗部分為手動修改的變量,其余為固定值。
參數介紹
?? ? ?? ?? ?? ? ? ?? ?? ?? ? ? ?? ?? ?? ? ? ?? ?? ??
| ? 參數名 | ? 參數類型 | ? 備注與取值 |
| ? yourAppID | ? String | ? 用于定位到具體的應用,其值為您的AGC上的AppID:例如,華為瀏覽器的Appid為C100170981 |
| ? yourChannelId | ? String | ? (可選)表示不同的渠道,可用于統計渠道點擊量,根據此渠道信息輸出報表。例如:HwBrowserSearch |
| ? yourReferrer | ? String | ? (可選)表示不同的歸因參數:例如?Keywords |
相關代碼示例:
1. 通過APPID
public void launchAppDetilWithURL1() {String text1 = "hiapplink://com.huawei.appmarket?appId=C100170981&channelId=HwBrowserSearch&referrer=Keywords";Uri uri = Uri.parse(text1);Intent intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent);}?
3、market拉起所有本地商店并跳轉詳情頁
典型使用場景:傳入包名或者APPID,拉起設備上所有的應用商店,讓用戶自行選擇打開方式,即引導用戶選擇使用哪個應用市場拉起。選擇好打開的應用商店后可以直接跳轉到應用的詳情頁。
使用方法:通過傳入scheme 為market://?的鏈接,Android支持的標準的market協議,可拉起Android設備上的所有應用商店。有如下兩種方式:
1、market://details?id=pkgName?? // 支持所有商店
2、appmarket://details?id=pkgName???????? ?// 僅支持華為應用商店。
3、market://com.huawei.appmarket.applink?appId=APPID" ?// 僅支持華為應用商店。
注意點:方法1通過market://傳入包名的方式,為Android標準方法,在所有應用商店中均可使用,例如GP,應用包等;。
參數介紹? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
| ? 參數名 | ? 參數類型 | ? 備注與取值 |
| ? APPID | ? String | ? 應用的APPID:例如華為瀏覽器:C100170981 |
| ? pkgName | ? String | ? 應用包名,例如華為瀏覽器:com.huawei.browser |
?
相關代碼示例:
// 1、方式1:market:// + 包名
public void launchAppDetilOnMarket1() {String text1 = "market://details?id=com.huawei.browser";Uri uri = Uri.parse(text1);Intent intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent);}// 2、方式2:appmarket:// + 包名
public void launchAppDetilOnMarket2() {String text1 = "appmarket://details?id=com.huawei.browser";Uri uri = Uri.parse(text1);Intent intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent);}3、方式3:market:// + 華為商店 + APPID
public void launchAppDetilOnMarket3() {String text1 = "market://com.huawei.appmarket.applink?appId=C100170981";Uri uri = Uri.parse(text1);Intent intent = new Intent(Intent.ACTION_VIEW, uri);startActivity(intent);}?
4、鏈接到web AG的應用詳情頁
典型使用場景:應用的官網或者web投放等場景,用戶點擊web鏈接,直接拉起AppGallery中應用的詳情頁面,引導用戶安裝。
使用方法:
-
方法1:https://appgallery.huawei.com/#/app/YOUR_APPID
-
方法2:https://appgallery.cloud.huawei.com/appDetail?pkgName=pkgName
-
方法4:https://appgallery.huawei.com/#/app/YOUR_APPID?pkgName=pkgName
-
方法3:https://appgallery.cloud.huawei.com/marketshare/app/?YOUR_APPID?locale=LOCALE&shareTo=WAP&shareFrom=channeID
?
參數介紹? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
| ? 參數名 | ? 參數類型 | ? 備注與取值 |
| ? YOUR_APPID | ? String | ? 應用的APPID:例如華為瀏覽器:C100170981 |
| ? pkgName | ? String | ? 應用包名,例如華為瀏覽器:com.huawei.browser |
| ? LOCALE | ? String | ? (可選)設置國家和展示語言,例如:zh-CN |
| ? WAP | ? String | ? (可選)分享到何處,可以自行定義,例如:wap |
| ? channeID | ? String | ? (可選)分享來源,可以設置渠道統計標識,即渠道號碼 |
?
示例:
// 1、最短鏈接:通過APPID
https://appgallery.huawei.com/#/app/C100170981
// 2、通過包名
https://appgallery.cloud.huawei.com/appDetail?pkgName=com.huawei.browser
// 3、APPID與包名組合使用
https://appgallery.huawei.com/#/app/C100170981?pkgName=com.huawei.browser
// 4、詳細鏈接并且加上可選參數(不常用,一般在圖章中使用)
https://appgallery.cloud.huawei.com/marketshare/app/C100170981?locale=en_US&shareTo=wap&shareFrom=52656
?
5、圖章鏈接到AG的應用詳情頁
圖章鏈接,簡單來說,就是有一個AppGallery的圖,點擊這個圖,可以超鏈接到華為應用市場的應用詳情頁。應用的營銷人員,可以直接將這個圖用于投放(其鏈接的本質,與上述方法4的web鏈接相同)。
典型使用場景:對于與上架的應用,營銷人員希望通過圖章鏈接,在官網上導流到應用商店,或者直接用于投放。
創建方法:在AGC首頁?-> 點擊“應用內分發”-> 即可在應用內分發的界面“制作圖章”, 即可為已上架的應用制作圖章鏈接。
注意點:僅已上架的應用才能制作圖章,并且每個應用只能創建一個圖章;如果應用已創建圖章,則只能在 “圖章查詢”中查看。
使用指南:
圖章創建以后,即可在“圖章查詢”頁簽中,查看當前已經創建的圖章, 你可以在該界面,下載圖章或者復制鏈接:
-
下載圖章:下載的結果是一個png圖片,可以掛在官網或者營銷H5頁面里。
-
新增鏈接:用于標識不同的渠道,例如:Facebook,baidu等
-
復制鏈接:可根據不同的渠道下載不同的鏈接
?
使用示例:
?
// 1、典型的鏈接
https://appgallery.huawei.com/#/app/C100170981?channelId=baidu&referrer=TestBaidu&id=fa09e0f0f3de489386a7180d7b4b3585&s=6E90164FC0CED39CD11D9BE25BE6D1B333FEDCCBCD90A86F29A8DA2400AA4163&detailType=0&v=
// 2、使用典型的圖章,在網站中嵌入該圖章,點擊即可跳轉到應用詳情下載頁,使用實例如下:
? ? ? ?
?
6、跨平臺的App Linking鏈接
App Linking 是華為AppGallery Connect推出的一項新的服務,大家知道和接觸的比較少,因此下面的介紹會更加詳細并且更加通俗,幫助大家更好的理解這個
AppLinking是什么:App Linking就是一個可以跨平臺(Android,iOS,PC-Browser)使用的鏈接,對標于Firebase的Dynamic Link功能,幫助應用開發者快速構建跨平臺的分享鏈接。
AppLinking用在哪:比如說一個應用在Android和iOS都有發布,此時有個促銷活動需要各個平臺的用戶參與;該活動的邀請鏈接,在Android和iOS上都要能夠生效,并且對于在PC瀏覽器打開的用戶,也能夠瀏覽相應的活動H5頁面。
使用AppLinking后有什么效果:
-
手機上已安裝該應用:AppLinking鏈接將自動拉起應用,并且跳轉到指定頁面,
-
手機上未安裝該應用:鏈接將提示你通過應用市場打開,可配置為華為AppGallery或者本地應用商店,下載并安裝好應用以后,仍可打開指定頁面。
?
AppLinking怎么用:AppLinking有三種創建方式:適用于不同的場景:
-
AGC界面創建:在AGC首頁?-> 點擊“我的項目”并選擇相應的項目-> 在左側菜單欄找到“增長”-“ App Linking”。在AppLinking界面先創建鏈接前綴,然后在創建AppLinking.
該方式主要給不懂代碼的營銷同事使用,但里面使用到的深度鏈接地址,還是需要跟開發同事獲取。
-
Android應用內創建:在Android應用內,集成AppLinking SDK,并且通過build.buildAppLinking()等相關代碼進行鏈接的實時創建。
該方式主要提供給Android用戶的實時創建,比如應用內的活動頁面,添加一個分享按鈕,點擊分享按鈕,就創建一個AppLinking鏈接。
-
?iOS應用內創建:和Android應用一樣,這個就是在iOS應用內,使用代碼進行鏈接創建。
該方式主要提供給iOS用戶,讓iOS用戶在應用通過代碼實時創建并且分享。
?
非華為手機上怎么用:
AppLinking是跨平臺的,也即適用于所有Android和iOS,那肯定很多同學關心“在非華為的Android手機上怎么使用AppLinking?”這個問題,下面這方面問題做相應的解答:
1、?非華為手機能否使用AppLinking?—— App Linking不依賴HMS Core,可以在所有Android設備上使用,GMS和HMS設備通用。
2、?應用未安裝且手機上未安裝華為應用市場,AppLinking怎么用? —— 對于沒有安裝AppGallery的Android手機,可以將AppLinking配置為?本地應用市場打開,這樣Android系統就會引導讓你選擇通過哪個商店商店打開,只要你的包名一致,可以任何商店的應用詳情頁。
?
使用示例
// 1、典型的鏈接前綴
https://photoplaza.drcn.agconnect.link?????? // 其中photoplaza為應用唯一參數,drcn.agconnect.link為系統固定參數。
// 2、典型的AppLinking鏈接:
https://photoplaza.drcn.agconnect.link/vm3Y
// 3、 典型的Android創建AppLinking
| 1 2 3 4 5 6 7 | private?static?final?String?DOMAIN_URI_PREFIX?=?"https://photoplaza.drcn.agconnect.link";private?static?final?String?DEEP_LINK?=?"https://developer.huawei.com";public?void?createAppLinking()?{ ?????AppLinking.Builder?builder?=?new?AppLinking.Builder() ?????????????.setUriPrefix(DOMAIN_URI_PREFIX) ?????????????.setDeepLink(Uri.parse(DEEP_LINK)) ?????????????.setAndroidLinkInfo(new?AppLinking.AndroidLinkInfo.Builder().build()); ?????String?LongAppLinking?=?builder.buildAppLinking().getUri().toString(); ?} |
// 4、典型的iOS創建AppLinking
| 1 2 3 4 5 6 7 | -?(IBAction)CreatLink:(id)sender?{ AGCAppLinkingComponents?*component?=?[[AGCAppLinkingComponents?alloc]?init]; component.uriPrefix?=?@"https://photoplaza.drcn.agconnect.link";????? component.deepLink?=?@"https://www.developer.huawei.com";????? component.iosBundleId?=?@"com.lucky.agc.demo"; ????component.iosDeepLink?=?@"agckit://ios/detail"; ????self.longlink.text?=?component.buildLongLink.absoluteString; |
?
7、相關參考鏈接
圖章鏈接官方文檔:https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/appgallery-agd-introduction-stamped
App Linking官方文檔:https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/agc-applinking-introduction-0000001054143215
添加歸因參數文檔:https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/appgallery-referrer-createlink
獲取歸因信息:https://developer.huawei.com/consumer/cn/doc/development/AppGallery-connect-Guides/appgallery-referrer-develop
原文鏈接:https://developer.huawei.com/consumer/cn/forum/topic/0201448086867860655?fid=0101271690375130218&pid=0301448086867860778
原作者:Mayism
?
總結
以上是生活随笔為你收集整理的华为AppGallery常用跳转与链接详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle存储过程借助utl,使用UT
- 下一篇: css三角形的IE兼容写法