Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building without Play Services? #207

Closed
Rudloff opened this issue Apr 19, 2018 · 6 comments
Closed

Building without Play Services? #207

Rudloff opened this issue Apr 19, 2018 · 6 comments

Comments

@Rudloff
Copy link

Rudloff commented Apr 19, 2018

Hello,

It seems that this library can't be built for Android without Play Services:

   > A problem occurred configuring project ':reactnativenotifications'.
      > You have not accepted the license agreements of the following SDK components:
        [Google Repository].

The Play Services dependency prevents any app using this library from being included in free software repositories like F-Droid.

Would it be possible to have an option to build without the play-services-gcm dependency? (Even if it means that only local notifications would work.)

@hotlittlewhitedog
Copy link

Hi all,
Why is used Play Service for notifications?!

@Rudloff
Copy link
Author

Rudloff commented May 6, 2018

@hotlittlewhitedog Play services are used for push notifications (through Google Cloud Messaging).

This is how I removed the GCM parts of the code:

diff --git a/android/build.gradle b/android/build.gradle
index 6f05c1b..9ac2e76 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -20,7 +20,6 @@ android {
 
 dependencies {
     // Google's GCM.
-    compile 'com.google.android.gms:play-services-gcm:10.0.1'
 
     compile 'com.facebook.react:react-native:+'
 
diff --git a/android/src/main/java/com/wix/reactnativenotifications/RNNotificationsModule.java b/android/src/main/java/com/wix/reactnativenotifications/RNNotificationsModule.java
index 33a13bf..7ce306c 100644
--- a/android/src/main/java/com/wix/reactnativenotifications/RNNotificationsModule.java
+++ b/android/src/main/java/com/wix/reactnativenotifications/RNNotificationsModule.java
@@ -23,7 +23,6 @@ import com.wix.reactnativenotifications.core.notification.PushNotification;
 import com.wix.reactnativenotifications.core.notification.PushNotificationProps;
 import com.wix.reactnativenotifications.core.notificationdrawer.IPushNotificationsDrawer;
 import com.wix.reactnativenotifications.core.notificationdrawer.PushNotificationsDrawer;
-import com.wix.reactnativenotifications.gcm.GcmInstanceIdRefreshHandlerService;
 
 import static com.wix.reactnativenotifications.Defs.LOGTAG;
 
@@ -47,7 +46,6 @@ public class RNNotificationsModule extends ReactContextBaseJavaModule implements
     @Override
     public void initialize() {
         Log.d(LOGTAG, "Native module init");
-        startGcmIntentService(GcmInstanceIdRefreshHandlerService.EXTRA_IS_APP_INIT);
 
         final IPushNotificationsDrawer notificationsDrawer = PushNotificationsDrawer.get(getReactApplicationContext().getApplicationContext());
         notificationsDrawer.onAppInit();
@@ -56,7 +54,6 @@ public class RNNotificationsModule extends ReactContextBaseJavaModule implements
     @ReactMethod
     public void refreshToken() {
         Log.d(LOGTAG, "Native method invocation: refreshToken()");
-        startGcmIntentService(GcmInstanceIdRefreshHandlerService.EXTRA_MANUAL_REFRESH);
     }
 
     @ReactMethod
@@ -92,8 +89,6 @@ public class RNNotificationsModule extends ReactContextBaseJavaModule implements
 
     @ReactMethod
     public void isRegisteredForRemoteNotifications(Promise promise) {
-        boolean hasPermission = NotificationManagerCompat.from(getReactApplicationContext()).areNotificationsEnabled();
-        promise.resolve(new Boolean(hasPermission));
     }
 
     @Override
@@ -138,8 +133,5 @@ public class RNNotificationsModule extends ReactContextBaseJavaModule implements
 
     protected void startGcmIntentService(String extraFlag) {
         final Context appContext = getReactApplicationContext().getApplicationContext();
-        final Intent tokenFetchIntent = new Intent(appContext, GcmInstanceIdRefreshHandlerService.class);
-        tokenFetchIntent.putExtra(extraFlag, true);
-        appContext.startService(tokenFetchIntent);
     }
 }
diff --git a/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmInstanceIdListenerService.java b/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmInstanceIdListenerService.java
deleted file mode 100644
index 933415f..0000000
diff --git a/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmInstanceIdRefreshHandlerService.java b/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmInstanceIdRefreshHandlerService.java
deleted file mode 100644
index 3aa7aa9..0000000
diff --git a/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmMessageHandlerService.java b/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmMessageHandlerService.java
deleted file mode 100644
index f596655..0000000
diff --git a/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmToken.java b/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmToken.java
deleted file mode 100644
index b11a6b5..0000000
diff --git a/android/src/main/java/com/wix/reactnativenotifications/gcm/IGcmToken.java b/android/src/main/java/com/wix/reactnativenotifications/gcm/IGcmToken.java
deleted file mode 100644
index f324a59..0000000
diff --git a/android/src/main/java/com/wix/reactnativenotifications/gcm/INotificationsGcmApplication.java b/android/src/main/java/com/wix/reactnativenotifications/gcm/INotificationsGcmApplication.java
deleted file mode 100644
index 36f59f7..0000000

@Winglonelion
Copy link

Push notification feature does not necessary with our application. Thus, i planning to remove it from my Fork. Maybe it will complete on last week.

@stale
Copy link

stale bot commented Jul 24, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

@stale stale bot added the 🏚 stale label Jul 24, 2019
@stale
Copy link

stale bot commented Aug 1, 2019

The issue has been closed for inactivity.

@stale stale bot closed this as completed Aug 1, 2019
@jnnkB
Copy link

jnnkB commented Mar 20, 2021

@Winglonelion Do you have any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants