Android code for rate us & more apps from developer

In this blog post, I would like explain how to code rate-us and more apps from developer in the app.

First we look at Rate Us :

Code Snippet:

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

Here the app actually search for the certain package name in the market. So, if your app isn’t published yet then you will get no application found in the play-store.

I’m using try with catch in the example, because if the device doesn’t have a play-store app installed then the app will get crashed.

 

Now More apps from Developer :
Code Snippet:

String developerName = geeks;     //where geeks is the company name in the play store
try {
 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q="+developerName)));
} catch (android.content.ActivityNotFoundException anfe) {
 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/search?q="+developerName+"&hl=en")));
}

This looks similar to the above code snippet? yes, but wait only one this has changed – the Application Package Name has been changed to Developer’s Profile Name or the Company Name.

In this example, i wrote “geeks” as my developer name/Company name but what if i have two name i.e “geeks gallery” has my company name? Then use “geeks%20gallery”. Got Confused?
For better solution: Go to play-store in web browser(PC) and search for your developer name or company name what ever it is, now copy paste that link in the above code snippet.

That’s it.

Hope this helpful. Your valuable comments are always welcomed. It will help to improve my post and understanding.

durga chiranjeevi

durga chiranjeevi

I'm currently working as Android developer at Energy Alternatives India. Interested in Application and Game development.
durga chiranjeevi

Leave a Reply

Your email address will not be published. Required fields are marked *