2

I know it's probably impossible for security reasons but I am asking anyway because I can't find an answer on google. Is it possible to create an app (Android/iPhone) that starts an automatic call when the phone OS is locked?

possible scenario:

  1. user opens the app.
  2. the app executes a command in background that after 1 minute should start the call.
  3. user locks the phone.

Will the app execute the phone call?

hichris123
  • 10,145
  • 15
  • 56
  • 70
kaharoth
  • 160
  • 1
  • 9

2 Answers2

1

Yes it's possible for Android I think. You can use the AlarmManager or an Handler for the schedule problem. To decide which you have to take. Here an exceprt from the Android documentation:

Note: The Alarm Manager is intended for cases where you want to have your application code run at a specific time, even if your application is not currently running. For normal timing operations (ticks, timeouts, etc) it is easier and much more efficient to use Handler.

For starting a call in Android you can take a look here.

Community
  • 1
  • 1
Fenix
  • 106
  • 1
  • 5
  • Just to be sure we are understanding each other. If I lock the phone by pressing the sleep button on my Android phone (so that the user must insert the security code to unlock the phone again) will the code for the automatic phone call launched with AlarmManager or Handler still work? – kaharoth Jul 24 '14 at 17:30
  • I don't have enough experience with the use of Handlers to schedule Tasks, but with the AlarmManager it definitely executes. – Fenix Jul 24 '14 at 17:33
0

As Fenix told, You can do this with the help of AlarmManager and ACTION_CALL implicit intent.

You can give a try from adb using the below command,

$ adb -d shell am start -a android.intent.action.CALL -d tel:900XXXX69X

But once you trigger a call, Dialer will become the foreground application and the screen will switch on.

balachandarkm
  • 855
  • 2
  • 9
  • 11