_From @monichols on July 25, 2017 22:6_
Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ x] 3.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
using the plugin as instructed by the docs does not initiate a prompt after x number of uses when x>0.
Expected behavior:
the prompt to rate the app will launch successfully after 3 uses or launches.
Steps to reproduce:
Related code:
I inserted the following code into my app.component.ts:
import { AppRate } from '@ionic-native/app-rate';
constructor(public apprate:AppRate){
platform.ready().then(() => {
this.apprate.preferences= {
storeAppURL: {
ios: '849930087',
android: 'market://details?id=com.ionic.viewapp'
},
usesUntilPrompt: 3,
customLocale: {
title: "Rate Passion Project",
message: "We value your feedback! Please take a moment to tell us how we're doing",
cancelButtonLabel: 'No Thanks',
rateButtonLabel: 'Rate it!',
laterButtonLabel: 'Ask Later'
}
}
this.apprate.promptForRating(false);
});
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 2.0.2
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : ios 4.4.0
Ionic Framework : ionic-angular 3.5.3
System:
Node : v7.8.0
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim : 5.0.13
npm : 4.6.1
_Copied from original issue: ionic-team/ionic#12470_
_From @AmitMY on July 26, 2017 4:56_
Thanks for opening an issue.
You will get better help by moving this issue to https://github.com/ionic-team/ionic-native, as this repo handles the ionic core, and that one handles the cordova plugins
Can confirm this - for me, it's not just the uses until prompt, but the entire plugin. It might be a device ready issue. In my logs, when I start the app, I get the following:
deviceready has not fired after 5 seconds.
Channel not fired: onCordovaInfoReady
Same here. promptForRating(true) works, but with false parameter and usesUntilPrompt, the counter on localStorage never decreases
Just an update - I got the plugin to work somehow by uninstalling the platforms and reinstalling them again. And updating some of my other plugins too. :woman_shrugging:
Facing the same issue. promptForRating(true) works but the false parameter doesn't seem to be doing anything.
I had the same issue. I noticed the counter this.appRate.preferences.usesUntilPrompt did not decrease each time this.appRate.promptForRating(false); was called.
Not pretty, but I added the following code and now it seems to work as intended (I think)
this.appRate.promptForRating(false);
if(this.appRate.preferences){
this.appRate.preferences.usesUntilPrompt -= 1
}
Also having the same issue.
any solution to this issue?
Nothing new ? @f2ostie about your solution how can it work ? when you restart the app the preferences will be set like before, let say you've set usesUntilPrompt: 2, you decrease with your work around but then when you'll restart the app the number will still be 2 since you've set it at 2 just before and i think it may be the same behavior that disrupt the feature
Any news? Facing the same problem here.
any update on this?
@f2ostie's solution worked for me.
Same issue here. Any solution?
I have an Ionic 4 React Capacitor app, in order to get it working in had to call promptForRating(false) in a time out.
Below is a snippet from my Startup component.
import { AppRate } from "@ionic-native/app-rate";
....
useEffect(() => {
//https://github.com/pushandplay/cordova-plugin-apprate
AppRate.preferences = {
...AppRate.preferences,
simpleMode: true,
storeAppURL: {
android: "market://details?id=xxxxx",
ios: "xxxxx",
},
};
setTimeout(() => {
AppRate.promptForRating(false);
}, 5000);
}, []);
As a side not dont forget to install the InApp Browder plugin as well
https://ionicframework.com/docs/native/in-app-browser
I have an Ionic 4 React Capacitor app, in order to get it working in had to call
promptForRating(false)in a time out.Below is a snippet from my Startup component.
import { AppRate } from "@ionic-native/app-rate"; .... useEffect(() => { //https://github.com/pushandplay/cordova-plugin-apprate AppRate.preferences = { ...AppRate.preferences, simpleMode: true, storeAppURL: { android: "market://details?id=xxxxx", ios: "xxxxx", }, }; setTimeout(() => { AppRate.promptForRating(false); }, 5000); }, []);As a side not dont forget to install the InApp Browder plugin as well
https://ionicframework.com/docs/native/in-app-browser
Finally my error was another, I need to add customLocale to make it work:
customLocale: {
title: this.translate.instant('APP_RATE.title'),
message: this.translate.instant('APP_RATE.message'),
cancelButtonLabel: this.translate.instant('APP_RATE.cancelButtonLabel'),
laterButtonLabel: this.translate.instant('APP_RATE.laterButtonLabel'),
rateButtonLabel: this.translate.instant('APP_RATE.rateButtonLabel')
},
and callbacks…
callbacks: {
onRateDialogShow: function (callback) {
//console.log('onRateDialogShow');
},
onButtonClicked: function (buttonIndex) {
//console.log('Selected Index is ' + buttonIndex);
}
}
I don't know the reason why it doesn't work without those values in AppRatePreferences
Most helpful comment
I had the same issue. I noticed the counter
this.appRate.preferences.usesUntilPromptdid not decrease each timethis.appRate.promptForRating(false);was called.Not pretty, but I added the following code and now it seems to work as intended (I think)