I have implemented an in app subscription in Android, it all works fine, I even have a 30 day free trial to begin with.
I have a referral feature in the app, so when a certain value in the database reaches 10 (i.e. 10 referrals) - I want to give the user a free 30 day subscription.
I have had a look around and think deferring the subscription by the desired amount would the solution. However, I have no idea how to go about this. The api docs dont seem to be Android-specific, and I cant find a proper tutorial anywhere. Any help massively appreciated.
Already tried looking at the docs - https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/defer
Do I just make the http request listed there? I was hoping for a nice in-built call I can make.
I simply wish for:
when a certain variable == 10, to defer, or increase the subscription length by 30 days.
Cheers mate.
Currently this is the only official way to do it. You may try to find some third party library on github, but I would not count on it.
I would recommend you to use Retrofit and create this call by yourself.
Maybe in (the) future Google will include this method as a default one in its billing library though - we just have to wait)
Hope it helps, mate.
Related
I was trying to make a fitness app and I wanted to use Google Fit, I watched the code samples they provided in the documentation and managed to get the step count per day, but now I would like to make my app to register the starting time and end time between which the use ran. I really did not understand too much from the Sessions API, because I think that is the solution. Can anyone please help?
Have you checked the following example? This is pretty much what you are after i believe
https://github.com/googlesamples/android-fit/blob/master/BasicHistorySessions/app/src/main/java/com/google/android/gms/fit/samples/basichistorysessions/MainActivity.java#L227
I want to upload my application data to google drive.So I have to integrate Google Drive into my application, but I can't find any proper solution or source code for do that thing. So please if any one have full code of how to use Google Drive into android application than please help me.
First, a bit of critique. If you ask a question this way ('show me the magic trick'), it will get promptly down-voted, purged. It only shows you did not do your homework.
The other possibility is that you are starting and being totally lost (been there). If this is the case, let me give you a direction:
Study the 2 APIs available to Android, the REST Api and the GDAA. They do essentially the same thing, the selection very much depends on your app's needs.
Make decision which one to use. Pay special attention to the fact the GDAA supports only FILE scope, limiting the files/folder your app can see. Weight advantages/ disadvantages.
Study / play with the demo code for the API you selected. The links are in the docs you already studied (point 1 above). In case the official Google did not meet your needs, you may also look at the basic CRUD implementations of the 2 APIs here(REST) and here(GDAA)
As you'll see, you are weeks away from getting anywhere. And don't count on anybody here to do the work for you.
Good Luck
I have been trying to implement google in app billing lately in an android application and today i witnessed something strange. I have an app witch sells non consumable products,more precisely a kind of information. Now the need is for having more than 150 products and when i query google for product info it seems that google does not respond to my request , i waited nearly 5 minutes and set a dialog which gets dismissed when google responds and populates an adapter which populates a spinner. Now i read somewhere that queryInventoryAsync can't deal with lists more than 20 items long,sorry about not having the link but I lost track of it searching all over google to find a solution or some explanation or a possible scenario to which i can refer. So my guesses are:
queryInventoryAsync cant handle 20+ items long lists
maybe it is the adapter that cant handle it
maybe the spinner would be better to be replaced by a ListView
or something else
I thank you in advance for any kind of effort. Good job stackoverflow comunity, thank you for being a place to exchange knowledge and share it. :)
So i hardcoded it and experienced it myself , i tried to send a query with a list with 20 elements and queryInventoryAsync responded, but with a list of more than 20 elements exh:23 it didn't. So now i am searching how to send subsequent requests to google while I split the list in parts if the original list has more than 20 elements. Help is needed , running out of ideas.
I fell foul of this issue as well, or at least something very similar. The patch in this answer fixed the issue and allowed me to query more than 20 SKUs.
Also, if like me you are using the *.utils helpers from the Google Play Billing Library and installed the package from the Android SDK Manager, then you may fall foul of issues like this. You should update the *.utils files from the Google marketbilling repo, making sure you merge the changes from the answer above.
I hope this helps you out.
I'm seeking more an advice on where to go next, rather than how to do it.
I'm developing an augmented reality Android game as a student project, and I've stumbled upon a problem. Four phones have to know each other's position and show it on a map with time steps (it should not be really realtime, for the sake of the game). Besides that, the players should be notified when one of the phones/players gets to some location, or does something.
I wanted to do it with a PHP service, where each phone would check in a couple of seconds for the positions of the rest (all by JSON), send it's position and that's it. Quite simple, but I'm afraid that there will be a lot of desynchronisation and unconsitent data as the game progresses. Since the phones don't start at the same second as everyone signs in. Also, I'm not sure how to do the events this way (for example, one of the players can cloak and his position should not be updated anymore in the next x seconds), or get to a location, or what items are still on the map (players can "pick up" items). Someone will know earlier than the others.
This really calls for a push-like solution, but I'm not really familiar with C2DM, and it seems to me that using it is a real overhead in development, and I need a C#/Java or similar server as PHP certanly can't push to the cloud (or can it?). I know C# and Java, but it takes more time as I need to solve threading and so on. Can C2DM even be used for this?
Basically, I'm seeking thoughts of more experienced developers, what is the best solution here for sync? Is there any way to remedy the problems with PHP and periodic checking the server or should I continue with the cloud service and a more complicated server?
Sorry for the long explanation :) .
Sorry that this isn't simpler but I've encountered pretty much the exact same problem in my own app and there is no way to avoid this, you need;
a server with a REST API to manage and distribute data
a way to set up friends / groups
a way to push data
Google Cloud Messaging really isn't that much trouble.
Check out the Google IO 2012 code, they've made use of it there with not much code.
http://code.google.com/p/iosched/source/browse/
What you really need to build is a rest api with quite a few functions for being able to identify devices and set up these groups of friends. I would suggest using Facebook integration for establishing a friend network.
https://developers.facebook.com/
And there are infinite ways to set up the REST API, but the fastest I've seen was released this year at google IO and thats Google AppEngine EndPoints.
http://devthots.blogspot.com/2012/07/building-awesome-android-apps-with.html
Give Comet a try, it's all about http requests
What I want is to access the time (in milliseconds) that each application is used.
Thanks
Dig up the source to "Spare Parts" and see how they do it
(also copy it off the emulator, install it on your phone and make sure it works)
Note: while this remains accurate for the circa-2010 versions of Android about which it was written, restrictions added years later in 4.4 and 5.0 would substantially frustrate achieving this in more recent versions.
You could use TraceView. Did you mean by programming?
By Programming, You can check out how SpareParts does it.
#João Lopes,Chris Stratton
Google Provide the sample code for AppUsageStatistics Sample
Here full of statistics base on daily weekly monthly usages.
Firebase Analytics has a cool feature where it tracks the average time on each screen and the percentage of which screen is used most often.
Is this is good enough for you, I would suggest adding Firebase to your app, as it has a free plan, and it will automatically track your users' time. You can start here
Hope this helps
you can try to use FireBase Analytics.