0

When there is a mobile client app being created using hybrid technology instead of developing the same using salesforce mobile sdk native programming, then how can we send messages from salesforce to mobile using inbuilt push admin service in salesforce. I am aware that we need to have GCM registration for the mobile client app for the first time. But once the mobile client app has received the registration id from GCM, how the salesforce will come to know about that token? Is webservice required in salesforce side to access the token from mobile client app?.

Thanks in advance for your help!

  • Did you find any solution to this, I am also searching a way to register device for push notification without using salesforce mobile SDK – Dory Jul 22 '15 at 7:07
1

You will need to register the client in the "MobilePushServiceDevice" sobject to be able to push notifications from salesforce.

Is there any reason not to use Mobile SDK? This will be much harder to handle otherwise. Here's the doc: https://developer.salesforce.com/docs/atlas.en-us.pushImplGuide.meta/pushImplGuide/pns_registration_process.htm

  • The Mobile Client App has been developed and in place by different team. So I am looking for a way to use the developed app to connect with Salesforce Push Notification. – vedakri Mar 18 '15 at 12:06
1

As mentioned above, you will need to register client device token by creating MobielPushServiceDevice sobject. Keep in mind that you will need to have a session created with your push enabled connected application consumer key to do this.

Also, you need to make sure that your mobile application re-registers periodically to keep-alive (e.g. when the application is brought to the foreground), and that it unregisters (by deleting MobielPushServiceDevice sobject record) when user logs out.

All this is conveniently handled by Mobile SDK, so I would recommend using Mobile SDK if possible.

0

Add this to your AppDelegate in iOS to actually see the result of (and react to) PUSH notification that your salesforce server sent to your device

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
{
    NSLog(@"I GOT PUSH notification with %@" , userInfo);
}

and you should see something like this(on your Debug logs on Xcode)

I GOT PUSH notification with

{
    aps =     {
        alert = "Hello from Salesforce again2";
        badge = 1;
        sound = default;
    };
    msg = "json msg from parag";
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.