如何修复应用程序以防止其不断要求更新

时间:2018-12-03 11:15:02

标签: java android

我已将更新上传到Play上的应用程序中,更新后,它会要求再次更新。

该应用在其他简单的WebView应用上包含几个按钮,而Google Play一直希望更新该应用。 我找不到导致此的任何错误。

请多加注意,以免造成这种情况。

public class PilatesTimetable extends AppCompatActivity {
WebView rootView;
boolean installed;
ImageButton myWhatsApp;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pilates_timetable);
    rootView = findViewById(R.id.timetable);
    rootView.loadUrl("http://www.example.com");
    rootView.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
    WebView.setWebContentsDebuggingEnabled(false);
    installed = appInstalledOrNot("com.whatsapp");
    myWhatsApp = findViewById(R.id.whatsAppButton);

    if (installed) {
        myWhatsApp.setVisibility(View.VISIBLE);
    }
    if (myWhatsApp.getVisibility() == View.VISIBLE) {
        myWhatsApp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String number = "+3530871234567";
                    String url = "https://api.whatsapp.com/send?phone=" + number;
                    Intent i = new Intent(Intent.ACTION_VIEW);
                    i.setData(Uri.parse(url));
                    startActivity(i);
            }
        });
    }
}

    public void callUs(View v){
        Intent callIntent = new Intent(Intent.ACTION_DIAL);
        callIntent.setData(Uri.parse("tel:0871234567"));
        startActivity(callIntent);
    }

    public void textUs(View v){
        try{
                Intent textIntent = new Intent(Intent.ACTION_SENDTO);
                textIntent.setData((Uri.parse("smsto:0871234567")));
                startActivity(textIntent);

        } catch (ActivityNotFoundException e) {
            Toast.makeText(PilatesTimetable.this, "You do not have a texting application installed.", Toast.LENGTH_LONG).show();
        }
    }

    public void emailUs (View v){
            try {
                Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
                emailIntent.setData((Uri.parse("mailto:user@example.com")));
                startActivity(emailIntent);
            } catch (ActivityNotFoundException e) {
                Toast.makeText(PilatesTimetable.this, "You do not have an email application installed.", Toast.LENGTH_LONG).show();
            }
    }

    public void bookOnline (View v){
        try {
            Intent bookIntent = new Intent(Intent.ACTION_VIEW);
            bookIntent.setData((Uri.parse("http://www.example.com")));
            startActivity(bookIntent);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(PilatesTimetable.this, "You do not have an Internet viewing application installed.", Toast.LENGTH_LONG).show();
        }
    }

    public boolean appInstalledOrNot(String uri) {
        PackageManager pm = getPackageManager();
        boolean app_installed;
        try {
            pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
            app_installed = true;
        }
        catch (PackageManager.NameNotFoundException e) {
            app_installed = false;
        }

        return app_installed;
    }
}

活动中的示例代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ie.myPackage.PilatesTimetable">

<WebView
    android:id="@+id/timetable"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:layout_alignParentEnd="true"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout"
    app:layout_constraintTop_toTopOf="parent">
</WebView>

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="85dp"
    android:background="@color/primaryLightColor"
    android:orientation="horizontal"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent">

<ImageButton
        android:id="@+id/whatsAppButton"
        android:layout_width="0dp"
        android:layout_height="85dp"
        android:layout_weight="1"
        android:background="@null"
        android:backgroundTint="@color/primaryLightColor"
        android:contentDescription="@string/whats_app_us"
        android:tint="@color/white"
        android:visibility="gone"
        app:srcCompat="@drawable/wa_55" />

1 个答案:

答案 0 :(得分:0)

我刚刚结束与Google的聊天,他们确认目前与此有关。 因此,与该应用无关,这是他们的系统。