Jan Michael
Jan Michael

Reputation: 21

How to open the Google Play Store directly from my Android application using Nativescript

I'm new to both Android and Native Script. How do I open the Google Play Store inside my android app using Native Script. I've tried using web view and it works fine but I would like to open the Google Play Store using the Google Play Store app in the device.

Upvotes: 2

Views: 698

Answers (1)

Muhammad Waleed
Muhammad Waleed

Reputation: 2601

Add permission application

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Add code into oncreate method

String url = "https://play.google.com/store/apps";
        final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        startActivity(intent);

Upvotes: -1

Related Questions