How to edit Google spreadsheets in Kinetise's mobile application? - android

I develop app in kinetise tool and I found it is possible to easly add list with Google spreadsheet content. But I don't know whether it is possible to edit sheets from user account (when it is public or user sign up with Google). Let's say add records for specific position (A1) in specific sheet (SheetName). How to achieve this?

Yes, you can both view your spreadsheet (read) and edit it (write) in Kinetise.
Firstly, publish your sheet and get public URL address (File -> Publish to web).
Now in Kinetise editor add List widget and select "From Google Sheets" in Online source view. Paste your URL address and data from sheet should be displayed.
What about write, well you need to Sign-In with Google first. So please add Google login method to your application. You can do this attaching Google login widget to your Splash Screen.
Then in screen where you want to edit sheet please add Form widget. Select "To RESTful API" as form send destination. Paste below url:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}:append?insertDataOption=INSERT_ROWS&valueInputOption=USER_ENTERED&access_token=##GetGoogleUserAccessToken##
where
{spreadsheetId} - yours spreadsheet ID (same as in List widget's URL);
{range} - columns range: A1:B1 (depends on number of columns in your table).
The last thing you have to do is to edit send request body. Please click Settings button on the right of URL address. In Body tab and Request body transform section please paste:
{ "values": [
[ .form.field1, .form.field2 ]
]
}
field1 and field2 are names of form fields, so if you have another names or more columns please change it. And that's all, now you should be able to edit spreadsheet.

Related

Firebase data flattening

I have a quick question about the best practices for data structure in a firebase database.
I want users of my app to be able to maintain a friends list. The firebase documentation recommends creating a schema (not sure if thats the proper word in this context) that is as flat as possible. Because of this I thought it would be a good idea to separate the friends section from the player section in the database like so:
{
"players":{
"player1id":{
"username":"john",...
},
"player2id": ...,
"player3id": ...
}
"friends": {
"player1id"{
"friends":{
"friend1Id":true,
"friend2Id":true
}
},
}
"player2id"{
"friends":{
"friend1Id":true,
"friend2Id":true
}
},
}
}
So my questions are as follows:
Is this a good design for my schema?
When pulling a friends list for one player, will the friends lists of EVERY player be pulled? and if so, can this be avoided?
Also, what would be the best way to then pull in additional information about the friends once the app has all of their IDs. e.g. getting all of their user names which will be stored as a string in their player profile.
Is this a good design for my schema?
You're already thinking in the right direction. However the "friends" node can be simplified to:
"friends": {
"player1id": {
"friend1Id":true,
"friend2Id":true
}
}
Remember that Firebase node names cannot use the character dot (.). So if your IDs are integer such as 1, 2, and 3 everything is OK, but if the IDs are username be careful (for example "super123" is OK but "super.duper" is not)
When pulling a friends list for one player, will the friends lists of EVERY player be pulled? and if so, can this be avoided?
No. If you pull /friends/1 it obviously won't pull /friends/2 etc.
Also, what would be the best way to then pull in additional information about the friends once the app has all of their IDs. e.g. getting all of their user names which will be stored as a string in their player profile.
Loop through the IDs and fetch the respective nodes from Firebase again. For example if user 1 has friends 2, 3, and 4, then using a for loop fetch /players/2, /players/3, and /players/4
Since firebase pull works asynchronously, you might need to use a counter or some other mechanism so that when the last data is pulled you can continue running the completion code.

Android - how to create custom word dictionary for only my application?

I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!

Lime Survey Submit answer from Android app

In an Android app i have implement LimeSurvey,in which list of different Survey are displayed from lime survey admin panel.
I am able to display questions of a survey but not getting any structure to submit user answer's of survey to LimeSurvey database.
Any one can please help me how can i submit answer and in what structure lime survey accept response of survey.
As document suggest to add response in format -
sSessionKey (string) - The session key
iSurveyID (integer) - The survey id
aResponseData (array) - array/structure containing your response data
so my query is what the structure for aResponseData (array) , so it properly store in lime survey database.
Edit:
How to add answer of sub-questions.I am able to submit answer of simple question but how to send answer of subquestion and in Survey question type-L(List of radio with comment)how to submit comment.
Thanks in advance.
The only way I found to solve this was downloading the .sql database backup from the main taskbar and look for your table, which is *lime_survey_IDSURVEY*, and check for the columns which match with your questions, and use them for your mapping in the aResponseData. I'll leave you an example of that:
{"method": "add_response", "params": {"sSessionKey ": "ey2bv8v7zaw7uwj6fa9a8mmx9xqiikja", "iSurveyID ": 588636, "aResponseData ": {"588636X1X1":"Aja","588636X1X22":"Y" } }, "id": 1}
This will be the JSON that I send with my POST request, where 588636X1X1 is a column that match with a question, and "Aja" is the answer (in that case is a text-string), meanwhile, the other one, it's the same but it's a multiple choice question. As you can see, there is a pattern for the column names, 588636 it's my survey ID, X1 it's the group of the question, and X1 it's the ID for my question.
Hope it's useful.
You should be using the limesurvey remote control feature to call the webservices api for various tasks you want to perform: add_response in this case . Its documentation is here
--
amit

Android App , add a favorite quote functionality

I have an android app which displays quotes and have navigation to go to next quote and so on. would like to add "Save Quote As favourite" based on users selection of particular quote.
Once user saves Fav quotes and wants to see those quotes only, app should show those quotes.
Currently app reads the quotes from XML file. Let me know if any more information is required to understand the problem.
I would provide every quote with an ID (int). Whenever the user selects a quote to be a favourite, that ID is saved to a Set of integers. Later on if user decides to show favourites, you fetch all quotes with your IDs from the Set and show them in a appropriate view, for example a ListView
If you have a Quote class or something like that, you might as well put them in a collection whenever user decide his favourites, and show them in a ListView with a custom adapter.

Facebook Graph API Groups

I try get information about own groups over Graph API.
On me/groups I get list of groups. But I not understood what is params: bookmark_order.
Also we can see param unread:1. If I right, it present if another user set some change in group (post new comment). If I refresh group page in browser or open in native android app, then unread is no longer appears. After which api request I can remove unread flag?
Also at group's wall I can ask question. But {group_id}/feed not contain this posts. How I can get it?
I have group document. I can get data about this document: subject, message. But if in document I insert image, then in message param I has string about this image: (img:301666969868743). How can I get this image? Simple GET-request with 301666969868743 (I assumed that this long decimal is ID) return false.
bookmark_order (see https://developers.facebook.com/docs/reference/api/user/)
An array of objects containing the version(old-0 or new Group-1),
name, id, administrator (if user is the administrator of the Group)
and bookmark_order(at what place in the list of group bookmarks on the
homepage, the group shows up for the user).
unread
Doesn't appear to be documented. I would presume this would be a read-only value that facebook controls.
Log a documentation bug with facebook and ask them to explain it. (https://developers.facebook.com/bugs?search_view=search&search_ids%5B0%5D=208685622513742)
question not appearing in {group_id}/feed
Tested it and you're right, it doesn't appear. Good find. You should log this as a bug with facebook.
(https://developers.facebook.com/bugs)
Group document with image
When I did an image in a document, I too got the cryptic (img:###) inside the message of the returned object from {group_id}/docs. However I was able to find it on the graph using https://graph.facebook.com/####?access_token=#### and it returned the results. So I'm not sure how to help you with this one

Categories

Resources