如何在Eclipse项目中使用Firebase云消息?

时间:2022-02-20 10:36:37

I have a project in eclipse. I need include firebase library. If I was using Android Studio the steps would simply be:

我有一个日食项目。我需要包含firebase库。如果我使用的是Android Studio,那么步骤就是:

如何在Eclipse项目中使用Firebase云消息?

And its all, all library include.

其全部,所有图书馆都包括在内。

But I cant understand how include firebase cloud message to eclipse. I cant find how include it to eclipse.

但我不明白如何将firebase云消息包含在eclipse中。我无法找到如何将它包含在日食中。

5 个解决方案

#1


9  

The new Firebase (9xx) libraries can be found in the Google Repository. You can install this with the Eclipse Android SDK Manager. Open the SDK manager and scroll down until you find Google Repository and install the package.

可以在Google Repository中找到新的Firebase(9xx)库。您可以使用Eclipse Android SDK Manager安装它。打开SDK管理器并向下滚动,直到找到Google Repository并安装该软件包。

The package will be installed in /extras/google/m2repository and you will find the Firebase files further down at /com/google/android/firebase.

该软件包将安装在/ extras / google / m2repository中,您将在/ com / google / android / firebase中找到Firebase文件。

You can rename the .aar files to .zip and extract the jar file, rename these from classes.jar and copy them to the project libs folder displayed in Eclipse (or copy outside Eclipse and then follow the instructions to import a project into Eclipse.)

您可以将.aar文件重命名为.zip并解压缩jar文件,从classes.jar重命名这些文件并将它们复制到Eclipse中显示的项目libs文件夹中(或者在Eclipse外部复制,然后按照说明将项目导入Eclipse。 )

#2


2  

There is a move towards Android Studio with Gradle. The Eclipse solution to Firebase CM is not forthcoming. My feeling is we will all have to move to AS with Gradle soon. There are good books on it and very simple instructions on Google dev sites. We might as well start learning the new IDE and migrate.

随着Gradle向Android Studio迈进。 Firebase CM的Eclipse解决方案即将推出。我的感觉是我们很快就要和Gradle一起搬到AS。有关于它的好书和Google开发网站上非常简单的说明。我们不妨开始学习新的IDE并进行迁移。

#3


2  

You can add this on your Android Manifest

您可以在Android Manifest上添加此项

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 
<receiver
            android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="YOUR PACKAGE NAME" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
            android:exported="false" />

And then you can get the token and try to send Message on.

然后你可以获得令牌并尝试发送消息。

Dont forget also to build FirebaseApps on your code (in my case on my MainActivity)

别忘了在代码上构建FirebaseApps(在我的MainActivity中也是如此)

FirebaseOptions options = new FirebaseOptions.Builder()
    .setApiKey("YOUR FIREBASE API KEY")
    .setApplicationId("YOUR FIREBASE APP ID")
    .setGcmSenderId("YOUR FIREBASE SENDER ID")
    .build();

FirebaseApp myApp = FirebaseApp.initializeApp(getApplicationContext(), options);
        token = FirebaseInstanceId.getInstance(myApp).getToken();

Hope it will get what you looking for on Eclipse.

希望它能在Eclipse上获得你想要的东西。

#4


1  

Old code is working no need to change code in firebase only change is in server code you have to use Web API Key from firebase project and Sender ID as per old code style. and you have to replace gcm url in web script - https://fcm.googleapis.com/fcm/send

旧代码无需更改firebase中的代码,只需更改服务器代码即可使用firebase项目中的Web API密钥和旧代码样式的发件人ID。并且你必须在web脚本中替换gcm url - https://fcm.googleapis.com/fcm/send

No Requirement of firebase library...

没有firebase库的要求......

#5


1  

Have a look at the resources below. In short, it's about including the Firebase libraries into your project (see the GitHub project and the two videos at the end) and manually performing the steps that the plugin does for you in Android Studio / Gradle.

看看下面的资源。简而言之,它是将Firebase库包含到您的项目中(请参阅GitHub项目和最后的两个视频),并在Android Studio / Gradle中手动执行插件为您执行的步骤。

  • Firebase libraries for Eclipse
    https://github.com/dandar3/android-google-firebase-README
  • 适用于Eclipse的Firebase库https://github.com/dandar3/android-google-firebase-README
  • Eclipse: Integrating Firebase Analytics into your Android app
    (same steps apply for other Firebase components, will write a post specifically for Cloud Messaging soon)
    http://dandar3.blogspot.com/2016/11/eclipse-integrate-firebase-analytics.html
  • Eclipse:将Firebase Analytics集成到您的Android应用程序中(适用于其他Firebase组件的相同步骤,将尽快编写专门针对云消息传递的帖子)http://dandar3.blogspot.com/2016/11/eclipse-integrate-firebase-analytics。 HTML

#1


9  

The new Firebase (9xx) libraries can be found in the Google Repository. You can install this with the Eclipse Android SDK Manager. Open the SDK manager and scroll down until you find Google Repository and install the package.

可以在Google Repository中找到新的Firebase(9xx)库。您可以使用Eclipse Android SDK Manager安装它。打开SDK管理器并向下滚动,直到找到Google Repository并安装该软件包。

The package will be installed in /extras/google/m2repository and you will find the Firebase files further down at /com/google/android/firebase.

该软件包将安装在/ extras / google / m2repository中,您将在/ com / google / android / firebase中找到Firebase文件。

You can rename the .aar files to .zip and extract the jar file, rename these from classes.jar and copy them to the project libs folder displayed in Eclipse (or copy outside Eclipse and then follow the instructions to import a project into Eclipse.)

您可以将.aar文件重命名为.zip并解压缩jar文件,从classes.jar重命名这些文件并将它们复制到Eclipse中显示的项目libs文件夹中(或者在Eclipse外部复制,然后按照说明将项目导入Eclipse。 )

#2


2  

There is a move towards Android Studio with Gradle. The Eclipse solution to Firebase CM is not forthcoming. My feeling is we will all have to move to AS with Gradle soon. There are good books on it and very simple instructions on Google dev sites. We might as well start learning the new IDE and migrate.

随着Gradle向Android Studio迈进。 Firebase CM的Eclipse解决方案即将推出。我的感觉是我们很快就要和Gradle一起搬到AS。有关于它的好书和Google开发网站上非常简单的说明。我们不妨开始学习新的IDE并进行迁移。

#3


2  

You can add this on your Android Manifest

您可以在Android Manifest上添加此项

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 
<receiver
            android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

                <category android:name="YOUR PACKAGE NAME" />
            </intent-filter>
        </receiver>
        <receiver
            android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
            android:exported="false" />

And then you can get the token and try to send Message on.

然后你可以获得令牌并尝试发送消息。

Dont forget also to build FirebaseApps on your code (in my case on my MainActivity)

别忘了在代码上构建FirebaseApps(在我的MainActivity中也是如此)

FirebaseOptions options = new FirebaseOptions.Builder()
    .setApiKey("YOUR FIREBASE API KEY")
    .setApplicationId("YOUR FIREBASE APP ID")
    .setGcmSenderId("YOUR FIREBASE SENDER ID")
    .build();

FirebaseApp myApp = FirebaseApp.initializeApp(getApplicationContext(), options);
        token = FirebaseInstanceId.getInstance(myApp).getToken();

Hope it will get what you looking for on Eclipse.

希望它能在Eclipse上获得你想要的东西。

#4


1  

Old code is working no need to change code in firebase only change is in server code you have to use Web API Key from firebase project and Sender ID as per old code style. and you have to replace gcm url in web script - https://fcm.googleapis.com/fcm/send

旧代码无需更改firebase中的代码,只需更改服务器代码即可使用firebase项目中的Web API密钥和旧代码样式的发件人ID。并且你必须在web脚本中替换gcm url - https://fcm.googleapis.com/fcm/send

No Requirement of firebase library...

没有firebase库的要求......

#5


1  

Have a look at the resources below. In short, it's about including the Firebase libraries into your project (see the GitHub project and the two videos at the end) and manually performing the steps that the plugin does for you in Android Studio / Gradle.

看看下面的资源。简而言之,它是将Firebase库包含到您的项目中(请参阅GitHub项目和最后的两个视频),并在Android Studio / Gradle中手动执行插件为您执行的步骤。

  • Firebase libraries for Eclipse
    https://github.com/dandar3/android-google-firebase-README
  • 适用于Eclipse的Firebase库https://github.com/dandar3/android-google-firebase-README
  • Eclipse: Integrating Firebase Analytics into your Android app
    (same steps apply for other Firebase components, will write a post specifically for Cloud Messaging soon)
    http://dandar3.blogspot.com/2016/11/eclipse-integrate-firebase-analytics.html
  • Eclipse:将Firebase Analytics集成到您的Android应用程序中(适用于其他Firebase组件的相同步骤,将尽快编写专门针对云消息传递的帖子)http://dandar3.blogspot.com/2016/11/eclipse-integrate-firebase-analytics。 HTML