Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[unmaintained] This module allows your app to register listeners to the device phone. With this listeners you'll be able to know when the phone is receiving a call, making a call, etc.

License

NotificationsYou must be signed in to change notification settings

ulizama/phonelistener

Repository files navigation

This module allows your app to register listeners to the device phone. With this listeners you'll be able to know when the phone is receiving a call, making a call, etc.

Usage

Require the module on your tiapp.xml:

    <modules>        <moduleplatform="android">com.baboonmedia.phonelistener</module>    </modules>

You will also need to request some permissions to be able to listen to phone changes:

        <manifest>            <uses-permissionandroid:name="android.permission.PROCESS_OUTGOING_CALLS"/>            <uses-permissionandroid:name="android.permission.READ_PHONE_STATE"/>        </manifest>

Then on your app, you'll need to require the module, set the listener and initialize the module:

varPhoneManager=require('com.baboonmedia.phonelistener');PhoneManager.addEventListener('phoneChange',function(e){if(e.status=='incoming'){Ti.API.info('Ringing Icnoming from '+e.phone);}elseif(e.status=='outgoing'){Ti.API.info('Outgoing ringing to '+e.phone);}elseif(e.status=='offhook'){Ti.API.info('Call answered');}elseif(e.status=='hanged'){Ti.API.info('Call hanged up');}});PhoneManager.init();

You listen to thephoneChangeevent which will return an event with two properties:statuswhich is the current status of the phone, andphone which is the phone number used.

** NOTE: Only the incoming and outgoing events return the 'phone' number so you need to make sure to save it on those events. **

Phone Status

StatusDescriptionPhone
incomingThe phone is ringing with an incoming call.Yes, with the number that is calling.
outgoingA number has been dialed and the phone is waiting for recipient to pickup.Yes, with the dialled number.
offhookPhone is off the hook. A call is in place.No
hangedThe phone has been hanged.No

Usually the order of an actual call will be:

(incoming|outgoing) -> offhook -> hanged

And the order of a call with no answer will be:

(incoming|outgoing) -> hanged

Author

Uriel Lizamauriel@baboonmedia.com

Licenses

This work is released under the MIT license.

Appcelerator, Appcelerator Titanium and associated marks and logos are trademarks of Appcelerator, Inc.

Titanium is Copyright (c) 2008-2012 by Appcelerator, Inc. All Rights Reserved.

About

[unmaintained] This module allows your app to register listeners to the device phone. With this listeners you'll be able to know when the phone is receiving a call, making a call, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2026 Movatter.jp