Can we set custom data while creating a Private QBDialog? - android

I am using QuickBlox Android SDK. While creating a new private dialog, I need to add some meta data in QBDialog.
As I understand, a private dialog should be created using PrivateChatManager. And it only provides a way to create a dialog with participant ID with following method signature.
createDialog(int participantID)
But according to my requirement, I need to pass some other meta data like the name of the participant. That is required while retrieving the Dialogs.
Otherwise, I will have to do a separate API call to get the user details!
So, Can't we pass meta data to a private Chat Dialog? Are there any solutions to overcome this problem?

You may try to use the following workaround with custom parameters:
custom parameters

Related

How to exchange an object between different Android Activities?

My application has a list of clients (with only name and age displayed) and I want to be able to edit/add more info about them that is not visible in the list.
So whenever I click on a client, I want to start a second activity with all the info about him.
Can I use an intent for this? Can I pass a full Object (Client) at once with an intent?
I've looked through these two topics, but I haven't found my answer yet:
How to exchange data (objects) between different Android Activities?
How do I pass data between Activities in Android application?
Thanks in advance.
Look at this answer: How to pass an object from one activity to another on Android
//to pass :
intent.putExtra("MyClass", obj);
// to retrieve object in second Activity
getIntent().getSerializableExtra("MyClass");
I would suggest you look into saving these in the SharedPreferences file. Build a singleton AppUtil class and add functionality to save data in the shared preferences there as well as being able to retrieve said data
If you have a large amount of information being stored for the clients then you should look into SQLite as database storage.
The more pratice way is create a class to hold every objects that you need to change between the activities. Like that:
public class MyHolderObjects {
public static MyObjectType mObject;
}
before start the new activity (or whatever you goes to use it), instantiate (create) the object in MyHolderObjects. And use it everywhere you need :). I prefer this approach instead serialize the object.

How do you pass Custom Dimension values to Google Tag Manager in Android NOT the web

I am able to pass events to google Tag Manager v4 but the custom dimensions are not set. I have not been able to find ANYTHING on examples how to do this. The custom dimensions are setup correctly.
the code I'm using is:
DataLayer mDataLayer = ContainerHolderSingleton.getDataLayer();
mDataLayer.pushEvent("clip-start",DataLyaer.mapOf("Network","network value here"));
It should be this simple. I've setup the custom dimensions to be Custom Dimension index 1, in the admin it's setup as index 1.
Doesnt' help that googles sample code doesn't tell me much either: This is the generated code that is generated when I input the custom dimesnion in the admin. What is "tracker", or Fields.. they dont tell me which import will work with this.
String dimensionValue = "SOME_DIMENSION_VALUE";
tracker.set(Fields.customDimension(1), dimensionValue);
So ultimately, how do I pass the custom Dimension values through the data Layer to GTM.
It is probably because you may not have added custom dimensions into your google analytics tag in tag manager. Add the custom dimensions with parameters with values. The ids should match the ones in analytics.
Hope that helps
The way I solved this was to use the GoogleAnalytics Tracker like this:
tracker.set("&cd1", "new video title");
tracker.set("&cd2", "vidoe type");
tracker.set("&cd3", "access");
&cd1, &cd2 etc is the way these constant fields are passing custom dimensions to the back end.
Make sure you double check the sample code for reusing and downloading a container. I had mucked with it and that was stopping me from getting the new container, thus also not getting new values. Copy the sample code verbatim.

Facebook SDK request api

I have been reading the Facebook documentation. The Facebook documentation for asking/sending gifts mentioned a YOUR_OBJECT_IDfor this call:
FB.ui({method: 'apprequests',
message: 'Take this bomb and blast your way to victory!',
to: 'RECIPIENT_USER_ID'
action_type:'send',`enter code here`
object_id: 'YOUR_OBJECT_ID', // Where do I get this ?
data: 'Friend Smash Custom Tracking 1'
}, function(response) {
console.log(response);
});
How do I get get it? I have already created my object inside Open Graph, but there is no object id specified. Do I need to initiate a create request for the user from my app for that object or how is this suppose to work?
The request_object_id is what you will get back from the dialog, after the user sent the gift – it is part of the dialog’s return value. It is simply the identifier for the request that was send.
https://developers.facebook.com/docs/games/requests/v2.1#response
You can use it to read details of the request back from the API.
OK, so since this is about the object id that one can pass to the dialog:
That documentation section already links to https://developers.facebook.com/docs/sharing/opengraph/custom, where this is explained in more detail.
Basically, you need to set up your own Open Graph action and Open Graph object. This will define what your object is, and what players of the game can do with it.
Open Graph objects can be created in two ways:
You can host them yourself. To do this, you simply provide URLs to HTML pages which include the Open Graph meta data that specifies the object property values. Facebook will then read the meta data from those URLs (“scraping”). In that case, you would simply pass the object URL to the dialog as object_id.
You can use the Object API to create objects that Facebook will host for you. These can either be “app-owned” or “user-owned” – depends on if the are specific to a certain user, or “common” objects to be used by all users of your app. Creating an object via that API will give you back an object id, that you can then pass to the dialog.
If you are not familiar with the whole Open Graph Story concept yet, then I recommend you start by having a look at the whole Open Graph section, https://developers.facebook.com/docs/sharing/opengraph

How to add a custom field to the contacts in android?

I want to add a custom field to any new contacts created in the Android programmatically. Say for example birthday?
Please help me in this regard.
Do you want your custom field to be clickable and to be able to view it from an activity?
If so, you would need to created a synchronization service between an Authenticator and a SyncAdapter.
Check this project, where the code adds new account with custom field, which can be viewed in some activity: https://github.com/nemezis/SampleContacts.

Dynamic flow in Android application

I am developing an eCommerce where I am fetching the Products and sub-products from database at run time.
Here the depth of the sub-products is not fix, means that I don't know at build time that a sub-product of clothes e.g. jeans, again have a sub-product or not.
I think to create Activities dynamically but as per Android Documentation we can not done it.
We have to specify Activities in Android Manifest.xml at build time.
As per your Question you want to display Products and sub-producs dynamically in your application. for that you should have to use Listview to display your UI part and use AsyncTask to Load data from your database/server.
ListView Tutorial :: http://www.vogella.com/tutorials/AndroidListView/article.html
AsyncTask Tutorial :: http://developer.android.com/reference/android/os/AsyncTask.html
First of all you need to clarify the data structure of the product defined in your application. There should be relationship such as foreign key or other constraints defined on your eCommence backend database.
So, there is no need to create activities at runtime. Instead, try to define a base activity to handle the common product operation and other special activities that extend the base activity to handle the differents between the product and the sub-products.
The logic may like this:
Load product data in common activity. then the app decide whether to load the sub-porduct via creating special activities according to the data flag/key defined in product data retrived from database, and so on.
I think expandable list view is best option for that.Because it clearly shows your main product and sub-products to the user.To create and understand expandable list view please see below link :
http://theopentutorials.com/tutorials/android/listview/android-expandable-list-view-example/

Categories

Resources