Android autofill service save request on sensitive data - java

I'm trying to give the user the option to save their passwords after registering on a website, using the autofill service provided by android.
List<FillContext> contexts = request.getFillContexts();
AssistStructure structure = contexts.get(contexts.size() - 1).getStructure();
ParsedStructure parsedStructure = ParsedStructure.parse(structure);
parsedStructure.getPasswordView().getText().toString()
This code is in the onSaveRequest method of Android's AutofillService.
When I log the last line, the text in the console only contains asterix characters and not the password itself. Does anyone have an idea why that is and an solution for that?

AS most of the browsers are in Compatibility mode and do not support the native autofill api yet.
Read more at the android documentation.

Related

Multilanguage # Server API + Android Application

I have Android Application which are supprting multilanguage (Russian & Latvian), no questions to this.
Problem is, that my backend is on CI and I have some definied Strings (mostly technical), example (Russian):
define('ALL_CAT',"Все категории");
define('NO_DATA',"Ничего нет.");
And if Application is in Latvian, then I will in any case see this Russian strings.
Is it possible somehow translate Backend CI Api Strings?
(Or, move all API string to client and show them from client - if this possible, idk)
PS: Also I have no saved Language on client side. It means if User open Application and select Latvian, use Application on Latvian, but when application closed/reopened user must select Latvian again ;-)
Thank you in advance,
Yes. The solution is to send a placeholder instead of russian.
define('ALL_CAT',"placeholder::ALL_CAT");
define('NO_DATA',"placeholder::NO_DATA");
Then, whenever your client encounters a placeholder string:
String recieved = getStringFromServer();
if(recieved.indexOf("placeholder") == 0){
recieved == //rusian or latvian.
}
You translate that placeholder string with a lookup table. You can define that lookup table in a file in your app, or in a database on a server somewhere.

How to use online API in java web Application

I am working on my college final year project and ive been developing a project in which ive to use any text to speech online api. My project is servlet and jsp based web application but i dont know how to use the API in my code. Can any one help me.
I have seen a free TTS Api such as http://www.voicerss.org/api/documentation.aspx.
Using Fluent HC:
String key = "..."; // your API key
byte[] mp3speech = Request.Get("http://api.voicerss.org/?key=" + key + "&hl=en-us&src=I+am+very+lazy+student.").execute().returnContent().asBytes();
// do anything you need with the result

How to retrieve from Azure mobile services using android studio

I am new to Android and Windows Azure. I have successfully inserted data from Android application but how do I retrieve single data and post that data on a TextView?
The read function after the gettable class is also not working. What is the exact function use for it? I have followed these instructions but they did not work for me, also I do not understand the documentation.
Currently, I just can provide some tutorials about how to use query data from azure database. I recommend you can refer to this official document about how to use Azure Client Library using Java: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-android-how-to-use-client-library . You can focus on two part: “how to query data from a mobile service” and “how to bind data to the UI”.
At the same time, you can view this video from Channel 9: https://channel9.msdn.com/Series/Windows-Azure-Mobile-Services/Android-Getting-Started-With-Data-Connecting-your-app-to-Windows-Azure-Mobile-Services.
The sample code project of this tutorial, please go to the GitHub link https://github.com/Azure/mobile-services-samples/tree/master/GettingStartedWithData .
For the ‘getTable(Class )’ function is not working, please double check whether the class name is same as table name. If they are same, you can use it like below:
MobileServiceTable<ToDoItem> mToDoTable = mClient.getTable(ToDoItem.class);
If not, you can write you code like this:
MobileServiceTable<ToDoItem> mToDoTable = mClient.getTable("ToDoItemBackup", ToDoItem.class);
For further better support, please share more detail about your code snippet .

Java Program and YouTube API

I'm trying to write a program that checks if a user uploaded a new video. I wanted to make it a backend job that constantly checks a users most recent video and then send a push my users utilizing my application. Is there any documentation or sample code on this matter? I haven't the slightest clue where to start.
The simplest way I found is via RSS feed. Simple to parse. Simple to get it going. Begin checking this out:
https://www.youtube.com/t/rss_feeds
To PARSE the RSS in java, use Rome: https://github.com/rometools/rome
Download YouTube's Java API and then use the code they provide:
String feedUrl = "http://gdata.youtube.com/feeds/api/users/GoogleDevelopers/uploads";
VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
printVideoFeed(videoFeed, true);
This is for version 3, which is the latest they provide.

OBJECT_NOT_FOUND when trying to getServingUrl of an image stored in GCS

I have written a Servlet where I am reading an image from blobstore, another image from GCS and then after applying a composite on both these images I am storing the composite image back in GCS.
My code works well till here.
After that, when I am trying to get the serving url for the composite image, I am getting an OBJECT_NOT_FOUND.
Just to experiment I manually uploaded a image in GCS and gave all the necessary permissions. Added the serviceaccount as OWNER and gave READ access to All users. And then again I am just trying to get the serving url. Following is my code:-
BlobKey newImageKey = blobstoreService.createGsBlobKey(gcsPath);
//log.severe("GCS PATH: " + gcsPath + " BlobKey: " + newImageKey);
ServingUrlOptions options = ServingUrlOptions.Builder.withBlobKey(newImageKey);
String profilePicLink = imgService.getServingUrl(options);
I also tried the below code:-
ServingUrlOptions options = ServingUrlOptions.Builder.withGoogleStorageFileName(gcsPath);
String profilePicLink = imgService.getServingUrl(options);
And in both the cases this is the error that I am getting:
/controller javax.servlet.ServletException:
java.lang.IllegalArgumentException: OBJECT_NOT_FOUND:
Btw, I have not enable billing as I am using the default bucket with the free quota. This is still in development so the free quota works for me.
OK, so I found out where exactly the exception is happening...
byte[] responseBytes = ApiProxy.makeSyncCall(PACKAGE, "GetUrlBase",
request.build().toByteArray());
and the exception it is throwing is :
ApiProxy.ApplicationException Application Error 8
Enabled billing and tried, still of no use :(
Have been trying to solve this the whole day and tried to search a solution everywhere.
Though this actually does not answer my original question but I have found a workaround. I installed python and gsutil and set the default acl of my bucket to read. Now when I am saving an image file in GCS I am just showing the public url link.
The above can also be achieved if in the GCSFileOptions we add .acl("public-read").
Once the acl is applied by either of the above two methods, in the GCS cloud console you can see the images shared publicly link check box comes as a dash and it says you do not have permission to edit permissions. I was getting confused seeing it, as I was expecting the checkbox to be checked.
But even in the above scenario the publicly shared link will work which is:-
http://storage.googleapis.com/[bucket_name]/[gcs_object_name]
I would still appreciate if someone can explain why the getServingUrl is not not working. Yes, it is still not working after set default acl to read.
Thanks,
Sukalpo.
I could not reproduce this issue by either uploading to Google Cloud storage via the console or via the App Engine GCS Java client. In both cases I could create a public URL for the image
even without specifying any specific permissions.
Do you want to create a production issue request,
https://code.google.com/p/googleappengine/issues/entry?template=Production%20issue
, so we can get more details about your specific case?
What is your gcsPath? I have to use:
"/gs/" + gcsFileName.getBucketName() + "/" + gcsFileName.getObjectName();
Honestly, the only way I've run into this error (and run into this unsolved question) was when I was accidentally using the wrong filename in a difficult to notice way while fetching the BlobKey using Google's APIs.
So, check the obvious things first.

Categories

Resources