Home Google Apps does not receive an Intent from the Firemonkey app
Reply: 0

Google Apps does not receive an Intent from the Firemonkey app

user1881 Published in May 24, 2018, 3:59 pm

I want to implement something like ShellExcute() but on Android.

I want to use an Intent to open a file in an external app.

I think it works well when tested, but for xlsx, ppt, and pdf extensions, my default Google apps (Spreadsheets, Presentations, Drive PDF viewers) are not receiving the file.

There is no problem with images and galleries in Google apps.

So, if I get the MIME-Type and there is no app for it, my code throws an exception:

I can handle exceptions, but Google apps are not being displayed in the selection list, even if I set the MIME-Type to */*.

That's why I have a basic Google apps, which forces users to install third-party apps.

What do I have to do for Google apps to get my Intent?

When I open the corresponding file using ES File Explorer on my device, those Google apps come out well.

This problem occurs equally well when testing both my device and the emulator.

Below is the example code I tested:


{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
  Intent: JIntent;
  filename: String;
  t: JString;
  filename := Edit1.text;
  Intent := TJIntent.Create;

  // Get MIME Type
  t := TJMimeTypeMap.JavaClass.getSingleton.getMimeTypeFromExtension
        (StringToJString (StringReplace (TPath.GetExtension(filename), '.', '', [])));
  if t = nil then
    t := StringToJString('*/*');

  Intent.setDataAndType(StrToJURI(TPath.GetPublicPath + PathDelim + filename),  t);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.397896 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO