I used TelephonyManager and IMEI number to identify the reral user. when someone wants the app they send the IMEI and then I put it and Rebuild the project as signed the APK file to his number. After generate signed Apk , I'll send it via Whatsapp.
Some are installing & running, Some are installing only. plz can you tell what is the error for it. Thank you
under shows my Main Activity .java
public class MainActivity<AUTHORISED> extends AppCompatActivity {
private final static String AUTHORIZED_IMEI = "xxxxxxxxxxxxxxx";
TextView txtView, txv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions;
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, 1);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
} else {
return;
}
}
String deviceImei = telephonyManager.getDeviceId();
String authorisedImei = "356245995115572154" + "";
if (authorisedImei.equals(deviceImei)) {
txtView= findViewById(R.id.text2);
txtView.setText(deviceImei + " - Authorised");
startActivity(new Intent(MainActivity.this, AreatoRiyanActivity.class));
}
else {
txtView = findViewById(R.id.text2);
txtView.setText(deviceImei + " - Not authorised");
new CountDownTimer(5000, 1000) {
public void onTick(long millisUntilFinished) {
txv = findViewById(R.id.text1);
txv.setText("seconds remaining: " + millisUntilFinished / 500);
}
public void onFinish() {
finish();
}
}.start();
}
}
}