gpt4 book ai didi

android - Parse.com 初始化服务器

转载 作者:行者123 更新时间:2023-11-30 00:52:03 25 4
gpt4 key购买 nike

我最近参与了一个正在进行的 Android 应用程序项目,我必须对其进行更新。在更改应用程序的某些功能时,我偶然发现了一些 Parse 初始化代码,经过一番研究,我猜测它应该通过 Parse 启用 Android 推送通知。

问题是,在阅读了一些 Parse 教程并尝试了很多关键搜索词之后,我无法在代码中找到 Parse 服务器的设置位置和连接位置。当前配置是:

// Using Parse-1.3.0.jar lib

// My Activity
Parse.initialize(this, "APP_ID", "CLIENT_KEY");
ParseAnalytics.trackAppOpened(getIntent());
PushService.setDefaultPushCallback(this, MYACTIVITY.class);
ParseInstallation.getCurrentInstallation().saveInBackground();

// My AndroidManifest.xml
<service android:name="com.parse.PushService" />

<receiver android:name="com.parse.ParseBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>

// That seems to be the only Parse related configuration...

那么应用程序如何知道连接到哪里呢?它使用哪种 Parse 服务器配置?

我知道 Parse 服务已停止,如果我们想继续使用 Parse,我们可能必须设置一个托管的 Parse 服务器,但首先我们需要了解它现在如何连接到 Parse。

如有任何帮助,我们将不胜感激。

感谢您的宝贵时间。

最佳答案

默认情况下,解析 SDK 连接到位于 https://api.parse.com 的托管解析服务器。

一旦您设置并运行了解析服务器实例,只需使用配置对象初始化 SDK:

Parse.Configuration configuration = new Parse.Configuration.Builder(this)
.applicationId(BuildConfig.PARSE_APPLICATION_ID)
.server("https://www.website.com/parse/")
.clientKey(BuildConfig.PARSE_CLIENT_KEY)
.build();
Parse.initialize(configuration);

如果您有任何其他问题,请随时询问。我不确定我是否得到了您想问的问题。

  • ParseAnalytics 东西可能会消失,不应再受支持。
  • 我们可能必须设置一个托管的 Parse Server:如果暂时停止应用程序对您来说是个问题,我认为您应该快点,因为截止日期(我认为是 1 月 28 日?)越来越近了。
  • 当您更新到自己的 parse-server 时,推送通知将无法与您的配置一起使用。阅读here了解更多信息。您将必须获得自己的 GCM(或 FCM,在本例中是相同的) key :

By default, the hosted Parse service (parse.com) sends pushes to your Android app with its own GCM sender ID. With your Parse Server, this setup will no longer work. Instead, your Parse Server will send GCM pushes with its own GCM sender ID and API key. You should register a GCM sender ID and update your app as soon as possible.

发件人 ID 将需要在 list 中用作:

<meta-data android:name="com.parse.push.gcm_sender_id"
android:value="@string/gcm_sender_id" />

无论如何,距离你现在的位置还有很长的路要走,此时你可能应该尽快设置一个parse-server,然后才升级 Android 应用程序相应地。

关于android - Parse.com 初始化服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40878356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com