pda的key和action是这样的
antion:"com.se4500.onDecodeComplete"
key:"se4500"
没有弹出
function plusReady() {
var main = plus.android.runtimeMainActivity(); //获取activity
var context = plus.android.importClass('android.content.Context'); //上下文
var receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
onReceive: getReceive //实现onReceiver回调函数
});
var IntentFilter = plus.android.importClass('android.content.IntentFilter');//引入过滤器
var Intent = plus.android.importClass('android.content.Intent');
var filter = new IntentFilter();
filter.addAction("com.se4500.onDecodeComplete"); //监听扫码广播
main.registerReceiver(receiver, filter); //注册监听
}
function getReceive (context, intent) {
alert(intent.getStringExtra("se4500"));//获取到的值,根据需要自行处理结果
}
0 个回复