1
I would like to know how I can limit the download demand on my app,20 per hour...
obs. 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.
Updating
If the customer makes 10 downloads and comes back after 1 hour the ideal would be that Zera up the count.
This is the code I use to 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 your attention from now on!
I understood the logic expensive, more I have doubts, what is the result in timestamp for 1 hour... I had thought to use the timestamp more I’m not sure if it will always work the calculation.
– Wallace Roberto
I gave a studied here on timestamp all right now, thank you!
– Wallace Roberto
Not at all. I hope it works out there.
– Pablo Almeida