Google Goggles via IntentIntegrator Works But No 'Capture' Button - android

I've done some research (Stack Overflow and on the web) and see that there are some other questions about Google Goggles and the possibility of using it with Android; via an Intent. I realize it is not officially supported and that we are all still waiting for Google to open up the API or provide us the functionality to easily use it in our apps.
That said - I would still like an answer / some clarification on the following, if anyone can help?
Referencing this question: zxing intent "google goggles" doesn't recognize barcodes
It is answered that Google Goggles does decode barcodes, which indeed it does... so in my app I am calling to the latest version of the Google Goggles app via the IntentIntegrator:
https://code.google.com/p/zxing/wiki/ScanningViaIntent https://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java
This call via the IntentIntegrator successfully opens Google Goggles in scan mode (of sorts), however there is no 'Capture' button displayed on the UI, it is hidden / unavailable ... so it is not possible to take a shot / capture any image, to see if the callback with result to my app works.
So my thoughts are:
This just isn't supported and the button is disabled because of the way I called to open Google Goggles?
I've done something wrong in the way that I am making the call?
The latest version of Google Goggles disables this functionality that used to be available in previous versions?
Other?
Code sample of how I'm making the call to open Google Goggles below. Also another way to do the same thing is included, but commented out for reference.
// Try and open Google Goggles for scanning
try{
IntentIntegrator integrator = new IntentIntegrator(getSupportActivity());
integrator.initiateScan(IntentIntegrator.TARGET_ALL_KNOWN);
//Intent intent = new Intent("com.google.zxing.client.android.SCAN");
//intent.setPackage("com.google.android.apps.unveil");
//startActivity(intent);
}catch(Exception e){
Log.e(ScanFragment.class.getName(), "onViewCreated > Error creating scan Intent to Google Goggles: " + e.getMessage());
}
//>
Any help on finding out more on this would be greatly appreciated; thanks.
// WildStyle

Yes, I am actually not sure Goggles supports this Intent anymore. It is not in the list of apps that will be targeted by default. So I don't think you are opening Goggles if you are using IntentIntegrator; you are opening one of the Barcode Scanner apps. They don't have a capture button, you just bring the barcode into view.
If it's really opening Goggles, maybe it was previously set as the default for this Intent and that is taking precedence. Try clearing application handler associations in Settings.

Related

Add Google Assistant routines from my app

I'm trying to develop an interactive "allspeech-based" application and I have found some troubles.
I would be able to do every task of my app without the touch input, only the voice one.
So, my idea was to use Google Assitant to open my app, and then execute tasks with Activities "allspeech-based". My only problem is open my app with a custom phrase like "Hello myApp".
I've noticed that Google only permit to define in Manifest in which developer can set predefined method like SEARCH_ACTION (I have to say "Serch cats in myAPP..."), ... and not custom action!
Then I had an idea: to resolve this I can define a new routine in my Google Assistant where Command is "Hello myApp" and action is "Open myApp", and it works!
But I don't want to force my users to add a new tourine in their Assistant, I want to do it from my app automatically at the first opening of my app (throught an Intent and a startActivity or something similar idk).
My question is: How can I do? Which Intent I have to invoke? With which extras? Is it possible?
Please answer, thank you.
There's no such intent which can directly create a new routine.

get results from google maps intent

in my android application I want the user will be able to choose some location and to get this location back to the application code.
something like startActivityForResults.
Does it's possible?
I know that it is possible with all the google service sdk and all of this,
but I want to use only the content intent, like described here:
https://developers.google.com/maps/documentation/android-api/intents#overview
and here (in the maps section):
http://developer.android.com/guide/components/intents-common.html
thanks a lot.
There is no requirement for an Android device to have an app that does what you want. There is no standard Intent structure for this, either.

link to publisher in google play not working

In my native android app i have a "more apps" button which I want to link to all my apps on google play.
I'm following this link: http://developer.android.com/distribute/tools/promote/linking.html#UriSummary
As per the documentation in the link above, i used this query: market://search?q=pub:publisher_name. For publisher name i used my name without the brackets. BUT when i run the app and click on the "more apps" button, the google play store app opens and shows this message:
No results found for "pub:my_name_here"
If i remove the "pub" the url like this:market://search?q=publisher_name
then it shows all my apps. But the problem is that along with my apps, other apps are also being shown which match my surname. Not sure how to resolve this. All i want is to link to only my apps on google play.
I tried searching on Google, StackOverflow but did not find the solution. I tested this on Galaxy Note II. Not sure if it is a device specific issue. Has anyone come across something like this? Thanks!
Just to add to this, I also had this issue and found that adding quotation marks around my developer name solved it.
Instead of this:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:Liam Cottle"));
Change it to this:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pub:\"Liam Cottle\""));
The Google Play store app will only show results which match the quoted name exactly... Well, that's what I found anyway.
We have the same issue and the old link used to work up until now.
The workaround so far is to use
Intent marketIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://play.google.com/store/search?q=Vendor+Name"));
startActivity(marketIntent);
This works, but this is triggering the open with window and it also requires us to update every single app.
Edit: The provided answer by Liam does not work as this is the exact link and quotation we have been using for years, which just recently stopped working, the only working solution is using the web link above.

Security Exception with Google Drive and ACTION_GET_CONTENT

In my app users may import sounds, videos, images and other files.
The import is done using standard Intents, and the result handed in OnActivityResult
I am experiencing a security exception when trying to import files from Google Drive on my 4.2.2 tablet, files from other sources such as Dropbox, Onedrive, Gallery etc are all working OK.
Importing from Drive works fine on my 4.4 tablet.
The intent code looks like this:
Intent intent = new Intent();
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, getString(R.string.title_dialog_selectphoto)), SELECT_PICTURE_REQUEST);
Then in my importPhotoFromUri(uri) method I try to open the uri as an inputStream:
...
InputStream is;
try {
is = getContentResolver().openInputStream(uri);
....
At which point I get a Security Exception:
java.lang.SecurityException: Permission Denial: opening provider
com.google.android.apps.docs.sync.filemanager.FileProvider
from ProcessRecord{216d9060 18832:com.app.app/u0a10153}
(pid=18832, uid=10153) that is not exported from uid 10179
I've found a few posts that seem to refer to a similar problem from a while ago:
Google Drive + ACTION_GET_CONTENT
File View from Google Drive Android Intent
https://productforums.google.com/forum/#!topic/drive/siSKHXdE-ao/discussion
But none of these appear to have a solution, other than perhaps re-implementing the Google Drive Integration myself using their API. I'd rather avoid that and keep the user experience simple though.
From the exception tracking in my Google Analytics it looks as though this issue primarily affects users running 4.2.2 devices, I see only 3 security exceptions from other Android versions.
I also see virtually no Security Exceptions prior to May 9th (2014), which is also the date that user igorcard made his comment asking about the same exception on this answer:
https://stackoverflow.com/a/18298298/2214992
The last update to the Google Drive App on my 4.2.2 device was on the 8th May
I've also been able to observe the same problem in other apps, by trying to load images from my Drive, not just in my own app.
My question then is, can I implement the drive integration another way, without dramatically changing the User Experience, or am I left with just handling the exception and putting up an apologetic Alert Dialog?
Also, has this been broken by the recent update to Drive app or are the timings of the Drive update and the occurrences of this exception in my analytics just coincidental?
I had the same problem. The exception is thrown because there is an export false in Google drive manifest to manage the get content intent. It's unreliable to use it. At the end I used Google Drive API and in detail you can see newOpenFileActivityBuilder() method an example docs

How to post message on twitter wall using twitter integrate android app

I would like to integrate Twitter into my Android application so that I can post messages to Twitter.
It really depends on how you want the interaction to work. You can:
Use their API (helped by a library such as twitter4j, as suggested by Heiko Rupp), or
Find a way to integrate with the Twitter app, although there is no published protocol for this as far as I know. This is also not a good idea because many people use other apps such as Twidroyd, TweetDeck and so on, but it would definitely be cool, or
If you don't expect the user to do this very often, you can just open up http://twitter.com/?status=<what-to-tweet> using a simple intent.
Method 3 can be easily described here:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://twitter.com/?status=" + Uri.encode(message)));
startActivity(i);
You can also combine 2 and 3. You can try a few known apps (official Twitter, TweetDeck, ...) and if all of them fail (because they're not present or because they have been updated and broke the protocol) you resort to opening up the browser.
Also note that it might be possible for method 3 to actually launch an app instead of the browser (or at least give the user a choice between the two), if the app handles the correct intents.
Another thing worth mentioning is that it's very possible that you will not be able to integrate with any Twitter apps. What I've said here is purely hypothetical, I have no idea whether these apps support such integrations. You should consult each app and see if they expose some intents that you could use. If they don't, you can still hack around a little and you might find them, but that will be unreliable because they will most probably break after a couple of updates.
You could use the twitter4j library to talk to twitter. Since Twitter has changed over to oAuth, the initial authentication is not trivial.
Basically you need to register your app with Twitter (go to your profile and then to the developer page to register your app - you will then get consumer token+secret). Then follow this example to authenticate with Twitter.
You may have a look at Zwitscher (rev 0.65, code of oAuth has not been updated for the nw internal changes after 0.65), which is an open source Twitter client for a larger example.
You may have a look at one of my examples of how to get Sign-in with twitter working on android.
It uses twitter4j, and with slight modification, you can make it post tweets too!
find it here.
UPDATE: there's one question specific to this issue: twitter,update status
I use twitter4j and oauth-signpost to create facebook like oauth authorization (webview dialog). Checkout this post
You can send the appropriate Intent to start the default twitter application
You can do this without Twitter4j, thus avoiding the massive headache of implementing the OAuth flow.
String tweetText = "We be tweetin!";
String url = "twitter://post?message=";
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url + Uri.encode(text)));
startActivity(i);
} catch (android.content.ActivityNotFoundException e) {
Toast.makeText(this, "Can't send tweet!", 2).show();
}
Other supported twitter:// urls are listed here.
If the user has the Twitter App installed on their device it'll open it directly to a share view. When cancelled or shared it'll return direct to your App. Super simple. Similar to how iOS handles sharing now (with Facebook and Twitter integration).
This doesn't handle cases where the user uses another App as their primary Twitter client.

Categories

Resources