*没有灯塔叹息,也没有设备监控位置:InFocus Bingo50(Android 6.0)*
三星,Android Core OS手机运行完美,在InFocus M460 Bingo50(Android 6.0,skin inLife UI 2.0)中出现问题。 我应该为此设备中的扫描信标做些什么。 。信标已经在Gimbal Manager注册。
我尝试了一些方法,但没有得到任何结果。
试用1:让实际应用与Gimbal SDK 2.36相同,适用于Android。不适用于Infocus bingo50但不适用于三星Galaxy note5,Android一款非常完美。
试用2:为Beacon瞄准和放置监控(地理围栏)制作简单的基本应用程序。仍然Geofence的访问和退出工作,但Beaon不扫描,没有登录InFocus Bingo50。其他设备工作正常。
尝试3:使用了AltBeacon Lib。工作完美,但没有得到标识符,只有一个信标扫描信息,而2个信标已经打开。客户要求和使用Gimbal SDK的建议。 Acording to this link
Try2: MainActivity.java
package com.gimbal.hello_gimbal_android;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.gimbal.android.Gimbal;
public class MainActivity extends Activity {
LocationPermissions permissions;
private ArrayAdapter<String> listAdapter;
private ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
listView = (ListView) findViewById(R.id.list);
listView.setAdapter(listAdapter);
listAdapter.add("Setting Gimbal API Key");
listAdapter.notifyDataSetChanged();
Gimbal.setApiKey(this.getApplication(),
"a252edba-981a-4b7e-b668-38661b616415");
if (permissions == null) {
permissions = new LocationPermissions(this);
}
permissions.checkAndRequestPermission(listAdapter);
}
@Override
public void onRequestPermissionsResult(int requestCode,
String[] permissions, int[] grantResults) {
this.permissions.onRequestPermissionResult(requestCode, permissions,
grantResults);
}
@Override
public void onDestroy() {
super.onDestroy();
}
}
LocationPermissions.java
package com.gimbal.hello_gimbal_android;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.gimbal.android.BeaconEventListener;
import com.gimbal.android.BeaconManager;
import com.gimbal.android.BeaconSighting;
import com.gimbal.android.CommunicationManager;
import com.gimbal.android.PlaceEventListener;
import com.gimbal.android.PlaceManager;
import com.gimbal.android.Visit;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
public class LocationPermissions implements DialogInterface.OnClickListener {
private static final String TAG = "LocationPermissions";
public static final int LOCATION_PERMISSION_REQUEST_CODE = 100;
static private Activity activity;
public LocationPermissions(Activity activity) {
this.activity = activity;
}
private PlaceManager placeManager;
private PlaceEventListener placeEventListener;
private ArrayAdapter<String> listAdapter;
private BeaconManager beaconManager;
private BeaconEventListener beaconEventListener;
public void checkAndRequestPermission(ArrayAdapter<String> listAdapter) {
this.listAdapter = listAdapter;
if (isLocationPermissionEnabled()) {
enablePlaceMonitoring();
} else {
requestLocationPermission();
}
}
public boolean isLocationPermissionEnabled() {
return ContextCompat.checkSelfPermission(this.activity,
Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED;
}
public void requestLocationPermission() {
if (!ActivityCompat.shouldShowRequestPermissionRationale(this.activity,
Manifest.permission.ACCESS_FINE_LOCATION)) {
showMessageOKCancel(
"Permitting us to access your location will entitle you to receive exclusive offers when you visit our stores. Please allow us to access your location so that we can better help you navigate our event.",
this.activity, this, this);
return;
}
activityRequestPermission();
}
private static void showMessageOKCancel(String message, Activity activity,
DialogInterface.OnClickListener okListener,
DialogInterface.OnClickListener cancelListener) {
new AlertDialog.Builder(activity).setMessage(message)
.setPositiveButton("OK", okListener).create().show();
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
ActivityCompat.requestPermissions(this.activity, new String[] {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION },
LOCATION_PERMISSION_REQUEST_CODE);
} else if (which == DialogInterface.BUTTON_NEGATIVE) {
Log.e(TAG, "Application was denied permission!");
}
}
private void activityRequestPermission() {
ActivityCompat.requestPermissions(this.activity, new String[] {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION },
LOCATION_PERMISSION_REQUEST_CODE);
}
public void onRequestPermissionResult(int requestCode,
String[] permissions, int[] grantResults) {
if (requestCode == LOCATION_PERMISSION_REQUEST_CODE) {
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
enablePlaceMonitoring();
} else {
Log.e(TAG, "Application was denied permission!");
}
}
}
private void enablePlaceMonitoring() {
final SimpleDateFormat dateFormate = new SimpleDateFormat(
"MM/dd/yyyy, hh:mm:ss", Locale.UK);
final String dateTimeStr;
beaconEventListener = new BeaconEventListener() {
@Override
public void onBeaconSighting(BeaconSighting beaconSighting) {
// TODO Auto-generated method stub
super.onBeaconSighting(beaconSighting);
String UUID = beaconSighting.getBeacon().getUuid();
String beaconName = beaconSighting.getBeacon().getName();
String identifier = beaconSighting.getBeacon().getIdentifier();
Integer RSSI = beaconSighting.getRSSI();
long dateTime = beaconSighting.getTimeInMillis();
String dateString = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss")
.format(new Date(dateTime));
listAdapter.add(beaconName.toString() + " " + dateString+"Rssi: "+RSSI);
Log.i("GBeaconListener", "Name: " + beaconName + " RSSI: "
+ RSSI + " DateTime: " + dateString);
}
};
placeEventListener = new PlaceEventListener() {
String dateTimeStr;
@Override
public void onVisitStart(Visit visit) {
dateTimeStr = dateFormate
.format(visit.getArrivalTimeInMillis());
listAdapter.add(String.format("Start Visit for %s,\n %s", visit
.getPlace().getName(), dateTimeStr.toString()));
listAdapter.notifyDataSetChanged();
}
@Override
public void onVisitEnd(Visit visit) {
dateTimeStr = dateFormate.format(visit
.getDepartureTimeInMillis());
listAdapter.add(String.format("End Visit for %s,\n %s", visit
.getPlace().getName(), dateTimeStr.toString()));
listAdapter.notifyDataSetChanged();
}
@Override
public void onBeaconSighting(BeaconSighting beaconSighting,
List<Visit> list) {
super.onBeaconSighting(beaconSighting, list);
String UUID = beaconSighting.getBeacon().getUuid();
String beaconName = beaconSighting.getBeacon().getName();
String identifier = beaconSighting.getBeacon().getIdentifier();
Integer RSSI = beaconSighting.getRSSI();
long dateTime = beaconSighting.getTimeInMillis();
String dateString = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss",Locale.UK)
.format(new Date(dateTime));
// listAdapter.add(
// beaconName.toString() +" " + dateString );
Log.i("GPlaceListener", "Name: " + beaconName + " RSSI: "
+ RSSI + " DateTime: " + dateString);
}
};
beaconManager = new BeaconManager();
beaconManager.addListener(beaconEventListener);
placeManager = PlaceManager.getInstance();
placeManager.addListener(placeEventListener);
placeManager.startMonitoring();
beaconManager.startListening();
CommunicationManager.getInstance().startReceivingCommunications();
}
}
activity_main.xml中
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/list"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gimbal.hello_gimbal_android"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="19"
android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="8487000"/>
</application>
</manifest>
日志:
04-03 14:48:27.378: V/ActivityThread(30746): Handling launch of ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}} startsNotResumed=false
04-03 14:48:27.378: V/ActivityThread(30746): ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}}: app=android.app.Application@ef9b66b, appName=com.gimbal.hello_gimbal_android, pkg=com.gimbal.hello_gimbal_android, comp={com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}, dir=/data/app/com.gimbal.hello_gimbal_android-1/base.apk
04-03 14:48:27.415: V/ActivityThread(30746): Performing resume of ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}}
04-03 14:48:27.416: D/ActivityThread(30746): ACT-AM_ON_RESUME_CALLED ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}}
04-03 14:48:27.416: V/ActivityThread(30746): Resume ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}} started activity: false, hideForNow: false, finished: false
04-03 14:48:27.416: V/PhoneWindow(30746): DecorView setVisiblity: visibility = 4 ,Parent =null, this =com.android.internal.policy.PhoneWindow$DecorView{4b5cd50 I.E...... R.....ID 0,0-0,0}
04-03 14:48:27.417: D/WindowClient(30746): Add to mViews: com.android.internal.policy.PhoneWindow$DecorView{4b5cd50 I.E...... R.....ID 0,0-0,0}, this = android.view.WindowManagerGlobal@6d3b7fb
04-03 14:48:27.418: D/OpenGLRenderer(30746): CanvasContext() 0x7fa98e5800
04-03 14:48:27.420: D/ViewRootImpl(30746): hardware acceleration is enabled, this = ViewRoot{914d962 com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity,ident = 2}
04-03 14:48:27.427: V/ActivityThread(30746): Resuming ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}} with isForward=true
04-03 14:48:27.427: V/PhoneWindow(30746): DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{914d962 com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity,ident = 2}, this =com.android.internal.policy.PhoneWindow$DecorView{4b5cd50 V.E...... R.....ID 0,0-0,0}
04-03 14:48:27.428: V/ActivityThread(30746): Scheduling idle handler for ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}}
04-03 14:48:27.432: D/ActivityThread(30746): ACT-LAUNCH_ACTIVITY handled : 0 / ActivityRecord{88c3202 token=android.os.BinderProxy@a7a1713 {com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity}}
04-03 14:48:27.450: D/Surface(30746): Surface::allocateBuffers(this=0x7f94fbb400)
04-03 14:48:27.450: D/OpenGLRenderer(30746): CanvasContext() 0x7fa98e5800 initialize window=0x7f94fbb410, title=com.gimbal.hello_gimbal_android/com.gimbal.hello_gimbal_android.MainActivity
04-03 14:48:27.450: D/Surface(30746): Surface::connect(this=0x7f94fbb400,api=1)
04-03 14:48:27.452: W/libEGL(30746): [ANDROID_RECORDABLE] format: 1
04-03 14:48:27.455: D/mali_winsys(30746): new_window_surface returns 0x3000
04-03 14:48:27.464: V/InputMethodManager(30746): onWindowFocus: android.widget.ListView{7c335d6 VFED.VC.. .F....ID 32,32-688,1008 #7f080000 app:id/list} softInputMode=272 first=true flags=#1810100
04-03 14:48:27.464: V/InputMethodManager(30746): START INPUT: android.widget.ListView{7c335d6 VFED.VC.. .F....ID 32,32-688,1008 #7f080000 app:id/list} ic=null tba=android.view.inputmethod.EditorInfo@37edadc controlFlags=#105
04-03 14:48:27.480: I/[MALI][Gralloc](30746): [+]r_hnd(0x7fab9a7ce0), client(28), share_fd(40)
04-03 14:48:27.480: D/GraphicBuffer(30746): register, handle(0x7fab9a7ce0) (w:720 h:1184 s:720 f:0x1 u:0x000b00)
04-03 14:48:28.652: I/[MALI][Gralloc](30746): [+]r_hnd(0x7fab9a7380), client(28), share_fd(41)
04-03 14:48:28.652: D/GraphicBuffer(30746): register, handle(0x7fab9a7380) (w:720 h:1184 s:720 f:0x1 u:0x000b00)
04-03 14:48:28.669: I/[MALI][Gralloc](30746): [+]r_hnd(0x7fab9a79c0), client(28), share_fd(43)
04-03 14:48:28.670: D/GraphicBuffer(30746): register, handle(0x7fab9a79c0) (w:720 h:1184 s:720 f:0x1 u:0x000b00)
04-03 14:48:28.686: I/[MALI][Gralloc](30746): [+]r_hnd(0x7fab9a7ba0), client(28), share_fd(44)
04-03 14:48:28.686: D/GraphicBuffer(30746): register, handle(0x7fab9a7ba0) (w:720 h:1184 s:720 f:0x1 u:0x000b00)
04-03 14:49:01.283: V/InputMethodManager(30746): onWindowFocus: android.widget.ListView{7c335d6 VFED.VC.. .F.....D 32,32-688,1008 #7f080000 app:id/list} softInputMode=16 first=false flags=#181
更多日志:
04-04 00:37:45.138: D/NativeCrypto(3035): ssl=0x7f94e67480 NativeCrypto_SSL_interrupt
04-04 00:37:45.138: D/NativeCrypto(3035): sslNotify, appData=0x7f94ccb500 ret=1
04-04 00:37:45.138: D/NativeCrypto(3035): sslNotify, appData=0x7f94ccb500 ret=1
04-04 00:37:45.138: D/NativeCrypto(3035): ssl=0x7f94e67480 info_callback where=0x4008 ret=256
04-04 00:37:45.138: D/NativeCrypto(3035): ssl=0x7f94e67480 SSL3 alert write:W:CN warning close notify
04-04 00:37:45.139: D/NativeCrypto(3035): ssl=0x7f94e67480 info_callback ignored
04-04 00:37:45.139: I/System.out(3035): close [socket][/10.66.51.2:49434]
`
Try2的输出:
不使用InFocus M460:
使用其他设备:显示信标/地理围栏/放置日志。
更新
Infocus Bingo50默认为加密。再次,万向节样本应用程序无法观察/扫描信标。我在第三方信标扫描应用程序(扫描iBeacon)中测试了此设备,收到了信标日志但未在示例应用程序中进行测试。
更新日志:
05-31 18:49:01.876 17875-17875/com.gimbal.android.sample I/-----: Using android logger factory
05-31 18:49:02.031 17875-17875/com.gimbal.android.sample E/WifiManager: mWifiServiceMessenger == null
05-31 18:49:02.414 17875-18190/com.gimbal.android.sample E/GED: Failed to get GED Log Buf, err(0)
05-31 18:49:07.481 17875-18269/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=registration.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:07.481 17875-18269/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
05-31 18:49:07.482 17875-18269/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=registration.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:07.482 17875-18269/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
05-31 18:49:08.493 17875-18269/com.gimbal.android.sample D/libc-netbsd: getaddrinfo: registration.gimbal.com get result from proxy gai_error = 0
05-31 18:49:08.874 17875-18269/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=registration.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:08.874 17875-18269/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
05-31 18:49:09.255 17875-18269/com.gimbal.android.sample E/NativeCrypto: ssl=0x7fa84e1580 cert_verify_callback x509_store_ctx=0x7f921f4370 arg=0x0
05-31 18:49:09.255 17875-18269/com.gimbal.android.sample E/NativeCrypto: ssl=0x7fa84e1580 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
05-31 18:49:10.381 17875-18213/com.gimbal.android.sample W/G.d: [PropertyChangeNotif] Failed to update places: Unable to refresh place bubble, no fix available
05-31 18:49:10.416 17875-17935/com.gimbal.android.sample D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5
05-31 18:49:10.424 17875-18213/com.gimbal.android.sample I/BluetoothLeScanner: startRegisteration: mLeScanClients={com.gimbal.proximity.core.bluetooth.k$1@2838227=android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper@4d07cd4}
05-31 18:49:11.234 17875-18278/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=placebubble.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:11.237 17875-18278/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
05-31 18:49:11.246 17875-18278/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=placebubble.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:11.246 17875-18278/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
05-31 18:49:11.323 17875-18278/com.gimbal.android.sample D/libc-netbsd: getaddrinfo: placebubble.gimbal.com get result from proxy gai_error = 0
05-31 18:49:11.625 17875-18278/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=placebubble.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:11.625 17875-18278/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
05-31 18:49:11.966 17875-18278/com.gimbal.android.sample E/NativeCrypto: ssl=0x7fa84e2200 cert_verify_callback x509_store_ctx=0x7f9223e3b0 arg=0x0
05-31 18:49:11.967 17875-18278/com.gimbal.android.sample E/NativeCrypto: ssl=0x7fa84e2200 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
05-31 18:49:12.564 17875-18283/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=android.api.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:12.564 17875-18283/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
05-31 18:49:12.564 17875-18283/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=android.api.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:12.564 17875-18283/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
05-31 18:49:12.607 17875-18283/com.gimbal.android.sample D/libc-netbsd: getaddrinfo: android.api.gimbal.com get result from proxy gai_error = 0
05-31 18:49:12.912 17875-18283/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: hostname=android.api.gimbal.com; servname=(null); netid=0; mark=0
05-31 18:49:12.912 17875-18283/com.gimbal.android.sample D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
05-31 18:49:13.243 17875-18283/com.gimbal.android.sample E/NativeCrypto: ssl=0x7f91ea8700 cert_verify_callback x509_store_ctx=0x7f91939370 arg=0x0
05-31 18:49:13.243 17875-18283/com.gimbal.android.sample E/NativeCrypto: ssl=0x7f91ea8700 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA