2017-08-07 126 views

回答

4

您可以使用Google提供的應用商店鏈接。 例如:

市場://細節ID =

這樣選擇的選項不會來和Play商店中直接打開。 這裏ID =您的Play商店中的appid例如:com.ninjakiwi.bftg(在你的情況)

市場://啓動Play商店應用加載目標頁面。

的http://讓用戶選擇是否啓動Play商店應用 或者處理請求的瀏覽器。如果瀏覽器處理 請求,它會在Google Play網站上加載目標網頁。

參考:https://developer.android.com/distribute/marketing-tools/linking-to-google-play.html

好。 window.location.href在這裏不起作用。因此,這裏是你的完整的解決方案:

你將有權使用Nativescript

import { Component, OnInit } from "@angular/core"; 

import * as utils from "utils/utils"; 

@Component({ 
    selector: "ns-details", 
    templateUrl: "./item-detail.component.html", 
}) 
export class ItemDetailComponent implements OnInit { 

    constructor(
    ) { } 

    ngOnInit(): void { 
    } 

    openURL() { 
     utils.openUrl("market://details?id=com.ninjakiwi.bftg"); 
    } 
} 

這裏的OpenURL功能會從視圖按鈕點擊事件調用提供utils的/ utils的模塊 更多: https://docs.nativescript.org/core-concepts/utils

+0

意圖在nativescript.then不會工作,我怎麼可以鏈接到該URL重定向 – Steve

+0

你的頁面,以市場://細節= com.ninjakiwi.bftg而不是ID https://play.google .com/store/apps/details?id = com.ninjakiwi.bftg點擊按鈕後 –

+0

我沒有找到位置問題的提供者。請檢查此:https://paste.ofcode.org/gSXXKpruPLFKMbUGpJW6j9 – Steve