Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SmartCloudAppNotificationService
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baijinqiu
SmartCloudAppNotificationService
Commits
b7f32853
Commit
b7f32853
authored
May 18, 2020
by
baijinqiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
dec8ab5b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
27 deletions
+67
-27
.idea/workspace.xml
+10
-2
plugin.xml
+12
-9
src/android/ONService.java
+4
-16
src/android/onservice/HandleService.java
+41
-0
src/android/onservice/NotificationService.java
+0
-0
No files found.
.idea/workspace.xml
View file @
b7f32853
...
...
@@ -2,7 +2,10 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"2e775c3f-ff13-4f54-ba20-3e0eeadc9822"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/package.json"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/package.json"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/plugin.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/plugin.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/android/ONService.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/android/ONService.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/src/android/onservice/NotificationService.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/src/android/onservice/NotificationService.java"
afterDir=
"false"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
...
@@ -49,6 +52,9 @@
<updated>
1589203043741
</updated>
<workItem
from=
"1589203044907"
duration=
"4164000"
/>
<workItem
from=
"1589246330563"
duration=
"5727000"
/>
<workItem
from=
"1589419123592"
duration=
"528000"
/>
<workItem
from=
"1589530335696"
duration=
"615000"
/>
<workItem
from=
"1589766857083"
duration=
"2925000"
/>
</task>
<servers
/>
</component>
...
...
@@ -60,7 +66,9 @@
<map>
<entry
key=
"MAIN"
>
<value>
<State
/>
<State>
<option
name=
"COLUMN_ORDER"
/>
</State>
</value>
</entry>
</map>
...
...
plugin.xml
View file @
b7f32853
<?xml version='1.0' encoding='utf-8'?>
<plugin
id=
"cordova-plugin-ONService"
version=
"1.0.0"
xmlns=
"http://apache.org/cordova/ns/plugins/1.0"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<plugin
id=
"cordova-plugin-ONService"
version=
"1.0.0"
xmlns=
"http://apache.org/cordova/ns/plugins/1.0"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<name>
ONService
</name>
<js-module
name=
"ONService"
src=
"www/ONService.js"
>
<clobbers
target=
"cordova.plugins.ONService"
/>
...
...
@@ -9,6 +10,7 @@
<config-file
parent=
"/*"
target=
"res/xml/config.xml"
>
<feature
name=
"ONService"
>
<param
name=
"android-package"
value=
"com.orhon.notification.ONService"
/>
<param
name=
"onload"
value=
"true"
/>
</feature>
</config-file>
<config-file
parent=
"/*"
target=
"AndroidManifest.xml"
>
...
...
@@ -17,20 +19,21 @@
</config-file>
<config-file
parent=
"/manifest/application"
target=
"AndroidManifest.xml"
>
<service
android:name=
"com.orhon.notification.onservice.NotificationService"
android:enabled=
"true"
android:exported=
"true"
>
<intent-filter
android:priority=
"1000"
>
<service
android:name=
"com.orhon.notification.onservice.NotificationService"
android:enabled=
"true"
android:exported=
"true"
>
<intent-filter
android:priority=
"1000"
>
<action
android:name=
"notificationTest"
/>
</intent-filter>
</service>
</config-file>
<source-file
src=
"src/android/ONService.java"
target-dir=
"src/com/orhon/notification/"
/>
<source-file
src=
"src/android/onservice/NotificationService.java"
target-dir=
"src/com/orhon/notification/onservice"
/>
<source-file
src=
"src/android/onservice/NotificationService.java"
target-dir=
"src/com/orhon/notification/onservice"
/>
<source-file
src=
"src/android/onservice/HandleService.java"
target-dir=
"src/com/orhon/notification/onservice"
/>
<framework
src=
"com.android.support:support-annotations:27.+"
></framework>
<framework
src=
"com.squareup.okhttp3:okhttp:4.6.0"
></framework>
<framework
src=
"com.squareup.okhttp3:mockwebserver:4.6.0"
></framework>
<framework
src=
"com.google.code.gson:gson:2.8.6"
></framework>
</platform>
</plugin>
src/android/ONService.java
View file @
b7f32853
package
com
.
orhon
.
notification
;
import
android.app.Notification
;
import
android.app.NotificationChannel
;
import
android.app.NotificationManager
;
import
android.app.PendingIntent
;
import
android.app.Service
;
import
android.content.ComponentName
;
import
android.content.Intent
;
import
android.content.ServiceConnection
;
import
android.graphics.Color
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.IBinder
;
//import android.support.annotation.RequiresApi;
import
android.util.Log
;
import
com.orhon.notification.onservice.NotificationService
;
import
org.apache.cordova.CordovaPlugin
;
import
org.apache.cordova.CallbackContext
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
// import io.cordova.hellocordova.R;
import
static
android
.
content
.
Context
.
NOTIFICATION_SERVICE
;
/**
* This class echoes a string called from JavaScript.
*/
...
...
@@ -37,9 +23,10 @@ public class ONService extends CordovaPlugin {
private
ServiceConnection
connection
=
new
ServiceConnection
()
{
@Override
public
void
onServiceConnected
(
ComponentName
componentName
,
IBinder
iBinder
)
{
myBinder
=
(
NotificationService
.
MyBinder
)
iBinder
;
NotificationService
.
webView
=
webView
;
NotificationService
.
cordovaPlugin
=
cordova
;
myBinder
=
(
NotificationService
.
MyBinder
)
iBinder
;
}
@Override
...
...
@@ -72,6 +59,7 @@ public class ONService extends CordovaPlugin {
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
// webView.loadUrl("http://localhost/tabs/tab3");
cordova
.
getActivity
().
startService
(
intent
);
cordova
.
getActivity
().
bindService
(
intent
,
...
...
src/android/onservice/HandleService.java
0 → 100644
View file @
b7f32853
package
com
.
orhon
.
notification
.
onservice
;
import
android.app.IntentService
;
import
android.content.Intent
;
import
android.support.annotation.Nullable
;
import
android.util.Log
;
import
io.ionic.starter.MainActivity
;
public
class
HandleService
extends
IntentService
{
private
static
final
String
TAG
=
"HandleService"
;
public
HandleService
()
{
super
(
""
);
}
public
HandleService
(
String
name
)
{
super
(
name
);
}
@Override
protected
void
onHandleIntent
(
@Nullable
Intent
intent
)
{
Log
.
e
(
TAG
,
"onHandleIntent: id "
+
intent
.
getStringExtra
(
"id"
));
Log
.
e
(
TAG
,
"onHandleIntent: url "
+
intent
.
getStringExtra
(
"url"
));
NotificationService
.
webView
.
loadUrl
(
intent
.
getStringExtra
(
"url"
));
}
@Override
public
int
onStartCommand
(
@Nullable
Intent
intent
,
int
flags
,
int
startId
)
{
NotificationService
.
cordovaPlugin
.
getActivity
().
startActivity
(
new
Intent
(
NotificationService
.
cordovaPlugin
.
getContext
(),
MainActivity
.
class
));
Log
.
e
(
TAG
,
"onStartCommand: id "
+
intent
.
getStringExtra
(
"id"
));
Log
.
e
(
TAG
,
"onStartCommand: url "
+
intent
.
getStringExtra
(
"url"
));
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
Log
.
e
(
TAG
,
"onDestroy: "
);
}
}
src/android/onservice/NotificationService.java
View file @
b7f32853
This diff is collapsed.
Click to expand it.
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