check billing (and blobstore) enabled from app - java

I was wondering if there was a way to check if billing/blobstore was available from within an app. I have tried to use the capabilities api for blobstore being enabled but it cannot tell if billing/blobstore is available.
Basically I want to know if the app place I'm delpoying to is setup for free or billing (and subsequently blobstore) from within a java app.
P.S. I have tried catching the exception com.google.apphosting.api.ApiProxy$FeatureNotEnabledException which appears to be thrown in app's logs but it does not catch it (or any exception), but simply shows a error page.
Thanks,
Steven

Fixed by adding a filter which just tries to access the blobstore service in any way and catch exceptions.

sorry, i don't believe there's currently any way to programmatically determine if the current app has enabled billing or not. the capabilities api is intended to handle when services are down for maintenance system-wide, not available per app.
the one thing you could try is programmatically authenticating to the admin console, using either ClientLogin or OAuth, and fetching its billing page.

Related

Api Integrity Issues

I am migrating my app from Google play safety net api to Integrity api, but getting below error from api-
When i using setCloudProjectNumber(idProjectNumber) retrieve :
Integrity API error (-8): The calling app is making too many requests to the API and hence is throttled.
Retry with an exponential backoff
when i remove setCloudProjectNumber(idProjectNumber) retrieve :
Integrity API error (-12): Unknown internal Google server error.
Retry with an exponential backoff.
Please I need To know Why this error is retrieve
note :The app has been uploaded To Google play using SafetyNet
You most probably haven't set up the API in the Play Console. From https://developer.android.com/google/play/integrity/setup#apps-on-google-play, see "In the Play Console, navigate to the Release section of the left menu. Go to Setup > App integrity. Select the Integrity API tab to get started."
I think there is something of a rate-limit active for maximum API requests.
I have no knowledge about the Playstore services since a long time so is there any?

App Links on Android with the app not installed

I am trying to implement app links into my app to make sure that other malicious apps cannot register for my URL.
I read the guide on app links here https://developer.android.com/training/app-links/verify-site-associations.html and I have mostly understood it. But one thing which is not clear to me is how can I prevent malicious apps from receiving my domain links if my app is not installed.
Consider this scenario.
1. My app is not installed on the user's device
2. Some malicious app is and it knows the URL that my app handles
Wouldn't this launch the malicious app and it can intercept my URL if the user selects that app from the disambiguation dialog? Is there any way to prevent it?
I understand that android:autoVerify="true" will trigger the domain verification when the app is installed, but what if the app is not installed?
Whether the user has the app installed or not, the "illegal" app won't be able to handle your links since it has not access to your domain in order to save there the needed JSON file. Am I clear?
There is a JSON file that is required during App Link configuration, that has to be uploaded to your server (that includes your app ID), through which your web-app basically says to the Android OS 'this is my counterpart on Android devices, I authorise it to handle these URLs'. Since app IDs are unique, there is no way another app can meet those conditions.
To quote the docs:
An Android App Link is a deep link based on your website URL that has
been verified to belong to your website.
So, although an app may register an <intent-filter> it ALSO has to be verified by the website whose URL it's trying to handle. And this happens on the server, so, out of the reach of a mobile client.
See also HERE for a more detailed explanation.

Send message to my Whatsapp from Java Client

I have a Java project and I would like to get notified of certain runtime events by receiving a message in my personal Whatsapp account. I was wondering if this is even possible and if so, how can I accomplish this? Is there an API or Java library that I should be aware of?
Thank you for your help.
WhatsApp Inc. doesn't allow sending messages programmatically for personal accounts. But WhatsApp has started taking requests for business accounts in which they might allow certain programming features like integrating with your own code for sending messages etc.
I had once written a program using selenium to send message via WhatsApp Web. It worked perfectly fine. This was for experimental purpose only.
There are few 3rd-party libraries available but you run the risk of getting your number blocked. WhatsApp tries to detect if you are running such libraries. And if they catch then they will immediately block the mobile number.
Selenium method doesn't have such risk. Because you will be using WhatsApp Web only (via selenium).
For your application, the method suggested by #C-Sway is good enough.
You might want to look at Telegram as an application for this.
https://telegram.org/
AFAIK whatsapp will be tied to a mobile/cell number, which will hinder you from the outset, whilst creating your own private telegram channel to monitor automation on your site is very simple, they encourage bot use for this kind of thing and you'll find guides on how to create them below:
https://core.telegram.org/bots/samples
Additionally Telegram can be installed on any phone and the notifications are very reliable and customisable. Enjoy.

This app isn't verified This app hasn't been verified by Google yet. Only proceed if you know and trust the developer

Hi I have developed an web application using google app engine, for google shared domain contact, Its working fine when I am running it in the localhost but when I deploy that application into google app engine it showing warning screen before user conforming for consent(as shown in the image).
I am using 2 scope http://www.google.com/m8/feeds/contacts/ and https://www.googleapis.com/auth/userinfo.email. when I try to add a user information in the google shared contact I am getting a exception message as www.google.com. How can I resolve the problem? am i need to verify my application in the oauth_app_verification. Can any one solve this?
Thank you.,
You need to go through the verification process before you launch your app. This new process came recently to protect user's data. You can start the verification by submitting this form but before it is recommended to follow steps here

How to be made aware of incoming emails on GMail without frequent polling?

If I am developing an Android application, what is the most feasible way to get near real-time notifications about an incoming email? Is there a push-like mechanism, or can I hold my IMAP connection for a long time, or do I use IDLE command?
Consider that user is authorized to use GMail services via OAuth and I don't want to poll IMAP server madly.
Update:
I'm not using the phone's configured-in Google account. There is another account set up using OAuth.
I'm using Apache Commons Net to connect to IMAP/SMTP in my app. It's a bare-bone library for IMAP, but I can perhaps modify it to add IMAP commands/extensions.
You can register a ContentObserver with GMail, anytime something changes in GMail, the observer will be called.
contentResolver.registerContentObserver(Uri.parse("content://gmail-ls"), true, myContentObserver );
Override onChange in your ContentObserver to do stuff when something in GMail changes.
Since IMAP does natively provide any sort of push notifications and the Google extensions don't either, you have to implement it yourself.
One way is to use IDLE requests, which is still a cheap way to do polling. Of course, you can't expect your app to be running all the time, so you need to use a background service. An 'always-on' service is however an anti-pattern on Android and will drain the battery quickly and likely get you many 1-stars. Additionally the system may decide to kill it at any time. The other alternative is to use AlarmManager to start the service periodically, but starting it every couple of seconds or so is just as bad. So you are basically back to square one: polling.
The other way is to get push notifications using GCM or a similar service. This does require you to have a server, and the server needs to have the authentication info for the user (which might be a problem), but there are no real constraints concerning keeping open connections and sending IDLEs each second, etc. On the Android side, if you want to implement push yourself, you need to keep an open socket to get notifications. This is not very easy to do if you are not a system app (see above), so that leaves GCM. The connection it uses is manged by the system (Google Services framework), it can do things a regular app cannot, and you basically get it for free, since it's already there. It receives small pieces of data when there is something to do, called 'tickles'. Those in turn trigger broadcasts, Google Play updates, etc.
So, take your pick. Or just give up, register the account and use GMail and its labels Android API.
I'd check out Google Cloud Messaging (GCM):
http://developer.android.com/training/cloudsync/gcm.html
My understanding is that this works without requiring the user's Google account, and lets you handle authentication.
See a tutorial here:
http://www.techrepublic.com/blog/app-builder/implementing-googles-cloud-to-device-messaging/428
You would need additional server-side code running to do this though.

Categories