Closed NBSeven closed 6 years ago
Hi
I’m not sure to have understood the question
If you’d want use this plugin you should have some needs that implies to write some native (java) code, otherwise I don’t understand the reason to use it.
However when you use cordova-cli to generate the android platform and add such plugin, some java stuff is automatically generated. Take a look in platform/Android folder
Thank you for your prompt reply. My project was generated by cordova-cli and I found some java files including yours .I have add some cordova plugins and most of them dont need to write native code . I konw use this plugin should write some native (java) code but I've never developed an android project.
I have a PDA(like a mobile phone) that has the function of scanning Barcode. I setting Barcode Receive Models is 'Broadcast'. The PDA company give me nativeJS code . It is worked on another framework that is like cordova.
function plusReady() {
var receiver;
main = plus.android.runtimeMainActivity();
receiver = plus.android.implements('io.dcloud.android.content.BroadcastReceiver', {
onReceive: function(context, intent) {
plus.android.importClass(intent);
var m_barcode = intent.getStringExtra("BARCODE");
console.log(m_barcode)
}
});
var IntentFilter = plus.android.importClass('android.content.IntentFilter');
var filter = new IntentFilter();
filter.addAction("com.barcode.sendBroadcast");
main.registerReceiver(receiver, filter);
}
if(window.plus) {
plusReady();
} else {
document.addEventListener('plusready', plusReady, false);
}
But I dont use this framework . I used cordova before. I 'm not sure that your plugin can implement this function. I'm sorry for my bad English.
In the last question I mean I don't know which file to put your native code in.
Hi @NBSeven
Don't worry about english. Code that you shared seems written in a sort of NativeScript.
If I well understood it ... this plugin is the perfect choice, just you have to translate it in pure android/java native code.
if your deadline is not imminent I can help you. Let me know
Thanks for your caring~I've solved the problem ^_^
I'm a front-end engineer and don't know anything about Android....Now I have a web-project and use cordova to build apk but i dont konw whitch .java file to write your android code ... thanks