-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRate.java
More file actions
28 lines (25 loc) · 1.29 KB
/
Rate.java
File metadata and controls
28 lines (25 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
private void rateApp() {
final String appPackageName = getPackageName(); // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
}
private void shareApp() {
final String appPackageName = getPackageName();
String myUrl = "https://play.google.com/store/apps/details?id=" + appPackageName;
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, myUrl);
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, "Share using..."));
}
private void moreApp() {
final String devName = "your-dev-name";
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://developer?id=" + devName)));
} catch (ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/developer?id=" + devName)));
}
}