I'm pretty confused about what method should I use. OK here's what I'm actually trying to do:
User registers with my app need to upload multiple files/images
These files/images need to be uploaded to my s3 bucket
Uploading these files using presigned URL seems to be out of the question since I need to upload multiple files/images and it seems presigned URL is only good for a single file.1
I then look at AWS SDK for Java 2.0, and this seems what I need; however, when I read the [setup credentials][1] I become confused because:
It seems this will use the credentials setup in our OS environment. So how will my app use these credentials later when it's installed in other users' devices?
I have multiple AWS credentials profile in my OS. I'm still unclear on how to actually load my credentials profile, as it's not the default profile
So upon further reading the link, it seems supply credentials explicitly with
AwsSessionCredentials awsCreds = AwsSessionCredentials.create(
"your_access_key_id_here",
"your_secret_key_id_here",
"your_session_token_here");
should fit me the best. But if I put my access_key_id, secret_key_id in my app's strings.xml file, wouldn't it be a security issue?
1 FYI I have successfully implemented upload single image using presigned URL for another activity. I use retrofit which connects to my lambda function which then returns the presigned URL, and made another retrofit PUT request to the presigned URL
Related
So, basically I'm at step 1 of implementing App Links, I stumbled upon this tool:
https://developers.google.com/digital-asset-links/tools/generator
I give it my domain name, my package name, and I copy paste my App package fingerprint from the play store console. it generate an assetlinks.json file for me, I put it as required at https://my-domain/.well-known/assetlinks.json I test downloads, it works, then I ask this tool to test it, it says
No app deep linking permission found for package_name at my_domain.
my logs indicate that GoogleAssociationService came and took the file (200 status response and the correct number of bytes).
So basically I put the good values, it generates it, and then fetch it and tells me it's wrong, what am I missing ? how can he not be happy with what he generated itself ?
When we came across this issue we have also investigated logs of our proxy and have seen that the "assetlinks.json" file had been successfully downloaded.
In our case, the problem was with Content-Type. In our case, it was the "application/octet-stream" type. According to the documentation, Content-Type should have the type "application/json". We have changed the content type and everything started working as expected.
Check the requirements using the link above and verify that all of them are met by crossing off all potential reasons one by one.
Update 2022-10-30: The provided link is not available anymore. I have used a cached version to fetch the information below:
You must publish your JSON verification file at the following
location:
https://domain.name/.well-known/assetlinks.json
Be sure of the following:
The assetlinks.json file is served with content-type application/json.
The assetlinks.json file must be accessible over an HTTPS connection,
regardless of whether your app's intent filters declare HTTPS as the
data scheme.
The assetlinks.json file must be accessible without any
redirects (no 301 or 302 redirects).
If your app links support
multiple host domains, then you must publish the assetlinks.json file
on each domain. See Supporting app linking for multiple hosts.
Do not
publish your app with dev/test URLs in the manifest file that may not
be accessible to the public (such as any that are accessible only with
a VPN). A work-around in such cases is to configure build variants to
generate a different manifest file for dev builds.
I am trying to upload images to cloudinary from android and I am facing a lot of issues. I initialised the MediaManager like this in my onCreate method:
Map config = new HashMap();
config.put("cloud_name", "");
config.put("use_filename", true);
MediaManager.init(this, config);
and I am calling the upload method:
MediaManager.get().upload(filePath).dispach();
but it gives me the error:
java.lang.IllegalArgumentException: Must supply api_key
even when I am providing my api key and my cloudinary url under meta-data in my manifest file. I went though the git link for the image upload part and I am following exactly like it said.
What am I doing wrong here?
First, looks like you are using an old version of Cloudinary Android SDK.
Maybe you should try using the new one.
Regarding the deletion issue:
It's true that deletion must be done only via authenticated API (from your server) or with delete token.
In order to receive a deletion token in the upload response, add the return_delete_token parameter to the upload method and set it to true.
Now you can use this code to delete the image:
MediaManager.get().getCloudinary().uploader().deleteByToken(token);
Note that the token is limited to 10 minutes.
I am new to Android and am confused on what to put for the URL fields when registering a new client with the Instagram API using their web form.
I'm specifically confused as to what to put for these fields:
Website URL
Valid Redirect URIs
I am making an Android app and it doesn't have a website, so what am I supposed to be putting here?
In my search for an answer that made sense to me, I found this: http://oferei.com/2013/06/serverless-instagram-authentication/
In short, this is what one would need to know about how to fill these fields if they are registering an app that does not have its own website:
Website URL: it doesn't matter what value goes here, I used localhost
Redirect URIs: The article above specifies a custom URI scheme, but this is not supported w/ the Instagram API anymore. However, I did see that also using localhost would work here as well in this article: http://jelled.com/instagram/access-token
Not sure if that is the best practice, but it is a way to get the client ID for an Android app.
I'm making something like online journal app, that will download "journal file" from Google Drive (via shared link) once and will update that file if it changes. Please, can anyone point me to some guides how to do it. I already tried to pin file from drive, but I don't really understand what to do next..
Downloading Files from Google Drive:
To download a Google Drive file via link, try this (from this tutorial):
https://drive.google.com/uc?export=download&id=FILE_ID
Just replace the FILE_ID with the original fileID found in the Drive URL.
Additonal notes:
You can download files using the DRIVE REST API
To download files, you make an authorized HTTP GET request to the file's resource URL and include the query parameter alt=media. For example:
GET https://www.googleapis.com/drive/v3/files/0B9jNhSvVjoIVM3dKcGRKRmVIOVU?alt=media
Authorization: Bearer ya29.AHESVbXTUv5mHMo3RYfmS1YJonjzzdTOFZwvyOAUVhrs
Downloading the file requires the user to have at least read access. Additionally, your app must be authorized with a scope that allows reading of file content. For example, an app using the drive.readonly.metadata scope would not be authorized to download the file contents. Users with edit permission may restrict downloading by read-only users by setting the viewersCanCopyContent field to true.
Updating files in Google Drive
Make an HTTP Request to Google Drive using PATCH. The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request- URI. Things to take note of are:
Parameters
Authorization
Request Body
I have a bucket named foo inside which resides my two subfolders named bar and foobar.
Hierarchy
foo
-bar
-foobar
Problem
Now i want to make my uploaded objects public readable. Using xhr (by allowing CORS) i was able to do so. But using AWS android sdk the public-read acl is still not implemented in their api as specified by this feature request on GITHUB
So as evident i am not able to make my uploaded objects using AWS Android sdk
So please help me in solving this issue.
This can be done via S3 bucket policy. See Bucket Policy Examples. It looks like what you need is to allow anonymous read to objects under a bucket. You can apply the following bucket policy to the bucket foo.
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AddPerm",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject"],
"Resource":["arn:aws:s3:::foo/bar/*","arn:aws:s3:::foo/foobar/*"]
}
]
}
This should also answer the question on Github.
The transfer manager currently does not support ACL; however, you can use AmazonS3Client to perform putObject(). You can take a look at the AWS Mobile SDK for Android API Reference for more details.