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);
}
}
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");
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.
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.
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);