I done integrating pushwoosh according to pushwoosh guide to my Android app but I need to customize the data comes from the notification. I've paid for custom data and i'm sending a json like this
{"category":"Iraq","id":"1000"}
so when the application get the notification can do an event according to this custom data from pushwoosh.
How to do that ?
Take a look on the Android sample:
https://github.com/Pushwoosh/pushwoosh-sdk-samples/blob/master/Native/Android/src/com/pushwoosh/test/tags/sample/app/MainActivity.java
public void doOnMessageReceive(String message)
JSONObject customJson = new JSONObject(messageJson.getString("u"));
The custom data will be under "u" parameter in the push payload.
Hi Shader the URL you have mentioned is giving 404 . I guess this is the more relevant URL . Please confirm and update your answer
https://github.com/Pushwoosh/pushwoosh-native-samples/tree/master/Android
The sample project was moved to SDK. you can find it here:
https://github.com/Pushwoosh/pushwoosh-android-sdk
Related
I have never used a RESTful API. I want to use this API to get historical weather data, but I can't find a simple tutorial taking me from end to end making an app that uses a RESTful API in Java. I'm not sure what steps I should take to get the data.
The steps listed on the getting started page are not Java specific, so I'm not sure how to use that info. I have requested a token and got it, so I'm good on that front.
What I need help with is getting a minimal example showing how, with just a token and formatted URL, you can get JSON data from the API.
Some things I've looked into are javax.ws.rs and jersey client, but I'm not sure how to use those either.
Thanks in advance :)
Using Fetch you can do:
fetch(url, {options})
.then(data => {
// Do some stuff here
})
.catch(err => {
// Catch and display errors
})
Where the url is the one from the getting started page.
And you can get whatever data you need from data.
Say you need to save just the name in a local var, then you do:
.then(data => {
name = data.name
})
I was able to create an Intent in Dialogflow following this example:
https://cloud.google.com/dialogflow/docs/manage-intents#create_intent
That worked just fine, adding plain text responses to that Intent. However, my Dialogflow Agent is using both text responses and a Custom Payload. I can't find any documentation explaining how to do this, so I tried playing around with the code.
I was able to get an empty Custom Payload to show by doing this:
Builder messageBuilder = Message.newBuilder();
messageBuilder.setText(Text.newBuilder().addAllText(messageTexts).build());
messageBuilder.setPayload(Struct.newBuilder().build());
However, this results in JUST the Custom Payload, not the Text responses. I have two questions:
How can I add some String content to the Custom Payload?
How can I have both Text responses and Custom Payload at the same time?
You can use the Struct.newBuilder().putFields(field).build());
where field is a Value that you can build as below :
Value.newBuilder().setStringValue(yourStringValue).build();
So here's the deal , I already generated this Json URL :
https://api.myjson.com/bins/w7wuz
And I did some code om my app in order to read it. So far so good.
But I'm struggling a bit , trying to edit a key on my Json URL , to see if my app would update the value as well .
I hope I was clear with what I pretend. Thanks guys .
Add a new parameter to your URL then possible otherwise not possible in my view.
Like :
https://api.myjson.com/bins/w7wuz?id=1
https://api.myjson.com/bins/w7wuz?id=2&name=kaushal
I have the url working in browser that returns the JSON result of the query that gets information about the Youtube Video but don't understand how i can use the Youtube Data API to pass this JSON and look at the information.
Here is the code i am using:
YouTubeService service = new YouTubeService("app");
//service.setUserCredentials("xxx","xxxxxx");
String videoEntryUrl = String.format("https://www.googleapis.com/youtube/v3/videos?key=%s&part=snippet&id=%s"
, Config.YOUTUBE_API_KEY , (String) params[0]);
VideoEntry videoEntry = service.g.getEntry(new URL(videoEntryUrl), VideoEntry.class);
The API key i have created is a Browser Key, so the data is formatted in JSON.
Also the error i recieve is:
com.google.gdata.util.ParseException: Unrecognized content type:application/json;charset=UTF-8
I think you should use the YouTube Data API Client Library for Java for your Youtube implementation.
Note the following operations that you can use:
list
insert
update
delete
With this, there is no operation for a specific video but you can use list operation instead.
You can use these links for more information:
https://developers.google.com/api-client-library/java/apis/youtube/v3
https://developers.google.com/youtube/v3/code_samples/
Also, here's an item that you can refer to.
I am new to Android and Windows Azure. I have successfully inserted data from Android application but how do I retrieve single data and post that data on a TextView?
The read function after the gettable class is also not working. What is the exact function use for it? I have followed these instructions but they did not work for me, also I do not understand the documentation.
Currently, I just can provide some tutorials about how to use query data from azure database. I recommend you can refer to this official document about how to use Azure Client Library using Java: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-android-how-to-use-client-library . You can focus on two part: “how to query data from a mobile service” and “how to bind data to the UI”.
At the same time, you can view this video from Channel 9: https://channel9.msdn.com/Series/Windows-Azure-Mobile-Services/Android-Getting-Started-With-Data-Connecting-your-app-to-Windows-Azure-Mobile-Services.
The sample code project of this tutorial, please go to the GitHub link https://github.com/Azure/mobile-services-samples/tree/master/GettingStartedWithData .
For the ‘getTable(Class )’ function is not working, please double check whether the class name is same as table name. If they are same, you can use it like below:
MobileServiceTable<ToDoItem> mToDoTable = mClient.getTable(ToDoItem.class);
If not, you can write you code like this:
MobileServiceTable<ToDoItem> mToDoTable = mClient.getTable("ToDoItemBackup", ToDoItem.class);
For further better support, please share more detail about your code snippet .