-
Notifications
You must be signed in to change notification settings - Fork 763
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
Comments
Hi all, |
@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 |
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. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
The issue has been closed for inactivity. |
@Winglonelion Do you have any updates on this? |
Hello,
It seems that this library can't be built for Android without Play Services:
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.)The text was updated successfully, but these errors were encountered: