O
O
Oleg2019-01-28 10:23:31
Android
Oleg, 2019-01-28 10:23:31

How to offer to install the application correctly?

Task. Send an intent to a specific application. If not, suggest installing it.
Did so.
If the required application is installed, we call it. If not , then the installation page opens.
Received a black label: Violation of Deceptive Ads police
The reason is that the button does not print, but, as it were, advertise the application.
If I make the dialogue "Need to install the application" OK help to remove the claim?
Or will it again be considered that advertising is framed as standard interface elements?
How to rewrite the code minimally?

protected void sendToPrint(Intent intent) {
        final String appPackageName = "..........имяпакета........";
        PackageManager pm = getPackageManager();

        // check app installed
        PackageInfo pi = null;
        if (pm != null) {
            try {
                pi = pm.getPackageInfo(appPackageName, 0);
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
            }
        }
        if (pi == null) {
            // go to install - Ahtung !! Violation of Deceptive Ads police !
            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("https://play.google.com/store/apps/details?id=" + appPackageName)));
            }
        } else {
            // send to print
            intent.setPackage(appPackageName);
            startActivity(intent);

        }
    }

So it will be enough to redo it or will there be claims?
It confuses me that it still looks like an example of how not to do it.
https://play.google.com/about/monetization-ads/ads...
5c4f3725e210e894191256.jpeg
// go to install with dialog
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage(R.string.dialog_message)
                    .setTitle(R.string.dialog_title);
            builder.setPositiveButton(R.string.btn_install, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    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("https://play.google.com/store/apps/details?id=" + appPackageName)));
                    }
                }
            });
            AlertDialog dialog = builder.create();
            dialog.show();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2019-01-30
@402d

For the rush. Resolved the problem. The application has been back in play for more than a day.
It all started with this letter.
A picture with a violation was attached.
If a person watched it and read the description before that. I hope he would understand
why the transition is happening. But the robot does the check.
Finally it looks like this now.
The text on the "Open" button. AlerDialog has a custom title. Added picture. In the text we explain why it is necessary and that the transition will be on Google Play.
This is in order not to fall into violation again, which is similar to the standard dialogue.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question