Adding url to nofitications - php

I'm using phonegap build to create an app.
I've used a plugin for collection ids for sending push notifications, and also a plugin to register url schemes.
I have decided to use Google GCM service to send the notifications (I'm using PHP on the server).
When I create the notification message I can send the title and the message in the data json. But I also want to include a url for deep linking, something like:
myweirdapp://show.html?uid=467
How can I do that?
Thanks !

Use data json field to put your custom data in. See https://developers.google.com/cloud-messaging/server-ref#downstream

The WonderBird answer is almost correct.
You do need to add the data to the Json you are sending to GCM.
Then in your app you need to read this data if the notification was pressed and parse the result.
For instance, let's say you wanted to refer users to a different page. For this you have added to the Json the variable page=somepage.html
In the app you have to check if e.coldstart is true and then do something like location.href=e.payload.page
It's importent to notice that page is inside payload but coldstart is not.

Related

Best way to recieve a webhook and send back http response with status code on ExpressionEngine (version 5.4)

I am not that familiar with Expression Engine and I want to know the best way to recieve and sendback response to the webhook sent to an endpoint I can setup in Expression Engine. Is it even possible? I tried writing code to recieve a POST request on a template I just created and testing a POST request results in a 403 error with "The form is expired. Please refresh and try again."
Sounds like you'll need to create a plugin or module, which lets you create a corresponding Action URL you can POST to, and in the plugin/module code you can receive the POST request and do what you want with it.
https://docs.expressionengine.com/latest/development/models/action.html
https://docs.expressionengine.com/latest/development/modules.html
If you upgrade to EE6 there is a built in CLI tool to generate the base add-on files to get you started.

How to send/receive image in wordpress web services

I just wrote web services for wordpress like login, register, pass update, etc...
Now I want to user can upload images from iOS device and send this via web services(query string). I am not sure how to do this.
For login I just create a query string like http://example.com/apps/login.php?user=something&pass=something and get all the data in php file and then update the wordpress DB and return success message in json_encode.
But for images, how I can create the query string and how I can get those images in php file.
Thanks in advance...
But for images, how I can create the query string
You DO NOT! It's not a place for that. If you need data uploaded, do it right way using HTTP POST request with data payload.

How to send a request on facebook?

I read the Facebook dev info on how to make a request (located here) but I don't exactly understand what it does. Here's what I'd like to do. I'm using PHP and javascript.
I want a logged in user to send a request to a specific URL (with parameters attached) to multiple Facebook users (users who are already signed up for my site). Also, I need to be able to get the users that they selected and save them in the database, because only those users will have access to the URL that they're being invited to.
Are there any suggestions on how I can accomplish this?
I'm thinking you are talking about the a url request. From my experience this can be done using a simple JQuery request. You can find an example here and you can also read up on java APIs and how to use the methods(Google it). Hope this helps.
The requests dialog is for invitations to Facebook Canvas applications.
You are most likely thinking about the send dialog: https://developers.facebook.com/docs/reference/dialogs/send/
Add a callback function to FB.ui call that saves the id, this will only work if the user ids are hardcoded in. If the user manually adds them, I doubt you can track it.

Getting data from MySQL to android and displaying as list under "App List" Tab?

I am a noob in android dev.. I have couple of questions..
1...I have database created in localhost in MySQL server. Table of all the "States".
Q2...I created PHP script to connect to the database, and getting the list from the database.. ...I need to convert this to Json file/data to be read in android...????
Q3...I created android project with tab views for list tab, getting & saving details tab, settings tab.. where details are settings tab are form view elements and need to write them back in json n send them to MySql database. how do i do that.. in php or android or both...?????
Q4.. When the user first installs the app and runs it, my app should send to the server the mobile registration id... how do it do that..?????
I tried C2DM, but no luck.. I am testing everything in the emulator first..
I am so stuck in these issues.. i have created more than 10 projects for each individual feature with the help of forums and blogs and google developer forums .. and yet dint succeed in anything..
PLZZZZZZZZZZZZZZZZZZZZZZZZZZ.... HELPPPPPPPPP!!!!!!!!!!!!?????
Thanks in adv..
Su
Q1. It is typical to use the json_encode() function to output a PHP array as a JSON object. This can be consumed by your android application by an AJAX call, passing in the URL to your PHP script.
Q2. Prepare an array of what you want to output as normal and then call json_encode() on it.
Q3. Look through the Android documentation and find a JSON encoding function. To 'send it to MySQL' you will need to pass the JSON output through an HTTP POST request to your PHP script that can validate the data and submit it to the database.

How can i implement linkedin inviter to my website using PHP?

i read the documentation of linkedin inviter from the link http://developer.linkedin.com/docs/DOC-1012 and there is no other help on internet inspite of this page. but what i found is only the XML things on this page. i dont know how to use it and what should be required basically to make the code work. please post or give reference to a complete code for linkedin invitation in PHP. i would greatly be obliged .
There is a LinkedIn-recommended library for PHP that has a specific invite() method that you could use:
http://developer.linkedin.com/docs/DOC-1255
Direct link to code:
http://code.google.com/p/simple-linkedinphp/
Essentially, you pass it the method of invitation (by email, member id), pass it the recipient, subject, message, and it creates the XML and sends it via OAuth to LinkedIn.
There's also a demo script included, and a live demo showing how to use the invite() method here:
http://simplelinkedin.fiftymission.net/
OK I took a brief look at that API you are talking about. The API requires that you first build a XML file and then use the "POST" method to send it to the provided URL. I should mention that I have never attempted this before, so I may be incorrect, but the process seems pretty straightforward, if somewhat confusing according to the LinkedIn API docs.
So you have several options:
I believe that you can use AJAX to post the XML to the LinkedIn API. In order to do this, you would set up an AJAX call that uses the "POST" method. Here is a link on how to construct a AJAX POST request (its a little different than a "get" request). So essentially you would take your users input out of a form, pack it into a series of structured XML nodes (just like if you were building a XML file) and then take that dynamically generated block of XML and insert it into the body of the AJAX request. Send the request and then parse the results.
Alternatively you could set up a blank XML "template" file with the structure you need to submit the invitation to the LinkedIn API. When your user submits the invitation request to your server you would extract their input, validate it, and then use a combo of PHP Xpath and PHP DOM to search through your XML template and dynamically add the user data to the template at the correct node locations. Then use these instructions on this page to send your invitation request to the API handler at LinkedIn (uses PHP function "curl()").
Let me know how it turns out!
Regards,
H

Categories