Skip to content

Commit cacbe26

Browse files
author
Kislay
committed
Update SDK to 3.30
1 parent 1fb6f7e commit cacbe26

File tree

6 files changed

+32
-25
lines changed

6 files changed

+32
-25
lines changed

README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ Beaconstac Advanced Android SDK is meant only for specialized use cases. Please
99
### In the `build.gradle` file of the app, add the following in the dependencies section:
1010
```groovy
1111
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
12-
compile 'com.mobstac.beaconstac:proximity:3.*'
12+
implementation 'com.mobstac.beaconstac:proximity:3.3+'
1313
```
14+
15+
If you want to receive background updates as shown in the sample app [here](examples/BeaconstacExample/app/src/main/java/com/mobstac/beaconstacdemo/NearbyBeaconBroadcastReceiver.java), add this to your app gradle
16+
```groovy
17+
implementation 'com.google.android.gms:play-services-nearby:16.0.0'
18+
```
19+
20+
1421
Latest version
15-
[ ![Download](https://api.bintray.com/packages/mobstac/maven/proximity/images/download.svg) ](https://bintray.com/mobstac/maven/proximity/_latestVersion)
22+
23+
[ ![Download](https://api.bintray.com/packages/mobstac/maven/proximity/images/download.svg) ](https://bintray.com/mobstac/maven/proximity/_latestVersion)
1624

1725
## Permissions
1826

@@ -94,7 +102,7 @@ Beaconstac beaconstac = Beaconstac.getInstance(getApplicationContext());
94102
#### 3. Start scan
95103

96104
```java
97-
Beaconstac.getInstance(getApplicationContext()).startScanningBeacons(new MSErrorListener() {
105+
Beaconstac.getInstance(getApplicationContext()).startScanningBeacons(getApplicationContext(), new MSErrorListener() {
98106
@Override
99107
public void onError(MSException msException) {
100108

@@ -103,7 +111,7 @@ Beaconstac.getInstance(getApplicationContext()).startScanningBeacons(new MSError
103111
```
104112
__4. Stop scan__
105113
```java
106-
Beaconstac.getInstance(getApplicationContext()).stopScanningBeacons(new MSErrorListener() {
114+
Beaconstac.getInstance(getApplicationContext()).stopScanningBeacons(getApplicationContext(), new MSErrorListener() {
107115
@Override
108116
public void onError(MSException msException) {
109117

@@ -163,12 +171,12 @@ Beaconstac.getInstance(getApplicationContext()).addValuesToWebhook(MY_KEY_VALUE_
163171

164172
__8. Set user's name__
165173
```java
166-
Beaconstac.getInstance(getApplicationContext()).setUserName(USER_FIRST_NAME , USER_LAST_NAME);
174+
Beaconstac.getInstance(getApplicationContext()).setUserName(getApplicationContext(), USER_FIRST_NAME , USER_LAST_NAME);
167175
```
168176

169177
__9. Set user's email__
170178
```java
171-
Beaconstac.getInstance(getApplicationContext()).setUserEmail(USER_EMAIL);
179+
Beaconstac.getInstance(getApplicationContext()).setUserEmail(getApplicationContext(), USER_EMAIL);
172180
```
173181

174182
__10. Set scan power mode__
@@ -234,7 +242,7 @@ public class MyBroadcastReceiver extends BroadcastReceiver {
234242
__1. Subscribe for updates__
235243

236244
```java
237-
Beaconstac.getInstance(getApplicationContext()).subscribeForBackgroundUpdates(new MyBroadcastReceiver());
245+
Beaconstac.getInstance(getApplicationContext()).subscribeForBackgroundUpdates(getApplicationContext(), new MyBroadcastReceiver());
238246
```
239247

240248
Once a callback is received by the receiver you can choose to start scanning for beacons using the Beaconstac SDK and once done you *must* stop the scan. Please refer to the example receiver [here](https://github.com/Beaconstac/Android-SDK/blob/master/examples/BeaconstacExample/app/src/main/java/com/mobstac/beaconstacdemo/NearbyBeaconBroadcastReceiver.java).
@@ -245,7 +253,7 @@ Once a callback is received by the receiver you can choose to start scanning for
245253
__2. Unsubscribe from updates__
246254

247255
```java
248-
Beaconstac.getInstance(getApplicationContext()).unSubscribeFromBackgroundUpdates(new MyBroadcastReceiver());
256+
Beaconstac.getInstance(getApplicationContext()).unSubscribeFromBackgroundUpdates(getApplicationContext(), new MyBroadcastReceiver());
249257
```
250258

251259
__Due to the restriction added on Android 8 and above on running background tasks, a persistent notification will be shown when the SDK is running in the background. Please see [this](https://developer.android.com/about/versions/oreo/background) for more details.__

examples/BeaconstacExample/app/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ android {
2020
}
2121

2222
dependencies {
23-
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
24-
compile fileTree(dir: 'libs', include: ['*.jar'])
25-
compile 'com.android.support:appcompat-v7:28.0.0'
26-
compile 'com.android.support:design:28.0.0'
27-
compile 'com.mobstac.beaconstac:proximity:3.18'
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation 'com.android.support:appcompat-v7:28.0.0'
25+
implementation 'com.android.support:design:28.0.0'
26+
implementation 'com.mobstac.beaconstac:proximity:3.30'
27+
implementation 'com.google.android.gms:play-services-nearby:16.0.0'
2828
}

examples/BeaconstacExample/app/src/main/java/com/mobstac/beaconstacdemo/MainActivity.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ public void onError(MSException e) {
9292
}
9393
if (beaconstac != null) {
9494
beaconstac.setBeaconScannerCallbacks(beaconScannerCallbacks);
95-
beaconstac.subscribeForBackgroundUpdates(new NearbyBeaconBroadcastReceiver());
95+
beaconstac.subscribeForBackgroundUpdates(this, new NearbyBeaconBroadcastReceiver());
9696
}
9797
}
9898
}
9999

100100
private boolean checkPermission() {
101101
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED ||
102102
ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
103-
) {
103+
) {
104104
ActivityCompat.requestPermissions(this,
105105
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
106106
MSConstants.REQUEST_LOCATION_PERMISSION);
@@ -128,7 +128,7 @@ protected void onResume() {
128128
@Override
129129
public void onDestroy() {
130130
super.onDestroy();
131-
beaconstac.stopScanningBeacons(new MSErrorListener() {
131+
beaconstac.stopScanningBeacons(this, new MSErrorListener() {
132132
@Override
133133
public void onError(MSException msException) {
134134

examples/BeaconstacExample/app/src/main/java/com/mobstac/beaconstacdemo/NearbyBeaconBroadcastReceiver.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.content.pm.PackageManager;
88
import android.os.Handler;
99
import android.support.v4.app.ActivityCompat;
10-
import android.util.Log;
1110

1211
import com.google.android.gms.nearby.Nearby;
1312
import com.google.android.gms.nearby.messages.Message;
@@ -35,7 +34,7 @@ public void onFound(Message message) {
3534
beaconstac = Beaconstac.initialize(context.getApplicationContext(), "MY_DEVELOPER_TOKEN", new MSSyncListener() {
3635
@Override
3736
public void onSuccess() {
38-
beaconstac.startScanningBeacons(new MSErrorListener() {
37+
beaconstac.startScanningBeacons(context, new MSErrorListener() {
3938
@Override
4039
public void onError(MSException msException) {
4140

@@ -61,13 +60,13 @@ public void onLost(Message message) {
6160
}
6261
}
6362

64-
private void autoStopScan(final Context context, int duration){
63+
private void autoStopScan(final Context context, int duration) {
6564
if (beaconstac != null) {
6665
Handler handler = new Handler();
6766
handler.postDelayed(new Runnable() {
6867
@Override
6968
public void run() {
70-
beaconstac.stopScanningBeacons(new MSErrorListener() {
69+
beaconstac.stopScanningBeacons(context, new MSErrorListener() {
7170
@Override
7271
public void onError(MSException msException) {
7372

@@ -88,7 +87,7 @@ public void run() {
8887
beaconstac = Beaconstac.initialize(context.getApplicationContext(), "MY_DEVELOPER_TOKEN", new MSSyncListener() {
8988
@Override
9089
public void onSuccess() {
91-
beaconstac.stopScanningBeacons(new MSErrorListener() {
90+
beaconstac.stopScanningBeacons(context, new MSErrorListener() {
9291
@Override
9392
public void onError(MSException msException) {
9493

@@ -99,7 +98,7 @@ public void onError(MSException msException) {
9998
@Override
10099
public void onFailure(MSException msException) {
101100
// Stop scan even if initialization failed
102-
beaconstac.stopScanningBeacons(new MSErrorListener() {
101+
beaconstac.stopScanningBeacons(context, new MSErrorListener() {
103102
@Override
104103
public void onError(MSException msException) {
105104

examples/BeaconstacExample/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.0.1'
9+
classpath 'com.android.tools.build:gradle:3.4.1'
1010

1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Dec 14 19:00:17 IST 2017
1+
#Thu Jun 13 17:08:57 IST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0 commit comments

Comments
 (0)