Pour quelque chose comme une application «aide que je ne peux pas me lever» - existe-t-il un moyen pour un utilisateur de définir un numéro de contact, et ensuite pour l'application d'appeler ce numéro à l'avenir SANS l'utilisateur initier la dialout? Je l'ai essayé le ci-dessous, mais il semble y avoir un problème:Android: numéro d'appel sans utilisateur init?
private void callPhone(){
if(phoneNumber.length()>0){
try {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:"+phoneNumber));
startActivity(intent);
} catch (Exception e) {
Toast.makeText(getApplicationContext(), "Problem calling number.", Toast.LENGTH_LONG).show();
}
//startActivityForResult(new Intent(Intent.ACTION_CALL, Uri.parse("tel:+"+phoneNumber)), 1);
}
}