@Override
public void onReceive(final Context context, Intent intent) {
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
telephony.listen(new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
Log.d(TAG, "Call received: "+incomingNumber);
if (!incomingNumber.isEmpty()) {
WritableNativeMap params = new WritableNativeMap();
params.putString("app", "phone");
params.putString("text", incomingNumber);
NotificationModule.sendEvent("notificationReceived", params);
}
}
}, PhoneStateListener.LISTEN_CALL_STATE);
}
CallListener.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:things-notification
作者:
评论列表
文章目录