Note that there are some explanatory texts on larger screens.

plurals
  1. POLaunching Gallery in android phones
    primarykey
    data
    text
    <p>I am trying to launch the gallery from my app when user clicks on the notification. I have found that it is only possible if you know the package and the class name of the Gallery app. I have managed to find the same for four device manufacturers, and so far this code works. I just need the package and class name for Motorola and LG Android phones.</p> <p>Can anyone help? It is very easy for you if you are a developer and own a Motorola or LG Android device. You just need to launch gallery in your phone while connected to LogCat, and it will show the package and class name of the Gallery.</p> <p>CODE:</p> <pre><code>Intent newIntent = new Intent(); //open Gallery in Nexus plus All Google based ROMs if(doesPackageExist("com.google.android.gallery3d")) newIntent.setClassName("com.google.android.gallery3d", "com.android.gallery3d.app.Gallery"); //open Gallery in Sony Xperia android devices if(doesPackageExist("com.android.gallery3d")) newIntent.setClassName("com.android.gallery3d", "com.android.gallery3d.app.Gallery"); //open gallery in HTC Sense android phones if(doesPackageExist("com.htc.album")) newIntent.setClassName("com.htc.album", "com.htc.album.AlbumMain.ActivityMainCarousel"); //open gallery in Samsung TouchWiz based ROMs if(doesPackageExist("com.cooliris.media")) newIntent.setClassName("com.cooliris.media", "com.cooliris.media.Gallery"); startActivity(newIntent); </code></pre> <p>And to check if package name exists:</p> <pre><code>public boolean doesPackageExist(String targetPackage) { PackageManager pm = getPackageManager(); try { PackageInfo info = pm.getPackageInfo(targetPackage, PackageManager.GET_META_DATA); } catch (NameNotFoundException e) { return false; } return true; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload