2017-08-07 123 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