2

my app first check app data base on the app installed date, if data is to old i need to update full app (not the content data) so i create a button to notify if data is old. now i want to add a function for notification, when it click it automatically redirect to the google play app page

https://play.google.com/store/apps/details?id=com.app.testapp

2 Answers2

2

Try this on your button click inside your application

String appPackage = getPackageName(); 
try {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackage)));
} catch (android.content.ActivityNotFoundException ex) {
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackage)));
}

This question is already answered here Stack overflow link

Edit 1:
I found some sample for opening twitter app from iconic android. Similarly you can try for google app store

var scheme;

if(device.platform === 'iOS') {
    scheme = 'twitter://';
}
else if(device.platform === 'Android') {
    scheme = 'com.twitter.android';
}

appAvailability.check(
    scheme, // URI Scheme
    function() {  // Success callback
        window.open('twitter://user?screen_name=gajotres', '_system', 'location=no');
        console.log('Twitter is available');
    },
    function() {  // Error callback
        window.open('https://twitter.com/gajotres', '_system', 'location=no');
        console.log('Twitter is not available');
    }
);
Community
  • 1
  • 1
Sreehari
  • 5,621
  • 2
  • 25
  • 59
  • thanks for rp. This is working for native android but my one is ionic app i want to do this using ionic – Chamara Maduranga Jan 08 '16 at 07:40
  • @ChamaraMaduranga Can you please share your solution to check the updated version on store and raise an alert to user in ionic? – Mrunal Jan 28 '19 at 07:03
  • @Mrunal You could simply subscribe to an Observable on App-Load, which will let you know the current version of your app deployed in the store and raise an alert or provide an option to open the app directly on Native store. Just update the version details in the DB while uploading the app to stores. [Refer my solution below] – Nishant Tamilselvan Jul 29 '19 at 17:46
2

There is an Ionic Native Plugin which could be used:

Installation

ionic cordova plugin add cordova-plugin-market
npm install @ionic-native/market

Usage

import { Market } from '@ionic-native/market/ngx';

constructor(private market: Market) { }

...

this.market.open('your.package.name');

This opens an app's page in the market place for both Android & iOS (Google Play, App Store).