1

In my app the user has the opportunity to launch Google Files or Google Maps. I am updating the code to run on newer devices. As you can see I have the new code for maps, but I have not been able to find anything for Google Files...

if (itemId == id.maps) {    // new code for maps
    String param = "geo:0, 0?q=" + currentLOCATION.getText();
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(param));
    intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
    startActivity(intent);
    return true;
        
} else if (itemId == id.files) {    // I need to update this
    Intent launchIntent = getPackageManager()
        .getLaunchIntentForPackage("com.google.android.apps.nbu.files");
    if (launchIntent != null) startActivity(launchIntent);
    else toast("com.google.android.apps.nbu.files not found on this device");
    return true;
}

Please, how do I update this code to launch Google Files? It does not have to open a specific file, it just has to load and start.

Mick
  • 663
  • 1
  • 9
  • 18

0 Answers0