Jump to content

Magno

Members
  • Content Count

    44
  • Joined

  • Last visited

  • Days Won

    1

Magno last won the day on June 14 2020

Magno had the most liked content!

Community Reputation

4 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Magno

    Trying to share a text file

    And I finished. My app is now able to both send the text file I intend and also receive a text from sharing ­čÖé Thanks to Brain Long again as I found the new updated article: http://blog.blong.com/2016/09/android-callbacks-wrapped-by-firemonkey.html
  2. Magno

    Trying to share a text file

    Well, I quit trying to doing it myself and now I am using Kastri lib (https://github.com/DelphiWorlds/Kastri) I works like a charm!! The second part is about receiving a text from another app, like a selected text. I already can do it, but just if I close my app and so the event will be triggered. Once I change to other app, select text and share, it won't work. I was guessing if OnActive should solve that but no, it's never triggered again, same onShow, only onPaint but that's crazy. Is there another way once my Android application returns focus to me check the intent? I tried implement the Brain Long solution (http://blong.com/Articles/DelphiXE7NFC/NFC.htm#ReceivingIntents) but I was unable to.. ­čś×
  3. Magno

    Trying to share a text file

    Well, reading an answer at Stackoverflow (https://stackoverflow.com/questions/56952411/sharing-image-and-link-through-intent-for-whatsapp-telegram-etc) is said: So, as I thought, now if I really need to send to Telegram I must figure out how to correctly input the information there. At least the sharing file is working.
  4. Magno

    Trying to share a text file

    I just tried Intent.setType(´╗┐StringToJString('image/* text/plain´╗┐')), well the result is the same. At very first I tried Intent.setType(´╗┐StringToJString('text/plain´╗┐')) and it will be used because the type file is ascii text. Maybe Telegram can have another way to receive a text file, which is different from Whatsapp.
  5. Magno

    Trying to share a text file

    It will open the share sheet so I could choose what app to share with. Now, if I select WhatsApp it works, if I select Telegram I receive the "unsupported content" message. For some reason Telegram wont accept the same parameters used for WhatsApp. Testing with Signal won't even return an error, it at least let me select a contact. I think the something is still missing here. So far I could not find any answer. The reason I am specifying that target intent for WhatsApp is because not all app could receive a sharing, and for email it is a kind different.
  6. Magno

    Trying to share a text file

    Ok, I finally did something, at least. Now I can share files with WhatsApp, but it will fail to Telegram or other apps that could receive a file: procedure TForm1.ShareFile(const FileName: String); Var {$IFDEF ANDROID} Intent: JIntent; FileUri: Jnet_Uri; ListArqs: JArrayList; {$ENDIF} begin {$IFDEF ANDROID} ListArqs := TJArrayList.Create; FileUri := TJNet_Uri.JavaClass.fromFile(TJFile.JavaClass.init(StringToJString(FileName))); ListArqs.Add(0, FileUri); // if intend to send more file change the index (default 0) try Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_SEND); Intent.setType(StringToJString('image/text/plain')); Intent.putParcelableArrayListExtra(TJIntent.JavaClass.EXTRA_STREAM, ListArqs); Intent.setPackage(StringToJString('com.whatsapp')); // Intent.setPackage(StringToJString('org.telegram.messenger')); Intent.addFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION); SharedActivity.startActivity(TJIntent.JavaClass.createChooser(Intent, StrToJCharSequence(''))); except on E: Exception do ShowMessage(E.Message); end; {$ENDIF} end;
  7. Magno

    Trying to share a text file

    Edit: I still didn't find any solution, but the code bellow seems to be "more" correct, I replicate from similar in Java but the message now is like "invalid format", as I am trying to share a text file to WhatsApp, eg. Bellow the new code: if FileExists(FileName) then begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_SEND); Intent.setType(StringToJString('*/*')); Intent.putExtra(TJIntent.JavaClass.EXTRA_STREAM, StringToJString('content://'+FileName)); SharedActivity.startActivity(TJIntent.JavaClass.createChooser(Intent, StrToJCharSequence('Share with...'))); end;
  8. I read almost every topic of the internet about this, but no clue and actually I have 2 issues... My Android app, Delphi CE, needs to save a file into the shared folder and it works fine (using TPath.GetSharedDocumentsPath), but I need to eventually share it and here I have the issues, first my app can't touch that file for sharing, but I can read and write it perfectly. The error is that known " android.os.FileUriExposedException´╗┐: file:///storage/emulated/0/Documents/myfile.txt exposed beyond app through ClipData.Item.getUri()". Ok, so I thought that my app can read the file I could clone a copy into the "sandbox" (TPath.GetDocumentsPath) and try to share and this is my second issue, because it seems to save the copy there but when I try to check the folder in phone the path .../files is empty. My Android is running the version 11 and SDK 26. The sharing function I am using can be the issue, of course: procedure ShareFile(FileName: string); Intent: JIntent; fileuri: JParcelable; Uri, Data: Jnet_Uri; begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_SEND); Intent.addFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION); Data := TJnet_Uri.JavaClass.parse(StringToJString(FileName)); Intent.setType(StringToJString('vnd.android.cursor.dir/*')); fileuri := JParcelable(TJnet_Uri.JavaClass.fromFile(TJFile.JavaClass.init(StringToJString(FileName)))); Intent.putExtra(TJIntent.JavaClass.EXTRA_STREAM, fileuri); TAndroidHelper.Activity.startActivity(Intent); end; I am not even sure if the vnd is correct. If someone could help I would be very glad.
  9. Magno

    DelphiCodeToDoc any alternative?

    ­čÖä alternative software for DelphiCodeToDoc... I am also accepting 5to9 25$/h if any. Thanks for reply guys, I didn't remember PasDoc and did not know about doc-o-matic, gonna take a look!
  10. Hello! Is there any alternative to doc mapping/documenting for Delphi? Thanks
  11. Magno

    Panel invalidate won't refresh information.

    Well, so far not success. I've even tried to trigger a TTimer just see if would work, but no ­čśĽ
  12. Magno

    Panel invalidate won't refresh information.

    Gonna give a try on that! Thanks so far
  13. Well, I have a panel with 3 labels. My app will geocode reverse (TMaps) some information and I simply need to make it happen (show the address info) after the decoding. Example: procedure Tform.OnGeocodeReverseEvent(const Address: TCivicAddress); begin // these labels are into a Panel labe1.Text := Address.Thoroughfare; labe2.Text := Address.Locality; labe3.Text := Address.CountryName; end; I've tried to force refresh: Panel1.InvalidateRect(RectF(0, 0, Panel1.Width, Panel1.Height)); Also tried create a new "refreshable" panel based on a Stackoverflow example I saw, using SubscribeToMessage(). As expected the geo reverse occurs into a thread (TTask) and after I read the info I need to call the GeocodeReverse() That geoData var bellow simply record that carries some information I will need later, but basically what I need to send to my geoDecode function is just the position (lat/lon), as simplified code: procedure TForm.UpdateInfo(); begin TTask.Run( procedure begin try GetGeoData(); finally TThread.Synchronize(nil, procedure begin UpdateMap(geoData); geoDecode(geoData.Position); end); end; end); end; procedure TForm.geoDecode(Position: TMapCoordinate); var NewLocation: TLocationCoord2D; begin try // Setup an instance of TGeocoder if not Assigned(FGeocoder) then begin // ShowMessage('FGeocoder'); if Assigned(TGeocoder.Current) then FGeocoder := TGeocoder.Current.Create; if Assigned(FGeocoder) then FGeocoder.OnGeocodeReverse := OnGeocodeReverseEvent; end; // Translate location to address if Assigned(FGeocoder) and not FGeocoder.Geocoding then begin // ShowMessage('NewLocation'); NewLocation.Latitude := Position.Latitude; NewLocation.Longitude := Position.Longitude; FGeocoder.GeocodeReverse(NewLocation); end except ShowMessage('Erro ao acessar servi├žo de geocoder'); end; end; So, after all the OnGeocodeReverse is triggered nicely but the labels themselves will only update if I, e.g. change to another tab, open close the multiviewer, something that force the redraw of the panel.
  14. I create very new app only to try uploading to Google Store, copied from the old project all the stuff and I getting the same error! "The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: [4]" Could be something related to the code itself?
├Ś