Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
location share white
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
location share white
Commits
74cb6b65
Commit
74cb6b65
authored
Nov 26, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...始终允许通知
parent
3a863c64
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
64 additions
and
12 deletions
+64
-12
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+4
-3
NotificationUiUtil.kt
...ava/com/base/locationsharewhite/fcm/NotificationUiUtil.kt
+13
-1
StayJobService.kt
...ava/com/base/locationsharewhite/service/StayJobService.kt
+1
-1
StayNotification.kt
...a/com/base/locationsharewhite/service/StayNotification.kt
+2
-0
MainActivity.kt
.../java/com/base/locationsharewhite/ui/main/MainActivity.kt
+6
-1
PermissionUtils.kt
...java/com/base/locationsharewhite/utils/PermissionUtils.kt
+0
-3
notification_style_1.xml
app/src/main/res/layout/notification_style_1.xml
+5
-3
notification_style_2.xml
app/src/main/res/layout/notification_style_2.xml
+31
-0
strings.xml
app/src/main/res/values/strings.xml
+2
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
74cb6b65
...
...
@@ -2,7 +2,8 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 大致位置,依赖网络 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 大致位置,依赖网络 -->
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<!-- 精确的位置,GPS -->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
...
...
@@ -17,7 +18,7 @@
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE_
DATA_SYNC
"
/>
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE_
LOCATION
"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
...
...
@@ -127,7 +128,7 @@
<service
android:name=
".service.StayJobService"
android:exported=
"false"
android:foregroundServiceType=
"
dataSync
"
android:foregroundServiceType=
"
location
"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<receiver
...
...
app/src/main/java/com/base/locationsharewhite/fcm/NotificationUiUtil.kt
View file @
74cb6b65
...
...
@@ -34,6 +34,7 @@ import com.base.locationsharewhite.fcm.PopupConstObject.popup_status
import
com.base.locationsharewhite.fcm.PopupConstObject.popup_timer_interval
import
com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.ui.main.MainActivity
import
com.base.locationsharewhite.ui.splash.SplashActivity
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
...
...
@@ -313,6 +314,7 @@ object NotificationUiUtil {
intent
:
Intent
,
bigRemoteViews
:
RemoteViews
,
smallRemoteViews
:
RemoteViews
,
notificationId
:
Int
=
NOTIFICATION_ID
)
{
val
notificationManager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
...
...
@@ -366,7 +368,7 @@ object NotificationUiUtil {
// 设置大视图
builder
.
setCustomBigContentView
(
bigRemoteViews
)
notificationManager
.
notify
(
NOTIFICATION_ID
,
builder
.
build
())
notificationManager
.
notify
(
notificationId
,
builder
.
build
())
}
val
looper_actionId
=
listOf
(
...
...
@@ -391,4 +393,14 @@ object NotificationUiUtil {
}
return
next
}
fun
sendAllAllowedNotification
(
context
:
Context
)
{
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
notification_style_2
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
appContext
.
packageName
,
R
.
layout
.
notification_style_2
)
val
intent
=
Intent
(
context
,
MainActivity
::
class
.
java
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
,
1999
)
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/service/StayJobService.kt
View file @
74cb6b65
...
...
@@ -71,7 +71,7 @@ class StayJobService : JobService() {
startForeground
(
NOTIFICATION_PERMANENT_ID
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_
DATA_SYNC
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_
LOCATION
)
}
else
{
startForeground
(
NOTIFICATION_PERMANENT_ID
,
notification
)
...
...
app/src/main/java/com/base/locationsharewhite/service/StayNotification.kt
View file @
74cb6b65
...
...
@@ -129,4 +129,6 @@ object StayNotification {
}
return
builder
.
build
()
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/ui/main/MainActivity.kt
View file @
74cb6b65
...
...
@@ -12,6 +12,7 @@ import androidx.lifecycle.lifecycleScope
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.databinding.ActivityMainBinding
import
com.base.locationsharewhite.fcm.NotificationUiUtil.sendAllAllowedNotification
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.location.LocationLoginUtils
...
...
@@ -107,6 +108,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
showAllowAllTimeDialog
()
isRunning
=
true
}
...
...
@@ -118,7 +120,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
allowAllTimeDialog
=
showLocationAllowAllTimeDialog
(
setAction
=
{
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{},
permissionAllowAction
=
{})
sendAllAllowedNotification
(
this
)
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{
LogEx
.
logDebug
(
TAG
,
"jumpOutAction"
)
},
permissionAllowAction
=
{})
},
dismissAction
=
{
allowAllTimeDialog
=
null
...
...
app/src/main/java/com/base/locationsharewhite/utils/PermissionUtils.kt
View file @
74cb6b65
...
...
@@ -11,9 +11,6 @@ import android.os.Environment
import
android.provider.Settings
import
androidx.core.app.ActivityCompat
import
com.base.locationsharewhite.utils.IntentUtils.intentAppDetailsSettings
import
com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocationPermissionDeniedByUser
import
com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermissionDeniedByUser
import
com.base.locationsharewhite.utils.ToastUtils.toast
object
PermissionUtils
{
...
...
app/src/main/res/layout/notification_style_1.xml
View file @
74cb6b65
...
...
@@ -2,7 +2,7 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"
80dp
"
android:layout_height=
"
wrap_content
"
android:background=
"@drawable/bg_ffffff_10"
android:paddingVertical=
"20dp"
>
...
...
@@ -25,11 +25,13 @@
android:id=
"@+id/tv_btn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"12dp"
android:layout_gravity=
"center_vertical"
android:layout_marginEnd=
"12dp"
android:background=
"@drawable/bg_5d7dee_18"
android:gravity=
"center"
android:includeFontPadding=
"false"
android:paddingHorizontal=
"30dp"
android:paddingVertical=
"
8
dp"
android:paddingVertical=
"
4
dp"
android:text=
"@string/view"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
...
...
app/src/main/res/layout/notification_style_2.xml
0 → 100644
View file @
74cb6b65
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/bg_ffffff_10"
android:orientation=
"vertical"
android:paddingVertical=
"20dp"
>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"16dp"
android:text=
"@string/phone_tracker"
android:textColor=
"#010101"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_desc"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginHorizontal=
"16dp"
android:layout_marginTop=
"2dp"
android:includeFontPadding=
"false"
android:maxLines=
"2"
android:text=
"@string/set_to_allow_all_the_time"
android:textSize=
"14sp"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
74cb6b65
...
...
@@ -76,4 +76,6 @@
<string
name=
"allow_all_the_time"
>
Allow all the time
</string>
<string
name=
"open_settings"
>
OPEN SETTINGS
</string>
<string
name=
"privacy_policy"
>
Privacy Policy
</string>
<string
name=
"set_to_allow_all_the_time"
>
Set to Allow all the time
</string>
<string
name=
"phone_tracker"
>
Phone Tracker
</string>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment