Parse-sdk-js: How to save a new device to Installation class?

Created on 4 May 2016  路  6Comments  路  Source: parse-community/Parse-SDK-JS

I install parse-server and parse-dashboard to a ubuntu server 14.04.
Everything works fine. Now, in my application, i need to save a mobile device into a installation class.

My objects:
var platform = platform.toLowerCase();

var androidDevice = { deviceType: platform, pushType: "gcm", deviceToken: notification.regid, GCMSenderId: androidConfig.senderID, channels: ["all"] };
var iosDevice = { deviceType: platform, deviceToken: deviceToken, channels: ["all"] };

Most helpful comment

Hi, @satyamdorville. In another issue, I got confirmation that in order to use this SDK in a React Native app, for instance, the SDK should provide the same functionality that native Android and iOS ones do.

Unfortunately, I never put the time to help to implement this and the workaround we used in my team was to create the installation in the server in a cloud function and add a new field to the Installation class, updating it with the installation id from the client, thus obviating the automatically generated application id.

Let me know if this makes sense for you.

All 6 comments

To create an Installation, you can save an object with the class name _Installation. However, I will say that Installations are not supposed to be created in this way. They should be created directly from the corresponding Parse SDK on the device itself. Otherwise you might not be able to guarantee that the installation ID that you save to the database matches the one on your device.

Hi, @andrewimm. Is it possible to do what you say (creating and saving the Installation via the SDK, instead of manually) with the JavaScript SDK? I can only see methods to do so in the native clients. Thanks.

@danielmartinprieto Hello Daniel ! How did you manage to do this finally ? (Assuming that you have succeeding. )

Hi, @satyamdorville. In another issue, I got confirmation that in order to use this SDK in a React Native app, for instance, the SDK should provide the same functionality that native Android and iOS ones do.

Unfortunately, I never put the time to help to implement this and the workaround we used in my team was to create the installation in the server in a cloud function and add a new field to the Installation class, updating it with the installation id from the client, thus obviating the automatically generated application id.

Let me know if this makes sense for you.

Same approach (cloud function) for my ionic project. The only key data required from the client side is its deviceToken (e.g. APNS / FCM).

Thanks @mfkenson @danielmartinprieto i will do that ! that makes sense

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gyran picture Gyran  路  5Comments

adrianchifor picture adrianchifor  路  3Comments

dblythy picture dblythy  路  4Comments

Simone-cogno picture Simone-cogno  路  7Comments

simpleshadow picture simpleshadow  路  6Comments