I am able to redirect the user to PlayStore with the screen of my application using the following code to give the rating and Review
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("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
But, please give/suggest the way how I can know that Has user Given Rating or not?
Thanks in Advance for your help
But, please give/suggest the way how I can know that Has user Given Rating or not?
There's no callback or similar mechanism for this.
I'm afraid it's impossible. There's no official Google API for Play Store. However there are some attempts which let you do some bacis things like retrieve comments using an app ID. Check AndroidMarketAPI.
Related
Hi there I just finished my first app for Android that I want to publish. In my app I have a button which allows users to share the link, to my app in the Google Play Store. Now I don't know how to get that link, because my app isn't published yet. Thanks.
https://play.google.com/store/apps/details?id=<YOUR_PACKAGE_NAME>
Replace <YOUR_PACKAGE_NAME> by your package name
the right practice is to call the view intent by market schema using your package name like below:
String yourPackageName = getPackageName();
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + yourPackageName)));
}
catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + yourPackageName)));
}
You need to know the app's package name which is declared in manifest file.You can link your app -
From an Android app:-
market://details?id=<package_name>
From a web site-
http://play.google.com/store/apps/details?id=<package_name>
How I can launch a Twitter application from another Android application? For example, in my application I have some social buttons when I pushed the button of Twitter now gone to twitter page, but I want to launch the twitter application. How I can do that?
You need to use an intent, check here: http://developer.android.com/reference/android/content/Intent.html
You can try this:
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + twitter_user_name)));
}catch (Exception e) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/#!/" + twitter_user_name)));
}
You should use an implict intent.you can read about it in general here,
and there is a more specific solution for you here
How to open specific page of another app on clicking add in app in android ? I am creating an android app in which add are showing .when clicking on that add it opens the play store. But i want to open specific page of that app using deeplinking. e.g am getting snapdeal offers add in my application when i click on that add it open the specific page of snapdeal.How to do that ?
Add the package name of the app you want to open in playstore:
String appPackageName = "package_xy"; // eg. com.twitter.android
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
}catch (android.content.ActivityNotFoundException e) {
//if playstore app not installed
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName)));
}
So you probably would need your advertisement to send the package name of their app with it. Or just an url to open (maybe send the playstore browser link in the catch above if its an app, so you could detect the play.google.com part and replace accordingly or just open the plain website if its not a playstore url).
You asked what happens if the app is already installed: Still the same. You should check for it first:
Intent i;
PackageManager manager = getPackageManager();
String appPackageName = "package_xy";
try {
i = manager.getLaunchIntentForPackage(appPackageName);
if (i == null)
throw new PackageManager.NameNotFoundException();
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
} catch (PackageManager.NameNotFoundException e)
{
//open playstore instead
}
So this is only one of many ways. If the app is not found on the device, the try will fail and catch is executed. If it is found it will be opened.
In the case of twitter I even could open it with a deeplink like this:
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://status?status_id="+id));
For some things like PDF there are ways to open the applicationpicker, but I don't think thats what you need in this case.
You should be fine if you use the above code. Just put the first snippet in the catch of the second one and you should be fine.
In my app, I want to allow users to open the Google Play store to see all of my other apps. In iOS, I just use the following (example) iTunes link to pull them all up:
https://itunes.apple.com/us/artist/electronic-arts/id284800461?mt=8
Is there a way to get ALL of my apps to show (besides a search for my company name, which is rather generic)?
Search for a product, including the pub: tag, as can be found at the API page entitled Linking to your products. Note that searching via a URL requires a different method. Both are included here. Start an intent like this:
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Developer+Name+Here")));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/developer?id=Developer+Name+Here")));
}
Note that the market doesn't work on the emulator, so this code will instead pull it up in a URL. This method courtesy of this answer.
Just use the developer parameter. This is the shortcut for googles
https://play.google.com/store/apps/developer?id=Google+Inc.
Google's Apps
Just put a + between works if there are spaces
Android actually has an even better way to handle this.
You can also group all your applications by the package names, provided you had the discipline to actually think over it. For instance, if all my apps start with com.mycompanyname.androidappname, I can simply search https://play.google.com/store/search?q=com.mycompanyname.*
Now there are another ways described here
https://developer.android.com/distribute/marketing-tools/linking-to-google-play#OpeningPublisher
e.g. for Google Inc
https://play.google.com/store/apps/dev?id=5700313618786177705
You can use this, it works for me
private void moreApps(Context context, int devName){
try {
context.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(context.getString(R.string.url_market_search_app)
+ context.getString(devName))));
} catch (android.content.ActivityNotFoundException anfe) {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(context.getString(R.string.url_playstore_search_app)
+ context.getString(devName))));
} catch (Exception e) {
Toast.makeText(context,
R.string.install_google_play_store,
Toast.LENGTH_SHORT).show();
}
}
}
I am building many apps for Android and wish to have a menu button in the apps that basically opens a list of my other apps in the Android Market.
Is there a way to create an intent and have the Android market pop up with a search (of my company) in the market so users can buy other apps?
ian
Even better to use "market://details" instead of "market://search":
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.android.example"));
startActivity(intent);
Then it opens directly the details page of the app. With search it shows a single search result and the user has to do an additional click to get to the detail page.
Yes, there is a documented Intent syntax for that (http://market.android.com/search?q=pub:<Developer Name> or market://search?q=pub:<Developer Name>).
The intent action would be view, and uri the market url/uri.
Like this:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:<developer name>") ) );
Another way is to launch a URL Intent with your application's package name in it.
User will get popup with list of installed Browsers + Play Store app in which he can view your target app.
String appPackageName = "com.example.android";
String url = "https://play.google.com/store/apps/details?id=" + appPackageName;
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
Above code is tested and works as expected on Play Store version 4.1.6
On my real devices Sony Xperia Pro and PocketBook tablet, even when you put a link to play web store e.g. https://play.google.com/store/apps/details?id=com.estrongs.android.pop
It will ask if you want to open it in the default browser or in the Play market.
If you select Play market - application is shown as expected.
Did not test it with intent, tested with Autolink from TextView.
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.adfree:
final String appPackageName = "com.zooohooo.noads"; // Can also use getPackageName(), as below
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
return true;
case R.id.rate:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
return true;
}
return super.onOptionsItemSelected(item);
}