how to implement Rate Us in android - android

I have made an application now i want to implement Rate Us feature in it. so for that i have added this code in my app
i = new Intent(Intent.ACTION_VIEW , Uri.parse("market://details?id=com.bet.compny"));
startActivity(i);
break;
but when i click on the button for rate us getting force close. here is my log cat output.
android.content.ActivityNotFoundException: No Activity found to handle Intent {
act=android.intent.action.VIEW dat=market://details?id=com.bet.compny }
Any help would be appretiated.

Idk why you get the Error, but this should actually work. I also do it like this:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));
But keep in mind that this would crash, if you are testing it on an Emulator/ a device without a play store. So I would suggest you to wrap it in a try and catch

This error occurs when running on a device without the Google PlayStore.
I guess you might be running this on a emulator device which doesn't have Playstore and hence the error.
Implement using try catch as follows:
try{
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+getPackageName())));
}
catch (ActivityNotFoundException e){
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName())));
}

I am always using below code which is useful for us:
Intent rateIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName()));
startActivity(rateIntent);
In think it will help full for you.

This is the best way to do it;
Appirater is an android library based off the original Appirater By
Arash Payan Appirater iPhone. The goal is to create a cleanly designed
App Rating prompt that you can drop into any android app that will
help remind your users to review your app on the android Market.
https://github.com/sbstrm/appirater-android

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

Best and Simple Code
private final String mStoreLink;
Without Activity need context/activity
this.mStoreLink = "market://details?id=" + activity.getPackageName();
Creat a method like this.
public void rateUsOnGooglePlay() {
final Uri marketUri = Uri.parse(mStoreLink);
try {
activity.startActivity(new Intent(Intent.ACTION_VIEW, marketUri));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(activity, "Couldn't find PlayStore on this device", Toast.LENGTH_SHORT).show();
}
}

This commonly happens on a device without the Google Play Store

i think u have test this code in emulator, and emulator have no plastore application, so this error came.
I have implement this and my code is like this.
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=applicationID of play sotre")));
please put try catch in bellow code.
and try this code in android device.

Uri marketUri = Uri.parse("market://details?id=" + packageName);
Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
startActivity(marketIntent);

in my case, I wanted the user to click on "MORE BY US" and he would be redirected
to my playstore homepage, but the app was crashing. The reason was simple. I added extra spaces and lines to the link something like below:
<string name = "more_app_link">
playstore.link...............
</string>
then I removed extra lines and spaces like this:
<string name = "more_app_link">playstore.link...............</string>
and it worked very well.

Related

How to launch Play Store in libgdx

Hi i am creating a simple game and i want yo know how to launch Play Store in ligbdx when someone would like to rate my game.
Please help!
Thanks
You have two options :
Either open directly by using complete URL (generic for all platform)
Gdx.net.openURI("https://play.google.com/store/apps/details?id=com.xyz.abc");
Use interfacing and implement platform specific APIs.
eg. like for Android
public void rate(){
Intent rateIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id=com.xyz.abc"));
//or
//Intent rateIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName()));
startActivity(rateIntent);
}
It prompt a choose dialog, having browser and Playstore app (If PlayStore installed in device) option. choose PlayStore.
EDIT
try {
Intent viewIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=" + getPackageName()));
startActivity(viewIntent);
}catch (android.content.ActivityNotFoundException anfe){
String url="https://play.google.com/store/apps/details?id="+getPackageName();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (intent.resolveActivity(getPackageManager())!=null) {
startActivity(intent);
}
}

How can i Search any web sites without typing http:// or www. (like other android browser's)

try {
ourBrowser.loadUrl("http://google.com");
} catch (Exception e) {
e.printStackTrace();
}
this code is ok i know but how can i search any site without using Http or www ... like other android browser's . example sometime we type Hello and Google give us all hello worlds with link's....... i m new in android world so please developer's help me out....?
i m also tried this method = ourBrowser.loadUrl("http://google.com"+url);
https://www.google.cz/search?q=search+term
is the thing you want or use it as intent:
Uri uri = Uri.parse("http://www.google.com/#q=fish");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
Maybe it's what you need ?
public void launchUrl(String URL){
Intent browserIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.google.fr/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q="+URL));
startActivity(browserIntent);
}
And you will call it with
launchUrl("MysearchExample");

Is it possible to open Play Store from application with a predefined search?

The following code opens Play store from my android application:
final String appPackageName = getPackageName();
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("http://play.google.com/store/apps/details?id="
+ appPackageName)));
}
Programmatically i want the user to see the search result for all the "File Explorers" available on the Play store as soon as it opens. When i fire the intent, what i see is Picture1 what i want is Picture2. Is it possible? Thanks in advance.
Try this:
startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("market://search?q=File%20Explorers")));
"market://" is resolved to the google play store URL and the "search?q=File%20Explorers" will open the search for the given parameters. %20 is the encoding for a space.

make user see all of my published application in google play store

I am these codes to redirect a app user to see all my published apps in google play. The problem is I am confused what to write in place of -publisher_name. How is that different from developer's name?
Uri uri = Uri.parse("market://search?q=pub:<publisher_name>");
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/search?q=pub:<publisher_name>")));
}
It is described at the Developer Page for Android.
http://developer.android.com/distribute/googleplay/promote/linking.html#OpeningPublisher
http://developer.android.com/distribute/googleplay/promote/linking.html#android-app
Quote:
"
From an Android app:
market://search?q=pub:<publisher_name>
Here's an example:
http://play.google.com/store/search?q=pub:Google+Inc.

Rate Google Play application directly in app [duplicate]

This question already has answers here:
Use application to rate it on market [duplicate]
(4 answers)
Closed 3 years ago.
I need to make rate option in my android app.
I found this link
but I'm not sure that want I search. I want to just provide ability for users to rate my app on Google Play.
The rating is done through market app so that ratings can be trusted. If apps were allowed to handle the rating themselves, then the developer could manipulate the app's rating any time. So there is no way you can handle the rating yourself. You can only prompt the user to your app page on Google Play and ask them to rate your app for more support.
Use the built-in intent to launch market
private void launchMarket() {
Uri uri = Uri.parse("market://details?id=" + getPackageName());
Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(myAppLinkToMarket);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, " unable to find market app", Toast.LENGTH_LONG).show();
}
}
Simple do this...
final String appPackageName = "your.package.name";
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("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
You can use 3rd party tool. Here are some commonly used solutions:
appirater: https://github.com/drewjw81/appirater-android/
apptentive: http://www.apptentive.com/
polljoy: https://polljoy.com
AppRater: https://github.com/delight-im/AppRater
public void launchMarket()
{
Uri uri = Uri.parse("market://details?id=" + this.getPackageName());
Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri);
try
{
mContext.startActivity(myAppLinkToMarket);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(this, " Sorry, Not able to open!", Toast.LENGTH_SHORT).show();
}
}
Users can't rate your app directly from within your app. They must go to Google Play and rate it. Like the link shows, you must redirect the user to view your app on Google Play:
mContext.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + APP_PNAME)));
For the code below, I have used try and catch method. The try and catch method will work as follows. On button click, the try method will try to search for the Google play store app on your android phone and launches it if is already installed and navigates to your application on the play store. However, in case you don't have the play store app on your android phone, catch method is executed and launches browser installed on your application and navigates to your application on the play store. getPackageName() is an inbuilt function that gets your project package name. You can add it manually as a string.
Also see for amazon store
String package="com.example.android";
The full code.
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
try {
Uri uri = Uri.parse("market://details?id="+getPackageName()+"");
Intent goMarket = new Intent(Intent.ACTION_VIEW, uri);
startActivity(goMarket);
}catch (ActivityNotFoundException e){
Uri uri = Uri.parse("https://play.google.com/store/apps/details?id="+getPackageName()+"");
Intent goMarket = new Intent(Intent.ACTION_VIEW, uri);
startActivity(goMarket);
}
}
});
I was searching for a feature similar to iOS, where the user doesn't need to be redirected to play store and again asked to write his reviews. Initially, I thought this was impossible but thankfully my understanding was outdated. Found this app which does that searching for code though.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.test(This is the package name)"));
startActivity(intent);
I always use a method like this one
private void launchMarket() {
Uri uri = Uri.parse("market://details?id=" + getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "couldn't launch the market", Toast.LENGTH_LONG).show();
}
}
Paste this simple code to go play store rating page from your Application
Intent intent1 = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id="
+ MainActivity.this.getPackageName()));
startActivity(intent1);

Categories

Resources