Creating a Time Stamp App

Hi,

Trying to create a Time Stamp app with location details. I would like my output to be like the one in the following app:

Primary objective is to get a TimeStamp Image in the Gallery. I’ll discuss the other objectives later. To satisfy my primary objective, following are my trails.


Following are my issues with these blocks:

  1. Image gets saved Twice. One as a Normal image just as when you click from your phone and the other as Time Stamp one. I need only One Image - Timestamp image and it should be displayed in the Gallery just like when you click a pic from your phone ( Just like the above app I mentioned)
  2. It should get saved to a Folder ( Like in the above app - Location of the image is Pictures folder)
  3. If the address got through location sensor is too lengthy, I want some part of it in a new line ( Preferably to be done automatically.)

Now, Coming to my other objective:

  1. When I click on the button to take a picture and before I take a picture, it should display all my required fields, like date, time and location ( Like the above app I mentioned - when the app starts it displays date time etc)

I am referring to some random app so that I can be clear about my requirement. No other motto.

Any early help is highly appreciated.

PK.

1 Like

just delete the second image after saving the modified image with the Canvas.SaveAs method

use the Canvas.SaveAs method together with a directory of your choice, e.g.
/myDirectory/myFilename.jpg

btw. there might be a timing issue if you take the picture very fast, because you are trying to take a picture and calling some data using the web component at the same time

use the length block from thetext drawer to find out the length of the current address and if it is larger than a value of your choice, then split the address... you could split by space to get a list of the words of the address and add the new line character \n somewhere in between... you might want to try something and if you get stuck , post a screenshot of your relevant blocks

taking a picture should be a 2 step process,

  1. first step to get the data from the location sensor and web component and to display them and
  2. second step to take the picture

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

@Taifun Guruji,

Thank you very much for your swift response.
Well… first 2 Issues are solved. I am getting Only one Time Stamp Image and I am able to save it to a directory of my choice. I came across a new problem here… Probably because image is getting saved to a directory, it is not showing in the Gallery. Any tips to get it into the gallery?

Another one I just noticed is, Even if i take the picture in landscape mode, it is getting saved as Portrait only. Any tips for this?

Restricting the location address length - I am not getting location as of now - I am working from home… so probably I need to go out and check for it. Will check and revert. Currently it says “No location available”. The other app I mentioned in the question is taking my current location also. Is there any work around for this?

Thank You
P.K

1 Like

Maybe. This tutorial might explain your issue HOW TO: Parse a LocationSensor's Current Address by SteveJG . The tutorial talks about some of the reasons users get a No location available message; such as..

No location available means no location is available because...

  1. there is no location available in Google's database for your specific location. Google does not have an address for every location in the World.
  2. your LocationSensor does not yet have a satellite fix at the moment you execute the query. If the LocationSensor reports it's default location (0,0 lat/lon); it thinks it is in the middle of the ocean and there certainly is not an address for that.
  3. you do not show blocks for a LocationSensor.LocationChanged event handler. I think that Block is required (even if the place for code is empty) in order to show a CurrentAddress (sorry I don't remember off the top of my head)..

Regards,
Steve

after saving the image call the GalleryRefresh method from the tools extension

Taifun

Hey Taifun,

I got that. Its reflecting in gallery now.
I’ve a new problem. I am using Android 6. In my phone when I click an image in portrait, Its getting displayed as portrait. But if i click in landscape, even then its getting converted into portrait.
I’ve tried this in Android 10. Its weird there… When I click it in Landscape its getting saved in Portrait and Vice versa.
I don’t really know if its Android 6 or 10 has to do some thing with it, but this is my observation. Any inputs will be of great help.

PK

I’ve tried capturing the Latitude and Longitude in a label. Its 0. Location is still a problem but as of now for my purpose, I need it only on roads / public place, so its fine. But in general it would be better if we can find out some solution for this…

PK

what exactly do you mean by "click an image"? to select an image using the image picker? or something else? which device are you using? probably a Samsung device?

are you talking about the methods of the image extension? probably you have to rotate the image before saving...

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Oh. How did you do that? If it shows a latitude and longitude of 0,0, that displays the default location and usually indicative of the device not having a gps receiver or not having achieved a satellite fix.

Sorry, this is unclear. What do you need a solution for?

Here are my blocks

:
My ultimate aim is to design a time stamp app with date, time and location. So precisely in my blocks I call a camera.TakePicture and camera.AfterPicture. When camera.TakePicture is called, it opens phone camera and then we take a picture and On it has the date, time and location. So, when the default camera opens, user takes a picture ( Click an image as I called it in my earlier post which was quite misleading… am sorry) and it gets saved to the gallery and/or a specified folder.
So, when the user is taking a picture from the device’s camera in portrait it gets saved in landscape and vice versa. That’s my problem.

Hope I made myself clear.

also as mentioned earlier, first save and the refresh the gallery


Taifun

I’ve tried on xiaomi POCO.

When I try on Redmi 3s Prime - Xiaomi - Whether taken in landscape or Portrait, it gets displayed on portrait.

Yet to try on other phones.

PK