Get the link to your app before publishing it - android

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>

Related

how can i launch a app form other on Android

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

using deep linking in android with adds

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.

Call Back After Giving Rating to app on PlayStore

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.

Is there a way to link to all of a developer's Google Play Store apps?

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

Open page in Facebook,Twitter and Google Plus app from other app - Android

I'm working on an application where I need to integrate the social functionality of the different social networks: Facebook, Twitter, Google+.
For now, in Facebook and Twitter i'm recognized if the user has a native application and if he does, I'm opening it and show him my fan page.
For Twitter I use the next code:
try {
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("twitter://user?screen_name=[user_name]"));
startActivity(intent);
}catch (Exception e) {
startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://twitter.com/#!/[user_name]")));
}
And for Facebook the next code:
try{
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/" + PROFILE_FACEBOOK_APP_ID));
startActivity(intent);
}catch(Exception e){
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/UserNamePage")));
}
Now I want to do the same thing for Google+. I saw that I can browse to my fan page with the next Url https://plus.google.com/MY_PAGE_ID/, but it keep asking me if I want to open it with Google+ application or with the browser, and I want that he will open it with the application automatically, without asking the user.
Is there a simple way to do this?
Thanks.
Found a solution:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.google.android.apps.plus",
"com.google.android.apps.plus.phone.UrlGatewayActivity");
intent.putExtra("customAppUri", "FAN_PAGE_ID");
startActivity(intent);
I think this is quite safe, because we do not need to specify the component, just the google+ app package name:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://plus.google.com/[Google+ID]/"));
intent.setPackage("com.google.android.apps.plus"); // don't open the browser, make sure it opens in Google+ app
startActivity(intent);
Unknown if google plus needs some other information in the Intent but as general Android solution you can explicitly set the target. You will need the package name of google+.
More info here: http://developer.android.com/reference/android/content/Intent.html#setPackage%28java.lang.String%29
For example:
Intent.setPackage("com.google.android.apps.plus"); //Don't know the exact package name

Categories

Resources