Android/Ios in-app billing. unique ID - android

i made a cordova 3.3 app for Android and Ios, and i want to sell a premium version that permit to save settings and data for every on my distant database for an easy recovery if they change their phones.
Initially i thought to get their google/apple account email but it seems to not be possible.
So i thought that i just need an unique ID from the item purchased that i should use as an userID on my distant database.
I use this plugin for android:
https://github.com/poiuytrez/AndroidInAppBilling/tree/master/v3
So, the inappbilling.buy(success, fail, productId) and inappbilling.getPurchases(success, fail) both return a json object like this ex:
{"orderId":"12999763169054705758.1385463868367493", "packageName":"com.example.myPackage", "productId":"example_subscription", "purchaseTime":1397590291362, "purchaseState":0, "purchaseToken":"ndglbpnjmbfccnaocnppjjfa.AO-J1Ozv857LtAk32HbtVNaK5BVnDm9sMyHFJkl-R_hJ7dCSVTazsnPGgnwNOajDm-Q3DvKEXLRWQXvucyW2rrEvAGr3wiG3KnMayn5yprqYCkMNhFl4KgZWt-4-b4Gr29_Lq8kcfKCkI57t5rUmFzTdj5fAdvX5KQ"}
Can someone confirm me than orderId is strictly unique on android? (with source link or proof pls) ?
I will have the same issue on Ios, so do you know a if a value will can make the deal on Ios? I can't see the return value of the restore function in this plugin:
https://github.com/j3k0/PhoneGap-InAppPurchase-iOS
If it's ok for both, i could regist an ID like this :
"android_" + orderId
Or
"ios_" + ???
as user ID

Ok i found the answer on the ref... sorry.
http://developer.android.com/google/play/billing/billing_reference.html
"orderId : A unique order identifier for the transaction. This corresponds to the Google Wallet Order ID."
So i think it's ok for android. i will look on the Ios ref.
If you think about better idea for my case, feel free to add another answer.

Related

Get unique ANDROID_ID on flutter is it possible?

I would like to get the unique device id on android with Flutter.
I've tried this plugin device_info but it doesn't return the ANDROID_ID that I get in java Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
how can I get the same id?
In this case it might be simpler using platform specific code and a Flutter platform channel setup.
You can then use your Java code as included in your question and pass the Android ID to your Flutter application via a platform channel when needed.
See Writing custom platform-specific code with platform channels .
You can do what you did, but it is not reliable or guaranteed. Please read up on:
https://developer.android.com/training/articles/user-data-ids
for best handling of unique IDs.
Of course you can get the phone network ID, but what if that device doesn't have a carrier.
You could get the device ID, but what if it returns null for that manufacturer.
You could get the Advertiser ID, and this is often recommended, but it CAN CHANGE, it is unlikely to change, but if they do a factory reset or anything like that, it would.
So your best bet might be to generate your own unique IDs and store them locally with the application either in a DB implementation or SharedPreferences.
So to answer your question, if you have existing audience that you used the wrong, bad practice way of using unique IDs, then you should make an ID factory with if/else logic to fix it.
If (first time accessing an ID for this installed application)
//createOne and store it
else if(ID already exists and matches ANDROID_SECURE_ID method)
//get it the old way,
//create new one, and update your access to APIs or DB with new associated ID so that you never hit this code path again
else
//use correct ID implementation that you created
You could also just as easily do a one time check in your Application onCreate to fix anyone with wrong ID and then set a flag that you fixed it so you don't fix it again in sharedpref.

How to make api.ai agent learn something dynamically?

I am currently using api.ai , to create agent to perform specific tasks, but one question i don't have answer to is , can i make it learn something while chatting , mean that i speak my name is 'John Cena' and she should store it and then whenever i ask her again bot should answer me that. i know there is a way to do it by logging into api.ai web and manually add entries , but it will not help, is there any work around programmatically or automatically ? the file i've been using to practice is given in github . and here is working DEMO
You basically need for your bot to "learn" facts. There are many different ways to achieve this, but recently the most common way is to arrange knowledge into Semantic "Triples" and store the knowledge into a Graph repository (like Neo4j, Titan, Spark Graph, etc). In your example, "my name is John Cena" would translate into a Triple like ("anubava","Name","John Cena"). That way, the next time you are logged in as anubhava and ask "What is my name?", it would translate into a Graph search that will return "John Cena". A word of caution, achieving this is not trivial and would require some significant amount of fine tuning. For more info, you can check here and here.
Finally, most complete solutions (that I know of), are Server Side solutions. If you want for the whole knowledge base to reside in your mobile device, you could probably use the resources there as inspiration, and build your own Linked Data repository using an embedded database.
Hope this helps. Good luck.
To store and recall the user's name, you'll need to set up a webhook with some basic data persistence capabilities. Any database or key-value store would work fine.
Here's the breakdown:
Implement webhook fulfillment for the intent that captures the user's name. The webhook should store the name along with a unique, identifying ID that you should supply from your front-end in either the sessionId or as a context parameter in your call to /query.
Implement webhook fulfillment for the intent that reads the user's name. The webhook should look up the name by ID and return a response that tells the user their name.
The high-level docs for writing a fulfillment webhook are here:
https://docs.api.ai/docs/webhook

How do mobile games store and retrieve unique user data

I'd like to know how some games such as LINE Bubble or whatever store user statistics and game data, ect.. I'm guessing it must be with php and sql or something like that, but can someone be a bit more specific? Since some of these games don't require direct input of usernames and don't use passwords how do they know the correct data to retrieve? Do they use the phone number or some sort of device id that the mobile os provides?
Thanks!
Each OS provides a unique identifier to the user, one way or the other.
To get a unique identifier for iPhone, see this answer https://stackoverflow.com/a/22937460/1891327
For android you can see this
https://stackoverflow.com/a/2785493/1891327

Get unique Id for the current user

How can I get a unique Id for the current user who is using my application?
I don't want to retrieve the device UDID (for my users privacy concerns).
I saw once that in the latest API versions (4.0+) there is such method to generate a unique
id for the current android user, but I cannot find it now.
This is the official statement from Google
http://android-developers.blogspot.be/2011/03/identifying-app-installations.html
You should really read it.
I guess you are using some kind of backend, so maybe you can create an endpoint that return a unique token that you save in the shared preferences.

How to best add a comment/rating system to an android app

I already published an android app where you can see a list of specific objects and detailed informations about them. The list changes every day but some of the objects can appear again.
The application is communicating with a PHP server over HTTP and periodically pulls the list of objects.
I now plan to extend the app to make it possible to rate the objects and add a comment similar to how it is done in the android market. I'd like to avoid forcing the user to sign up for an account for being able to comment.
I see two problems:
The comment-system could be abused by spammers
A comment could be added from another system
So my questions are:
How to protect the system from spam?
How to authenticate the application with the server?
How do I limit the number of comments to one per user and object?
What about the androids device id? Is it unique enough to use it as identifier for the user?
Which other problems do you see?
2020 Commenting/Rating/Reviews Options
Since Socialize is out, here are a few options you can explore:
Build your own comment/rating implementation. Personally I love reddit and how it handles nested comments and ratings. Here's a library I found that implements it beautifully. Please note you'll need to tie this with a cloud-database. This is based on groupie. Article & implementation. Many ways to do this - https://stackoverflow.com/a/59472206/668240
Disqus - SDK's coming soon to iOS and Android.
BazaarVoice - commercial
Social Networks SDKs like Facebook, Twitter, etc. Personally I dislike this as we'll need to authenticate users with respective networks to use the APIs. It's like we are shipping off users of our apps to social networks. If you don't have a problem with that - then it might be for you
Legacy Option in 2014:
You can try out Socialize SDK which is open-source and a really good SDK for the rating and commenting you are looking for. It already has a well-functioning Commenting system built-in along with a 'like/love' facility and sharing to FB and Twitter. Each 'entity' (object in your case) can have metadata associated with it. So all you have to do is construct/use a rating widget, then send that rating with the entity attached to your object. To display your rating/comment is as simple as retrieving them from Socialize.
Each object (element from your app) should be associated with an entity which has a unique key in the form of a URL - sort of like a primary key to recognize your items. This entity can have meta-data - any data that you can insert on behalf of your object. Once you do that, you can retrieve that metadata any time you want.
I've been using Socialize for around a year now. They've matured over this period and are always aspiring to be the best at what they do.
Look at the Socialize Bar at the bottom. Its can be customized to your needs.
What's more - Socialize is free.
As for your questions:
There is comment moderation built into the Socialize Web Component
where you can filter out anything you feel is out of place.
Socialize allows you to authenticate through Facebook and Twitter.
Limiting to one comment per user can be achieved by using their User
and Comments API.
Socialize has both Anonymous authentication as well as Social A/c
authentication. I believe you can remove anonymous auth. So that
ensure that every user is authenticated before rating/commenting.
For authentication, you could use OpenID like StackOverflow does or Facebook authentication. Once you have them authentication, it shoud be easy to limit the number of comments to one per user per object. As far as spam, you could follow StackOverflow's model and allow users to vote comments up or down or flag as spam. Perhaps users with comments that have been voted up would have more power and be able to flag comments as spam.
You'll need some sort of rate limiting. I've used this one in this example before.
So you need a table with the user's ID and how many api calls they have left, and then when their last api call was. Then use the algorithm to update the values in the table every time a method is called.
Read through this, I think it should be possible to create an UUID for every case:
http://android-developers.blogspot.de/2011/03/identifying-app-installations.html
And then keep a hidden api key which is hard coded, or at least get's everytime calculated the same or in enigma style influenced by the time it is used. But you will be never be sure, that it won't be find out by crackers/hackers and maybe abused, you will always have this Problem.
Authenticate with the UUID of the user + api-key.

Categories

Resources