-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0acd415
commit 7548efe
Showing
6 changed files
with
183 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.roam.cordova"> | ||
|
||
<application> | ||
<receiver | ||
android:name="com.roam.cordova.CDVRoam$RoamCordovaReceiver" | ||
android:enabled="true" | ||
android:exported="false"> | ||
<intent-filter> | ||
<action android:name="com.roam.android.RECEIVED" /> | ||
</intent-filter> | ||
</receiver> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/android/src/main/java/com/roam/cordova/RoamCDVService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.roam.cordova; | ||
|
||
import android.app.Notification; | ||
import android.app.NotificationChannel; | ||
import android.app.NotificationManager; | ||
import android.app.PendingIntent; | ||
import android.app.Service; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.IntentFilter; | ||
import android.os.Build; | ||
import android.os.IBinder; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.annotation.RequiresApi; | ||
|
||
public class RoamCDVService extends Service { | ||
|
||
private CDVRoam.RoamCordovaReceiver roamCordovaReceiver; | ||
|
||
@Nullable | ||
@Override | ||
public IBinder onBind(Intent intent) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
register(); | ||
} | ||
|
||
private void register() { | ||
roamCordovaReceiver = new CDVRoam.RoamCordovaReceiver(); | ||
IntentFilter intentFilter = new IntentFilter(); | ||
intentFilter.addAction("com.roam.android.RECEIVED"); | ||
registerReceiver(roamCordovaReceiver, intentFilter); | ||
} | ||
|
||
@Override | ||
public int onStartCommand(Intent intent, int flags, int startId) { | ||
return START_STICKY; | ||
} | ||
|
||
private void unRegister() { | ||
if (roamCordovaReceiver != null) { | ||
unregisterReceiver(roamCordovaReceiver); | ||
} | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
unRegister(); | ||
super.onDestroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.