霍尼维尔的EDA50P扫描正常
This commit is contained in:
@ -11,6 +11,8 @@
|
|||||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||||
<uses-permission android:name="com.symbol.emdk.permission.EMDK"/>
|
<uses-permission android:name="com.symbol.emdk.permission.EMDK"/>
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="com.honeywell.decode.permission.DECODE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@ -24,7 +26,7 @@
|
|||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
android:screenOrientation="user"
|
android:screenOrientation="user"
|
||||||
>
|
>
|
||||||
<uses-library android:name="com.symbol.emdk"/>
|
<uses-library android:name="com.symbol.emdk" android:required="false"/>
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.NetworkSettingActivity"
|
android:name=".activity.NetworkSettingActivity"
|
||||||
android:label="@string/title_activity_setting_network" />
|
android:label="@string/title_activity_setting_network" />
|
||||||
@ -41,7 +43,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<service android:name=".service.ScanServiceEDA50P">
|
<service android:name=".service.ScanServiceEDA50P" android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.example.chaoran.ScanServiceEDA50P"/>
|
<action android:name="com.example.chaoran.ScanServiceEDA50P"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public enum BrandEnum {
|
|||||||
ROCKCHIP("瑞芯微电子", "rockchip"),
|
ROCKCHIP("瑞芯微电子", "rockchip"),
|
||||||
TEST("测试设备", "test"),
|
TEST("测试设备", "test"),
|
||||||
IDATA("匿名设备", "idata"),
|
IDATA("匿名设备", "idata"),
|
||||||
|
HONEY_WELL("霍尼维尔", "mobiwire"),
|
||||||
ALPS("阿尔卑斯", "alps");
|
ALPS("阿尔卑斯", "alps");
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
@ -86,6 +86,9 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
case ALPS:
|
case ALPS:
|
||||||
adapter = new AlpsAdapter(this, this);
|
adapter = new AlpsAdapter(this, this);
|
||||||
break;
|
break;
|
||||||
|
case HONEY_WELL:
|
||||||
|
adapter = new HoneywellAdapter(this, this);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (null != adapter) {
|
if (null != adapter) {
|
||||||
adapter.start();
|
adapter.start();
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import chaoran.business.activity.MainActivity;
|
|
||||||
import chaoran.business.activity.ResultListener;
|
import chaoran.business.activity.ResultListener;
|
||||||
import chaoran.business.service.ScanServiceEDA50P;
|
import chaoran.business.service.ScanServiceEDA50P;
|
||||||
import chaoran.business.service.ScanServiceZEBRA;
|
import chaoran.business.service.ScanServiceZEBRA;
|
||||||
@ -56,7 +55,11 @@ public class HoneywellAdapter implements Adapter {
|
|||||||
context.unregisterReceiver(this);
|
context.unregisterReceiver(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openContinueScan(){
|
public void openContinueScan(){
|
||||||
|
/**
|
||||||
|
* 扫描正常
|
||||||
|
*/
|
||||||
if("eda50p".equals(Build.MODEL.toLowerCase())){
|
if("eda50p".equals(Build.MODEL.toLowerCase())){
|
||||||
intent = new Intent(context, ScanServiceEDA50P.class);
|
intent = new Intent(context, ScanServiceEDA50P.class);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
@ -64,7 +67,8 @@ public class HoneywellAdapter implements Adapter {
|
|||||||
}else {
|
}else {
|
||||||
context.getApplicationContext().startService(intent);
|
context.getApplicationContext().startService(intent);
|
||||||
}
|
}
|
||||||
}else if("tc26".equals(Build.MODEL.toLowerCase())){
|
}
|
||||||
|
else if("tc26".equals(Build.MODEL.toLowerCase())){
|
||||||
intent = new Intent(context, ScanServiceZEBRA.class);
|
intent = new Intent(context, ScanServiceZEBRA.class);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
context.getApplicationContext().startForegroundService(intent);
|
context.getApplicationContext().startForegroundService(intent);
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import android.app.NotificationManager;
|
|||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -53,11 +54,10 @@ public class ScanServiceEDA50P extends Service
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
// Log.i(TAG, "onCreate方法被调用!");
|
// Log.i(TAG, "onCreate方法被调用!");
|
||||||
super.onCreate();
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
NotificationChannel channel = null;
|
NotificationChannel channel = null;
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { //适配8.0service
|
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { //适配9.0service
|
||||||
channel = new NotificationChannel(notificationId, notificationName, NotificationManager.IMPORTANCE_HIGH);
|
channel = new NotificationChannel(notificationId, notificationName, NotificationManager.IMPORTANCE_HIGH);
|
||||||
notificationManager.createNotificationChannel(channel);
|
notificationManager.createNotificationChannel(channel);
|
||||||
Notification notification = new Notification.Builder(getApplicationContext(), notificationId).build();
|
Notification notification = new Notification.Builder(getApplicationContext(), notificationId).build();
|
||||||
@ -178,7 +178,7 @@ public class ScanServiceEDA50P extends Service
|
|||||||
|
|
||||||
public void onBarcodeEvent(final BarcodeReadEvent event) {
|
public void onBarcodeEvent(final BarcodeReadEvent event) {
|
||||||
String barcodeDate = new String(event.getBarcodeData().getBytes(event.getCharset()));
|
String barcodeDate = new String(event.getBarcodeData().getBytes(event.getCharset()));
|
||||||
Intent intent2 = new Intent("com.pda.scan.result");
|
Intent intent2 = new Intent("com.honeywell.scan.broadcast");
|
||||||
intent2.putExtra("data",barcodeDate);
|
intent2.putExtra("data",barcodeDate);
|
||||||
sendBroadcast(intent2);
|
sendBroadcast(intent2);
|
||||||
if(isContinue) {
|
if(isContinue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user