I would like to know how I can limit the download demand in my application, 20 per hour ...
I use firebase, no login, the only way I recognize a user and with id de anúncio do google
the application only works with internet connection.
Update
If the client makes 10 downloads and returns after 1 hour, the ideal would be to zero the count.
Here is the code I use for download:
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
final String STORAGE = mChat = getIntent().getExtras().getString("storage");
progress = ProgressDialog.show(MinhaActivity.this, "Download...",
"Aguarde...", true);
FirebaseStorage mStorage = FirebaseStorage.getInstance();
StorageReference storageRef = mStorage.getReferenceFromUrl("MY_DB").child(STORAGE).child(down+".mp3");
File sdCardDirectory = Environment.getExternalStorageDirectory();
final File localFile = new File(sdCardDirectory.getPath()+"/Audio",down+".mp3");
storageRef.getFile(localFile).addOnSuccessListener(new OnSuccessListener<FileDownloadTask.TaskSnapshot>() {
@Override
public void onSuccess(FileDownloadTask.TaskSnapshot taskSnapshot) {
Toast.makeText(Minhactivity.this,"Salvo em "+localFile.getAbsolutePath(),Toast.LENGTH_LONG).show();
progress.dismiss();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
}
});
}else{
Toast.makeText(MinhaActivity.this,"Você está sem Cartão de memória",Toast.LENGTH_LONG).show();
}
}
});
Thank you for the attention of everyone involved right now!