This question already has answers here:
App on Google Play always shows "Update" instead of open [closed]
(6 answers)
Closed 4 years ago.
I have uploaded an update to my app on Play and as soon as I update it, it asks to update again.
The app comprises a few button on an otherwise simple WebView app, and Google Play keeps wanting to update the app.
I cannot find any errors causing this.
I would appreciate heads-up as so what could be causing this.
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;
}
}
Example code from the activity:
<?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" />
I have just finished chatting to Google and they confirmed that they have an ongoing issue with this at the moment.
So nothing to do with the app, it's their system.
Related
Respect my post Im a newbie :) thank you for understanding
sorry for my grammar
This program is to choose from gallery permission and send to second activity. the
permission is allowed is okay it will send it to the second activity...but when i clicked "oks" in the first popup permission and when i "dont allow files access the device" it will run and when i click button "pick " it will stay to and main activity when i click the button "pick"
MainActivity.java
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void buttonGalleryOpen(View view)
{
Intent intent = new Intent(this, gallery_view.class);
startActivity(intent);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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=".MainActivity">
<TextView
android:id="#+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="camera sample"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/textview1"
android:layout_marginTop="3dp">
<Button
android:id="#+id/button_pick"
android:layout_width="100dp"
android:layout_height="50dp"
android:layout_marginTop="30dp"
android:gravity="center"
android:onClick="buttonGalleryOpen"
android:text="pick" />
</RelativeLayout>
</RelativeLayout>
gallery_view.java
public class gallery_view extends AppCompatActivity {
private int STORAGE_PERMISSION_CODE = 1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gallery_view);
if (ContextCompat.checkSelfPermission(gallery_view.this,
Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
//noinspection deprecation
startActivityForResult(intent, 3);
} else {
requestStoragePermission();
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && data != null) {
Uri selectedImage = data.getData();
ImageView imageView = findViewById(R.id.imageviewfromgallery);
imageView.setImageURI(selectedImage);
} else {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}
private void requestStoragePermission() {
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.READ_EXTERNAL_STORAGE)) {
new AlertDialog.Builder(this)
.setTitle("Permission needed")
.setMessage("This permission is needed because of this and that")
.setPositiveButton("oks", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int which) {
ActivityCompat.requestPermissions(gallery_view.this, new
String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_CODE);
}
})
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialog, int i) {
dialog.dismiss();
}
})
.create().show();
} else {
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}
}
}
activity_gallery_view.xml
<RelativeLayout 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=".MainActivity">
<RelativeLayout
android:id="#+id/relative_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="camera sample"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>
<RelativeLayout
android:layout_below="#id/relative_1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageviewfromgallery"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
Check official documentation here https://developer.android.com/training/permissions/requesting#java
Also, after user disabled permission dialog,try to send user to app settings to enable it manually.
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts("package", getPackageName(), null); intent.setData(uri); startActivityForResult(intent, REQUEST_PERMISSION_SETTING);
I have used google place picker in android app for selecting location of the user by their wish. But when clicking the button it opened and suddenly it gets closed and if i click again only it opened to choose the location. And after opening also i can't search the location by typing the name.
Here i tried like this,
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="#+id/myButton"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Check Here"
android:textSize="16dp"
android:textStyle="normal"
android:textColor="#color/colorPrimary"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
MainActivity.java
Button button;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_homepage);
Button button = (Button)findViewById(R.id.myButton);
location_tv.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
try {
startActivityForResult(builder.build(PreviousAddressActivity.this),PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
}
});
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.e("dataview", String.valueOf(data));
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(data, this);
StringBuilder stringBuilder = new StringBuilder();
String latitude = String.valueOf(place.getLatLng().latitude);
String longitude = String.valueOf(place.getLatLng().longitude);
stringBuilder.append("LATITUDE :");
stringBuilder.append(latitude);
stringBuilder.append("\n");
stringBuilder.append("Longitude");
stringBuilder.append(longitude);
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(this, Locale.getDefault());
try {
addresses = geocoder.getFromLocation(place.getLatLng().latitude, place.getLatLng().longitude, 1);
String address = addresses.get(0).getAddressLine(0);
String city = addresses.get(0).getLocality();
Toast.makeText(getApplicationContext(),address, Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Totally frustrated with this issue. Can anybody help me?
Thanks in Advance...
Project is working fine But my problem is How to navigate from QR Code Reader to Particular URL. what is code to navigate please anyone tell me and help me.
AndroidBarcodeQrExample.java
public class AndroidBarcodeQrExample extends Activity {
static final String ACTION_SCAN = "com.google.zxing.client.android.SCAN";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void scanQR(View v) {
try {
Intent intent = new Intent(ACTION_SCAN);
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
} catch (Exception e) {
}
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
Toast toast = Toast.makeText(this, "Content:" + contents + " Format:" + format, Toast.LENGTH_LONG);
toast.show();
}
}
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="vertical" >
<Button
android:id="#+id/scanner"
android:layout_width="250dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:layout_margin="10dp"
android:gravity="center"
android:onClick="scanQR"
android:text="QR Code"
android:textSize="18dp" >
</Button>
</LinearLayout>
The code to open url in browser is as follow:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("Your url here"));
startActivity(browserIntent);
i want to make an if else condition for setOnClickListener. how should i do it? the code below is working correctly. its just that i would like to make a condition. if user enter numbers more than 10000, i want the app to make a pop up alert to tell user to edit the number so that it will not exceed 10000. please help me on how to do it. below is the code in java.
package com.example.mobilecatering;
public class mcpakej1 extends Activity {
private EditText phone;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mcpakej1);
phone = (EditText) findViewById(R.id.guest);
phone.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
Toast msg = Toast.makeText(getBaseContext(), "Maximum 10000 only.", Toast.LENGTH_LONG);
msg.show();
}
});
public void goReceipt(View v) {
Intent intent = new Intent(v.getContext(), doReceipt.class);
intent.putExtra("phone", phone.getText().toString());
startActivityForResult(intent,0);
}
}
}
this is the xml code.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView50"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Number of guest(s)"/>
<EditText
android:id="#+id/guest"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:inputType="number"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:hint="Enter number 1 to 10 000 only." />
</LinearLayout>
</ScrollView>
<ImageButton
android:id="#+id/gobutton"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignTop="#+id/homebtn"
android:layout_toRightOf="#+id/homebtn"
android:background="#drawable/gobutton"
android:onClick="goReceipt" />
</RelativeLayout>
User have to enter number in the EditText. after that when they click on GoButton to move to next page. if they enter number more than 10000, and they click on gobutton afterwards, the app suppose make an alert message for user and resume to the edittext after user click ok. how am i suppose to do that? help me please.
any helps is appreciated.... :)
you should do something like this
phone.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
try {
if (Integer.ParseInt(phone.getText().toString()) > 10000) {
Toast msg = Toast.makeText(getBaseContext(), "Maximum 10000 only.",
Toast.LENGTH_LONG);
msg.show();
} else {
// do something else
}
} catch(Exception e) {
// given text is not number
}
}
});
public void goReceipt(View v)
{
try {
int number = Integer.parseInt(((EditText) findViewById(R.id.guest)).getText().toString());
if (number > 50 && number <= 10000) {
Intent intent = new Intent(v.getContext(), doReceipt.class);
intent.putExtra("phone", phone.getText().toString());
startActivityForResult(intent,0);
} else {
Toast msg = Toast.makeText(getBaseContext(), "Maximum 10000 only.",
Toast.LENGTH_LONG);
msg.show();
}
} catch (Exception ex) {}
}
here is solution:
String str = phone.getText().toString();
if(Integer.parseInt(str) > 10000) {
Toast msg = Toast.makeText(getBaseContext(), "Maximum 10000 only.",
Toast.LENGTH_LONG);
msg.show();
} else {
//your code
}
Do like this,
btnFinalAns.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (edtFinalPolishRate.getText().toString().length() <= 0) {
a1.setMessage("FinalPolishRate is Empty");
edtFinalPolishRate.requestFocus();
}else{
a1.setMessage("MarketRate is Empty");
edtMarketRate.requestFocus();
}}};
I am developing an application using sms, my requirement is 1) send sms with static values 2)whenever we click on edit button we can change values and send sms , I can do both of them successfully but my third requirement is to send sms only when click on edit and change values click on submit buttons, without change value I do not want send sms. I want when click on edit button then only send sms, i tried with if(editBtn.isSelected) but it is not working. please tell any solution
my code is
xml file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical" >
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editBtn"
android:text="EDIT"
android:textColor="#00FF00"
android:onClick="editListener"/>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NUMBER"
android:textSize="20dip"/>
<EditText android:layout_width="150dip"
android:layout_height="wrap_content"
android:id="#+id/numberEdit"
android:text="8989897979"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
/>
</LinearLayout>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="MESSAGE"
android:textSize="20dip"/>
<EditText android:layout_width="150dip"
android:layout_height="wrap_content"
android:id="#+id/messageEdit"
android:text="HAI HOW R U"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:focusableInTouchMode="false"
/>
</LinearLayout>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/subBtn"
android:text="SUBMIT"/>
</LinearLayout>
Activty
public class MainActivity extends Activity {
private EditText contactEdit;
private EditText messageEdit;
private Button submitBtn;
private Button editBtn;
String contact;
String message;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
contactEdit = (EditText)findViewById(R.id.numberEdit);
messageEdit = (EditText)findViewById(R.id.messageEdit);
submitBtn = (Button)findViewById(R.id.subBtn);
editBtn = (Button)findViewById(R.id.editBtn);
if(editBtn.isSelected()){
submitBtn.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
contact = contactEdit.getText().toString();
message = messageEdit.getText().toString();
try{
SmsManager manger = SmsManager.getDefault();
manger.sendTextMessage(contact, null, message, null,
null);
Toast.makeText(getApplicationContext(), "SMS SENT",
100).show();
}
catch(Exception e){
Toast.makeText(getApplicationContext(), "SMS NOT
SEND", 100).show();
e.printStackTrace();
}
}
});
}
else {
Toast.makeText(getApplicationContext(), "NOT EDITED", 100).show();
}
editBtn.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
changeEdit();
}
});
}
private void changeEdit(){
contactEdit.setClickable(true);
contactEdit.setCursorVisible(true);
contactEdit.setFocusable(true);
contactEdit.setFocusableInTouchMode(true);
messageEdit.setClickable(true);
messageEdit.setCursorVisible(true);
messageEdit.setFocusable(true);
messageEdit.setFocusableInTouchMode(true);
}
}
Try to use OnTouchListener for the edittext
sample,
editBtn.setOnTouchListener(new OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
changeEdit();
return true;
}
});
if its not working
Create a boolean variable Globally and make it true if u touched onto the edittext,
//In grobal
boolean e_clicked = false;
//Inside the Edittext onTouchListener
e_clicked=true;
and check
if(e_clicked)
{
// your sms send action
}
try this
public class AlarmReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
#Override
public void onReceive(Context context, Intent intent) {
Intent intent=new Intent(context,Service.class);
//get lat/lng and pass it or get from service if u want
intent.putExtra("lat","lat");
intent.putExtra("lon","lng");
context.startService(intent);
}
}
public void SetAlarm(Context context) {
AlarmManager am = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(context, AlarmReceiver.class);
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, 0);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.MINUTE, 10);
am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),
calendar.getTimeInMillis(), pi);
}