Nativescript 上下文注册SMS接收器

Nativescript 上下文注册SMS接收器,nativescript,Nativescript,嗨,我试图在代码中创建这个,但我至少要说一点 我睡在上面,在梦中我想到了以下几点: const intentFilter = new android.content.IntentFilter( android.provider.Telephony.SMS_RECEIVED ); application.android.registerBroadcastReceiver(intentFilter, function( context, intent ) { cons

嗨,我试图在代码中创建这个,但我至少要说一点

我睡在上面,在梦中我想到了以下几点:

const intentFilter = new android.content.IntentFilter(
    android.provider.Telephony.SMS_RECEIVED
);
application.android.registerBroadcastReceiver(intentFilter, function(
    context,
    intent
) {
    console.log('Text has been received.');
});
const intentFilter = 'android.provider.Telephony.SMS_RECEIVED';
application.android.registerBroadcastReceiver(intentFilter, function(
    context,
    intent
) {
    console.log('Text has been received.');
});