Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2024-04-10 16:09:08 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
be02b90cb47ec9be2a305329a2cebfbaccf40fa0
be02b90c
1 parent
d0ed2a61
new targetSDK version, cancel coupon fixes, crash fix for startForeground, coupon terms fix
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
162 additions
and
70 deletions
.idea/deploymentTargetDropDown.xml
app/build.gradle
warply_android_sdk/build.gradle
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveUnifiedCouponsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
.idea/deploymentTargetDropDown.xml
View file @
be02b90
...
...
@@ -3,7 +3,20 @@
<component
name=
"deploymentTargetDropDown"
>
<value>
<entry
key=
"app"
>
<State
/>
<State>
<targetSelectedWithDropDown>
<Target>
<type
value=
"QUICK_BOOT_TARGET"
/>
<deviceKey>
<Key>
<type
value=
"VIRTUAL_DEVICE_PATH"
/>
<value
value=
"$USER_HOME$/.android/avd/Pixel_7_v14.avd"
/>
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2024-04-10T09:29:35.626328Z"
/>
</State>
</entry>
</value>
</component>
...
...
app/build.gradle
View file @
be02b90
...
...
@@ -3,13 +3,13 @@ apply plugin: 'com.android.application'
//apply plugin: 'com.huawei.agconnect'
android
{
compileSdkVersion
3
1
buildToolsVersion
"3
1
.0.0"
compileSdkVersion
3
4
buildToolsVersion
"3
4
.0.0"
defaultConfig
{
applicationId
"warp.ly.android_sdk"
minSdkVersion
23
targetSdkVersion
3
1
targetSdkVersion
3
4
versionCode
100
versionName
"1.0.0"
}
...
...
warply_android_sdk/build.gradle
View file @
be02b90
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.5.4r
19
'
PUBLISH_VERSION
=
'4.5.5.4r
20
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
@@ -10,14 +10,14 @@ apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
android
{
compileSdkVersion
3
1
buildToolsVersion
"3
1
.0.0"
compileSdkVersion
3
4
buildToolsVersion
"3
4
.0.0"
useLibrary
'org.apache.http.legacy'
defaultConfig
{
minSdkVersion
23
targetSdkVersion
3
1
targetSdkVersion
3
4
consumerProguardFiles
'proguard-rules.pro'
vectorDrawables
.
useSupportLibrary
=
true
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
be02b90
...
...
@@ -12,8 +12,10 @@
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
tools:node=
"remove"
/>
<uses-permission
android:name=
"com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<uses-permission
android:name=
"com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE_HEALTH"
/>
<uses-permission
android:name=
"android.permission.HIGH_SAMPLING_RATE_SENSORS"
/>
<application
android:largeHeap=
"true"
>
<!-- <meta-data-->
...
...
@@ -77,24 +79,24 @@
android:screenOrientation=
"portrait"
android:theme=
"@style/SDKAppTheme"
/>
<!-- android:screenOrientation="portrait"-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- android:screenOrientation="portrait"-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsHistoryActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.TelematicsMetricsActivity"-->
<!-- android:exported="false"-->
<!-- android:configChanges="orientation|screenSize"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name=
"ly.warp.sdk.activities.GiftsForYouActivity"
...
...
@@ -114,11 +116,11 @@
android:screenOrientation=
"portrait"
android:theme=
"@style/SDKAppTheme"
/>
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.LoyaltyWallet"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<!-- <activity-->
<!-- android:name="ly.warp.sdk.activities.LoyaltyWallet"-->
<!-- android:exported="false"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/SDKAppTheme" />-->
<activity
android:name=
"ly.warp.sdk.activities.ActiveGiftsActivity"
...
...
@@ -230,11 +232,12 @@
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<service
android:name=
"ly.warp.sdk.services.WarplyHealthService"
android:exported=
"false"
android:foregroundServiceType=
"health"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
...
...
@@ -268,14 +271,14 @@
android:name=
"ly.warp.sdk.receivers.LocationChangedReceiver"
android:exported=
"false"
/>
<!-- <receiver-->
<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name="ly.warp.sdk.receivers.ConnectivityChangedReceiver"-->
<!-- android:exported="false">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<receiver
android:name=
"ly.warp.sdk.receivers.BluetoothStateChangeReceiver"
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveUnifiedCouponsActivity.java
View file @
be02b90
...
...
@@ -4,13 +4,19 @@ import android.app.Activity;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
java.io.Serializable
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -20,9 +26,12 @@ import java.util.Date;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.UnifiedCoupon
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
ly.warp.sdk.views.adapters.MarketCouponAdapter
;
...
...
@@ -67,6 +76,32 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
}
@Override
public
void
onStart
()
{
super
.
onStart
();
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
EventBus
.
getDefault
().
register
(
this
);
}
@Override
public
void
onStop
()
{
super
.
onStop
();
// EventBus.getDefault().unregister(this);
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
EventBus
.
getDefault
().
unregister
(
this
);
}
@Subscribe
()
public
void
onMessageEvent
(
WarplyEventBusManager
event
)
{
if
(
event
.
getRefreshUnifiedCouponsAdded
()
!=
null
)
{
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
}
}
@Override
public
void
onClick
(
View
view
)
{
if
(
view
.
getId
()
==
R
.
id
.
iv_coupons_close
)
{
onBackPressed
();
...
...
@@ -130,4 +165,16 @@ public class ActiveUnifiedCouponsActivity extends Activity implements View.OnCli
// Inner and Anonymous Classes
// ===========================================================
private
final
CallbackReceiver
<
ArrayList
<
UnifiedCoupon
>>
mUnifiedCallback
=
new
CallbackReceiver
<
ArrayList
<
UnifiedCoupon
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
UnifiedCoupon
>
result
)
{
Handler
mUIHandler
=
new
Handler
(
Looper
.
getMainLooper
());
mUIHandler
.
post
(
ActiveUnifiedCouponsActivity
.
this
::
filterItems
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponInfoActivity.java
View file @
be02b90
...
...
@@ -269,7 +269,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener
}
else
{
mTvCouponSubtitle
.
setText
(
mCoupon
.
getCouponsetDetails
().
getShortDescription
());
}
mTvTermsValue
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
getTerms
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvTermsValue
.
setText
(
HtmlCompat
.
fromHtml
(
mCoupon
.
get
CouponsetDetails
().
get
Terms
(),
HtmlCompat
.
FROM_HTML_MODE_COMPACT
));
mTvTermsValue
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
}
else
{
if
(
mCoupon
.
getMerchantDetails
()
!=
null
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
be02b90
package
ly
.
warp
.
sdk
.
services
;
import
android.app.AlarmManager
;
import
android.app.Notification
;
import
android.app.NotificationChannel
;
import
android.app.NotificationManager
;
...
...
@@ -9,16 +8,15 @@ import android.app.Service;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ServiceInfo
;
import
android.hardware.Sensor
;
import
android.hardware.SensorEvent
;
import
android.hardware.SensorEventListener
;
import
android.hardware.SensorManager
;
import
android.os.Build
;
import
android.os.IBinder
;
import
android.os.SystemClock
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.core.app.NotificationCompat
;
import
org.greenrobot.eventbus.EventBus
;
...
...
@@ -112,7 +110,14 @@ public class WarplyHealthService extends Service implements SensorEventListener
b
.
setOngoing
(
true
);
// b.setCategory(Notification.CATEGORY_SERVICE);
b
.
setSmallIcon
(
R
.
drawable
.
ic_launcher
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
&&
notificationManager
!=
null
)
{
if
(
notificationManager
!=
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
UPSIDE_DOWN_CAKE
)
{
NotificationChannel
notificationChannel
=
new
NotificationChannel
(
STEPS_CHANNEL_ID
,
"steps_notification_channel"
,
NotificationManager
.
IMPORTANCE_DEFAULT
);
notificationManager
.
createNotificationChannel
(
notificationChannel
);
Notification
notification_build
=
b
.
setChannelId
(
STEPS_CHANNEL_ID
).
build
();
this
.
startForeground
(
2001
,
notification_build
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_HEALTH
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
NotificationChannel
notificationChannel
=
new
NotificationChannel
(
STEPS_CHANNEL_ID
,
"steps_notification_channel"
,
NotificationManager
.
IMPORTANCE_DEFAULT
);
notificationManager
.
createNotificationChannel
(
notificationChannel
);
Notification
notification_build
=
b
.
setChannelId
(
STEPS_CHANNEL_ID
).
build
();
...
...
@@ -121,6 +126,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
Notification
notification_build
=
b
.
build
();
this
.
startForeground
(
2001
,
notification_build
);
}
}
new
Thread
(
()
->
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
be02b90
...
...
@@ -985,11 +985,17 @@ public class WarplyManager {
if
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
AlarmManager
mgr
=
(
AlarmManager
)
Warply
.
getWarplyContext
().
getSystemService
(
Context
.
ALARM_SERVICE
);
PendingIntent
pi
=
PendingIntent
.
getService
(
Warply
.
getWarplyContext
(),
2002
,
stepsServiceIntent
,
PendingIntent
.
FLAG_ONE_SHOT
|
PendingIntent
.
FLAG_MUTABLE
);
mgr
.
set
(
AlarmManager
.
ELAPSED_REALTIME_WAKEUP
,
SystemClock
.
elapsedRealtime
()
+
1000
,
pi
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE);
// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
// } else {
// Warply.getWarplyContext().startService(stepsServiceIntent);
// }
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Warply
.
getWarplyContext
().
startForegroundService
(
stepsServiceIntent
);
}
else
{
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
...
...
@@ -1123,11 +1129,17 @@ public class WarplyManager {
if
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
AlarmManager
mgr
=
(
AlarmManager
)
Warply
.
getWarplyContext
().
getSystemService
(
Context
.
ALARM_SERVICE
);
PendingIntent
pi
=
PendingIntent
.
getService
(
Warply
.
getWarplyContext
(),
2002
,
stepsServiceIntent
,
PendingIntent
.
FLAG_ONE_SHOT
|
PendingIntent
.
FLAG_IMMUTABLE
);
mgr
.
set
(
AlarmManager
.
ELAPSED_REALTIME_WAKEUP
,
SystemClock
.
elapsedRealtime
()
+
1000
,
pi
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
// } else {
// Warply.getWarplyContext().startService(stepsServiceIntent);
// }
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Warply
.
getWarplyContext
().
startForegroundService
(
stepsServiceIntent
);
}
else
{
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
...
...
@@ -1243,11 +1255,17 @@ public class WarplyManager {
if
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
AlarmManager
mgr
=
(
AlarmManager
)
Warply
.
getWarplyContext
().
getSystemService
(
Context
.
ALARM_SERVICE
);
PendingIntent
pi
=
PendingIntent
.
getService
(
Warply
.
getWarplyContext
(),
2002
,
stepsServiceIntent
,
PendingIntent
.
FLAG_ONE_SHOT
|
PendingIntent
.
FLAG_IMMUTABLE
);
mgr
.
set
(
AlarmManager
.
ELAPSED_REALTIME_WAKEUP
,
SystemClock
.
elapsedRealtime
()
+
1000
,
pi
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
// } else {
// Warply.getWarplyContext().startService(stepsServiceIntent);
// }
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Warply
.
getWarplyContext
().
startForegroundService
(
stepsServiceIntent
);
}
else
{
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
...
...
@@ -4854,11 +4872,17 @@ public class WarplyManager {
if
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
S
)
{
AlarmManager
mgr
=
(
AlarmManager
)
Warply
.
getWarplyContext
().
getSystemService
(
Context
.
ALARM_SERVICE
);
PendingIntent
pi
=
PendingIntent
.
getService
(
Warply
.
getWarplyContext
(),
2002
,
stepsServiceIntent
,
PendingIntent
.
FLAG_ONE_SHOT
|
PendingIntent
.
FLAG_MUTABLE
);
mgr
.
set
(
AlarmManager
.
ELAPSED_REALTIME_WAKEUP
,
SystemClock
.
elapsedRealtime
()
+
1000
,
pi
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE);
// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
// } else {
// Warply.getWarplyContext().startService(stepsServiceIntent);
// }
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Warply
.
getWarplyContext
().
startForegroundService
(
stepsServiceIntent
);
}
else
{
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
be02b90
...
...
@@ -182,7 +182,7 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
setFadingEdgeLength
(
0
);
WebSettings
settings
=
getSettings
();
settings
.
set
AppCacheEnabled
(
true
);
settings
.
set
CacheMode
(
WebSettings
.
LOAD_CACHE_ELSE_NETWORK
);
settings
.
setJavaScriptEnabled
(
true
);
settings
.
setDatabaseEnabled
(
true
);
settings
.
setDomStorageEnabled
(
true
);
...
...
@@ -552,7 +552,6 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
analyticsEvent
));
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
// Warply.getWarplyContext().startService(stepsServiceIntent);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Warply
.
getWarplyContext
().
startForegroundService
(
stepsServiceIntent
);
}
else
{
...
...
Please
register
or
login
to post a comment