I want to generate a tree-based menu using Java that will appear on a USSD browser. Each node may have children, ending with leaf nodes. I will also have to maintain state regarding each user who accesses this menu (like his current position on the menu) to facilitate navigation.
Any ideas on how I may achieve the tree generation and state management?
I assume that you get a message from the gateway such as:
(Session#, UserInput)
and you need to compute the next information to send to the user ?
I propose:
table CURRENTSTATE:
Session#
State
table STATES:
State
Title
table CHOICES:
State
Choice
Name
DoCode
NewState
Then when you get the message (Session#, UserInput):
query CURRENTSTATE using the Session# to determine what state the user is in.
query CHOICES using the State and Choice=UserInput to determine the new state (and DoCode) based on user input.
Based on DoCode, you can do some processing.
update CURRENTSTATE to reflect the new state.
query STATES to get the Title (e.g. "Please choose a color").
query CHOICES to get the possible choices from the new state (e.g. (1, "Blue"), (2, "Red"), etc.)
build the message (concat Title + choices)
return message to user.
Is that a reasonable way to solve the problem ?
HI,
am also currently developing a USSD menu based application. Unforturnately there are scarce resources about USSD applications on the internet and i think it's because USSD unlike SMS is not yet standardized. so every telecom has their own ussd implementation.
The project am working on requires a USSD gateway(run by the telecom) and my webserver(apache) which runs my app.
my app written in php communicates the telecoms USSD gateway via xml fortunately for me. so i get mobile user input from the USSD gatway via xml and i also send xml pages back to the USSD server which inturn display the reply on the use's mobile phone.
that's all i know.
Have a look at an implementation of this problem: Vumi.org
Source code viewable at https://github.com/praekelt/vumi
Related
I am building an Android application, later on maybe also an iOS version of the app and a web application. I have a list, for example in this way:
City Name
State
Counter Clicked
More columns
Dallas
Texas
4
…
Boston
Massachusetts
3
…
New York City
New York
1
…
San Francisco
California
3
…
San Diego
California
3
…
Seattle
Washington
10
…
Boise
Idaho
0
…
I am searching for a solution how to meet the following requirements:
The list and its data are always up to date and transferred from a backend system (Google Firebase) when the user is online.
The solution needs to work on iOS / Android devices and if possible also on a website.
Typing in "D" only "Dallas" should be displayed.
Typing in "S" Seattle, San Diego, and San Francisco should be displayed in this order, because of the "Counter Clicked" value (the higher the value, the more relevant is the result)
Typing in "S" also Dallas, Boston, Boise should be displayed in this order (regarding "Counter Clicked") after the words beginning with "S", because they are containing the letter "S" within the word.
The "Counter Clicked" is handled per user. So the City Name can be selected and every time the user selects the city name, the "counter clicked" should be increased by 1.
The filter service should be offline ready, so the "Counter Clicked" should be handled on the device. I am not quite sure if it makes sense to upload the data back to the Firebase backend server, what do you think?
It would be great to have a typo tolerance. So for example typing "Bostn" or "Sen" (tolerance by one letter) "Boston" or "San …" should be displayed.
I will also have the possibility to have a facet filter so that I can filter before typing for one of the "State"s of the USA.
I am interested in a professional solution if this is available on the market, otherwise, I need to build it for myself.
I am building an Android application, later on maybe also an iOS version of the app and a web application.
You can achieve that using Firebase because:
Firebase is a platform developed by Google for creating mobile (iOS and Android) and web applications.
I am searching for a solution how to meet the following requirements
To answer your questions, I will use Cloud Firestore which is:
Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud. Like Firebase Realtime Database, it keeps your data in-sync across client apps through real-time listeners and offers offline support for mobile and web so you can build responsive apps that work regardless of network latency or Internet connectivity.
Let's get started:
The list and its data are always up to date and transferred from a backend system (Google Firebase) when the user is online.
You have the answer right above, "it keeps your data in-sync across client apps through realtime listeners". So your data will always up to date.
The solution needs to work on iOS / Android devices and if possible also on a website.
It will, as Firebase is a cross-platform solution.
Typing in "D" only "Dallas" should be displayed.
You can achieve that in a very simple way, by using Query's startAt() method:
Creates and returns a new Query that starts at the provided fields relative to the order of the query.
So you query should look in code like this:
ref.collection("cities").orderBy("cityName").startAt(name).endAt(name + "\uf8ff");
You can also check the docs for that, and see my answer from the following article:
How to filter Firestore data cheaper?
Typing in "S" Seattle, San Diego, and San Francisco should be displayed in this order, because of the "Counter Clicked" value (the higher the value, the more relevant is the result)
To solve this, you can use Query's orderBy(String field, Query.Direction direction) method:
Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
So you can display those cities according to the number of the "Counter Clicked".
Typing in "S" also Dallas, Boston, Boise should be displayed in this order (regarding "Counter Clicked") after the words beginning with "S", because they are containing the letter "S" within the word.
Unfortunately, Firestore does not support full-text search. The official documentation regarding the full-text search in Cloud Firestore is up to date and stands for Algolia.
For Android, please see my answer from the following post:
Is it possible to use Algolia query in FirestoreRecyclerOptions?
Or:
Is there a way to search sub string at Firestore?
The "Counter Clicked" is handled per user. So the City Name can be selected and every time the user selects the city name, the "counter clicked" should be increased by 1.
This can be very simply achieved using FieldValue.increment(1) as explained in my answer from the following post:
What is the recommended way of saving durations in Firestore?
The filter service should be offline ready, so the "Counter Clicked" should be handled on the device. I am not quite sure if it makes sense to upload the data back to the Firebase backend server, what do you think?
According to the official documentation regarding Access data offline:
Cloud Firestore supports offline data persistence.
For Android and iOS, offline persistence is enabled by default.
For the web, offline persistence is disabled by default. To enable persistence, call the enablePersistence method.
So you have support for three platforms, and yes, it makes sense to upload the data to the server because in that way you'll always have consistent data.
It would be great to have a typo tolerance. So for example typing "Bostn" or "Sen" (tolerance by one letter) "Boston" or "San …" should be displayed.
That's nothing built-in Firestore that can help you with that. What you can do, is to create an additional field of type array and search within it. So that array might have typos like that "Bostn" or "Bston".
I will also have the possibility to have a facet filter so that I can filter before typing for one of the "State"s of the USA.
That's also nothing already built-in Firestore, but you can implement for sure something like that. Most likely you might consider defining some filters and use them before typing.
I am interested in a professional solution if this is available on the market, otherwise, I need to build it for myself.
For sure Firebase can help you achieve what you want, so I hope I was able to provide the best solutions for that.
I need to make an app that is able to read the Google Pay Pass event ticket through NFC. But I can't find any way how to deal with it. I saw some top apps in Google Play, as PassWallet and Passes, which works with such event tickets.
But they all could add a new ticket through scanning barcode only, not through NFC touch. I tried to open a ticket in Google Pay app and read it through another phone's NFC reader but didn't receive any information about the ticket, I always receive my default credit card info even when I open needed card.
So my question is that is it possible to read Google Pay Pass event ticket through another phone's NFC, as in the picture below?
If yes, could you share with me some example codes on how to do it?
Yes it is possible.
For a Google Pay issued pass the pass must be saved to google pay on the mobile device and that passes class must be set to enable smart tap and the pass itself must have the smartTapRedemptionValue field set as below:
{
...
"smartTapRedemptionValue": "Value to Transmit",
...
}
The device acting as the terminal (reads the pass) must implement the Smart Tap Protocol and present the collector id, and signed payload to the mobile device to authenticate the terminal and send passes that it can redeem.
The passes class also has the field redemptionIssuers can specify which terminal's collector id can redeem it.
In order to implement Smart Tap Protocol you can request access to the NDA protected docs via a form and that has the details on how to configure a device acting as a terminal to read passes.
There are also already certified supported terminal providers available.
I'm currently working on a native Android app for my company and ran into some problems with Salesforce lately.
I hope I can find some help here.
What I want to achieve:
The company has a lot of Accounts in Salesforce with 3 important fields for the app: Name, Business (Workshop or Parts Dealer) and location(latitude, longitude)
I would like to show those Accounts(Workshops/Parts Dealers) as markers on a google map in my Android app based on a radius around the user's current location. So it would be more than sufficient to get the data as JSON or XML(i read about sObjects, which would be nice too)
The app will be freely available on Google Play Store and every user should be able to see all the Workshops/Parts dealers around the world.
The problem I'm facing is that I can't find a way to fetch the data inside my app without authenticating every user with a Salesforce-Login.
Which API is the best to use in this case?
It would be so awesome if anybody could help me with this problem.
What I tried so far:
- SalesforceMobileSDK: If i extend SalesForceApplication() i always end up with the Salesforce-Login Screen.
It seems that every client has to be authenticated for API-calls to work. I tried using the method peekUnauthenticatedRestClient(), but this method only works on full path URL's(e.g. "https://api.spotify.com/v1/search?q=James%20Brown&type=artist"), which isn't really practical for my Use-case.
I feel like I read nearly all docs about salesforce API, but can't quite get my head around how to solve this problem, although it seems like to be a pretty common use-case.
would a salesforce-apex method which would select all records inside a set radius around the user's location to be accessible without authentication?
Thanks for your help in advance!
Roman
Try asking on salesforce.stackexchange.com. Your question is more about licensing model than a particular programming problem. It might even be the case that you don't really need Salesforce for your project, you'd be better off on Heroku (even free tier) if the login piece is an issue...
All Salesforce APIs require some form of authentication. If you're positive you don't want to hardcode "Integration user" credentials in the app and you don't want to pay for (self-)registered user licenses in your org...
Try to read about these:
Site - piece of Visualforce running under specific "guest user", letting you view & interact with SF data without having to log in. You expose SF data to the world but that means it's your job to handle security (if any) and craft the API. You want to really display the data to human? Or just return JSON content or what...
Sites are meant to be displayin some incentive to contact you. Your product catalog / basic order form. Some map of nearby locations. Maybe a "contact us" form. There's limit on the traffic so eventually they'll explode as your app gets popular:
Customer Community - typically you need named licenses (even if they're fairly cheap) to let your customers log in to your SF. You create a Contact, click magic button - boom, this Contact now has a real matching User record with its own license. Think of it as some kind of step up from Sites - it'll still have some limits but will offer more than just raw API access and you'll have better control on what's going on.
I'm extremely new to Google Analytics on Android.
I've searched quite a bit for this, but I'm not sure I have understood it correctly, but here goes :
I want Google Analytics to track a particular variable in my app.
So for instance, a variable a has a separate value for every user of the app, is it possible for me to display the average of the value of the variable in a Google Analytics dashboard ?
As per my understanding goes, we can do this using Custom Dimensions and Metrics.
I haven't been able to find any tutorial for the same.
I'd be grateful if someone could help me with a tutorial or point me to something other than the developer pages from Google.
Thank You!
UPDATE
Firebase Analytics is now Google’s recommended solution for mobile app analytics. It’s user and event-centric and comes with unlimited app event reporting, cross-network attribution, and postbacks.
Older Answer
You may use GA Event Tracking
Check this guide and this one to check rate limits before you try this.
Events are a useful way to collect data about a user's interaction
with interactive components of your app, like button presses or the
use of a particular item in a game.
An event consists of four fields that you can use to describe a user's
interaction with your app content:
Field Name Type Required Description
Category String Yes The event category
Action String Yes The event action
Label String No The event label
Value Long No The event value
To send an event to Google Analytics, use HitBuilders.EventBuilder and send the hit, as shown in this example:
// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
TrackerName.APP_TRACKER);
// Build and send an Event.
tracker.send(new HitBuilders.EventBuilder()
.setCategory("Achievement")
.setAction("Earned")
.setLabel("5 Dragons Rescued")
.setValue(1)
.build());
On GA console you can see something like this:
where event value is
and avg value is
If you want to track users with specific attributes/traits/metadata then custom dimensions can be used to send this type of data to Google Analytics.
See Set up or edit custom dimensions (Help Center) and then update the custom dimension value as follows:
// Get tracker.
Tracker t = ((AnalyticsSampleApp) getActivity().getApplication()).getTracker(
TrackerName.APP_TRACKER);
t.setScreenName("Home Screen");
// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once.
t.send(new HitBuilders.ScreenViewBuilder()
.setCustomMetric(1, 5)
.build()
);
It is possible to send additional data to Google Analytics, using either Custom Dimensions or Custom Metrics.
Custom Dimensions are used for labels and identifiers that you will later use to separate your data. For example, you might have a Custom Dimension that tracks log-in status. This would allow you to break down your reports and compare logged-in traffic to not logged-in. These can contain text; while AB testing your site you might set up a custom dimension with the options 'alpha' and 'beta'. They can also contain numeric values, such as the time '08:15', or a unique identifier that you've generated (although you should be careful to follow Google's advice here, lest you include PII and rick account deletion https://developers.google.com/analytics/solutions/crm-integration#user_id).
Custom Metrics are used for numeric variables such as engagement time, or shopping cart value. They are a lot like custom dimensions, but are intended to be compared across dimensions. For example, you could compare the shopping basket value of your Organic users to those who come in via a paid link.
If you wanted to calculate an average, you would also require a calculated metric. This takes two metrics you already have, and produces a third. For example, if you site was all about instant engagement, and you wanted to track the time before the first click event on each page, you could set up that event click time as a custom metric. But this would only tell you what the total is; surely more customers are a good thing, but they make that total go up! So you set up a calculated metric that divides this total by the number of page views, giving you a value per page viewed.
There's a great guide by Simo Ahava about tracking Content Engagement that includes instructions for setting up Custom Metrics and Calculated Metrics.
http://www.simoahava.com/analytics/track-content-engagement-part-2/
However, I should warn you that his guide uses Google Tag Manager, which greatly simplifies the process of adding such customisation to your tags. If you don't want to take that step, you will have to code it manually, as recommended by Google's support https://support.google.com/analytics/answer/2709828?hl=en
I am creating a java application to receive messages on pc using jsms API. Whenever a user sends a particular message to a no, it receives it and adds to the database, the phone number and the area/ region where it belongs.
The region can either be the area where the phone number is registered, or it can also be the current location of the device. Either of these information will help me.
I would be really glad if any one could any one guide me on how to proceed with finding out the region using java code.
Note: I'm not looking for the country. I'm looking for the state/ region. Preferable Indian states.
You could try out libphonenumber. It basically defines the region based on the number.
There is a JavaScript try page here you could perform some tests.