android rate app programmatically
In this Article today learn to android rate app programmatically. rate app source code available in this article.android rate app programmatically. from the android studio for more information visit the Google developer .
follow the android rate app programmatically source code android studio.
1.MainActivity.java:
package com.akash.app;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
Button btnrate;
final Intent[] intent = new Intent[1];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnrate=(Button)findViewById(R.id.btnrate_app);
btnrate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent[0] = new Intent(android.content.Intent.ACTION_VIEW);
//Copy App URL from Google Play Store.
intent[0].setData(Uri.parse("https://play.google.com/store/apps/details?id=com.sql.commands.app"));
startActivity(intent[0]);
}
});
}
}
2.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">
<Button
android:id="@+id/btnrate_app"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/input_label"
android:layout_centerHorizontal="true"
android:layout_marginTop="67dp"
android:text="Rate For App" />
</RelativeLayout>
No comments:
Post a Comment