I am trying to launch my app from a dialed code (say #120) on the phone dialer. I believe I've seen some apps that do this already. So to launch the app, the user would go to the phone and try to make a call to #120, which would open my activity instead of making a phone call to #120. Anyone with ideas on how this can be accomplished?
Asked
Active
Viewed 355 times
1 Answers
1
By registering an intent in the chain of responsibility for the dialer-action. The chain of responsibility is ran down from first to last entry, and each registered observer may choose to either handle the entry or pass it down to the next entry in the chain. That way, you could handle the code with one application and let the other applications handle the phonecall.

Lars
- 5,757
- 4
- 25
- 55
-
Do you mean defining an Intent based on a PHONE action? – user914453 Aug 26 '11 at 17:04
-
Yes, I'll edit my answer to reflect the correct terminology (but the intent is called ACTION_CALL. – Lars Aug 26 '11 at 17:23
-
Ok, thanks for the clarification. So I guess I have to create an Intent-filter on ACTION_CALL and get the dialed code by reading the data passed to me via the intent. If it matches I am already in my activity code, so I can check the code used and if matches I can launch a separate activity (the app), if not what do I call to pass the resposibility back to the dialer? – user914453 Aug 26 '11 at 17:50
-
The [Package Manager](http://developer.android.com/guide/topics/intents/intents-filters.html#imatch) enables you to list the matching broadcasts, services and alike that match this intent. By crawling through the list, you can get the next one in the chain. I do not know, if there is a simpler method like "getNextIntent()" or something - check the documentation for that. – Lars Aug 26 '11 at 22:55