I try to make a phone call from inside a service. The code I use is: Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse("tel:" + number)); startActivity(intent); and it work...
stackoverflow.com
B4X:
Dim P As PhoneCalls
Dim In As Intent = P.Call(Param)
In.Flags = Bit.Or(268435456, 4) 'FLAG_ACTIVITY_NEW_TASK + FLAG_FROM_BACKGROUND
StartActivity(In)
Dim In As Intent
In.Initialize2("tel:" & Param, Bit.Or(268435456, 4))
In.Action = In.ACTION_CALL
In.Flags = Bit.Or(268435456, 4) 'FLAG_ACTIVITY_NEW_TASK + FLAG_FROM_BACKGROUND
StartActivity(In)
It's not working and i'm getting no error message or hint. Code works fine when called while the Main activity is running.
Any ideas?
Old tutorial. Don't use services. Use receivers. Broadcast receivers are program components that can handle broadcasted messages. These messages usually notify about a system event. There are two types of receivers in Android: statically registered receivers and dynamically registered...
Old tutorial. Don't use services. Use receivers. Broadcast receivers are program components that can handle broadcasted messages. These messages usually notify about a system event. There are two types of receivers in Android: statically registered receivers and dynamically registered...
I don't really see what this topic has to do with my question.
Receiving intents and broadcasts as well as receiving SMS in my background service already works fine.
Both of them have slightly different problems - i don't want to hide the dialer (and let the call run in background), i just want to start a call while my own application just runs as a background service - for example when the screen is off or while I'm doing something else.
The problem is, that you can't call StartActivity from an Service module - and CallSubDelayed just waits until you reopen the app.