PackageManager getLaunchIntentForPackage - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PackageManager getLaunchIntentForPackage method.

This code example shows how to use the following methods:getLaunchIntentForPackage, sleep
    private Collection<ProcessErrorStateInfo> launchActivity(String packageName) {
        Intent homeIntent = new Intent(Intent.ACTION_MAIN);
        homeIntent.addCategory(Intent.CATEGORY_HOME);
        homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 
        Intent intent = mPackageManager.getLaunchIntentForPackage(packageName);
 
        // We check for any Crash or ANR dialogs that are already up, and we ignore them.  This is 
        // so that we don't report crashes that were caused by prior apps (which those particular 
        // tests should have caught and reported already).  Otherwise, test failures would cascade 
        // from the initial broken app to many/all of the tests following that app's launch. 
        final Collection<ProcessErrorStateInfo> preErr = mActivityManager.getProcessesInErrorState();
 
        // Launch Activity 
        mContext.startActivity(intent);
 
        try { 
            Thread.sleep(mAppLaunchTimeout);
        } catch (InterruptedException e) {
            // ignore 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getLaunchIntentForPackage
						Toast.makeText(ProcessManager.this, display_process.get(index).processName,
								   Toast.LENGTH_SHORT).show();
						break; 
						 
					case 1: 
						Intent i = pk.getLaunchIntentForPackage(display_process.get(index).processName);
						 
						if(i != null)
							startActivity(i);
						else 
							Toast.makeText(ProcessManager.this, "Could not launch", Toast.LENGTH_SHORT).show();	
						 
						break; 
				} 
			} 
		}); 
		 
		dialog = builder.create();
		dialog.show();
	} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getLaunchIntentForPackage
    } 
 
    public void launchPackage(String targetPackage){
        Intent i = new Intent();
        PackageManager manager = mContext.getPackageManager();
        i = manager.getLaunchIntentForPackage(targetPackage);
        i.addCategory(Intent.CATEGORY_LAUNCHER);
        mContext.startActivity(i);
    } 
 
    public TouchKeyBacklight(PreferenceActivity context) {
        mContext = context;
    } 
 
    @Override 
    public boolean onPreferenceClick(Preference preference) {
        if (isPackageExists(PACKAGE_BLN_PRO)) {
            launchPackage(PACKAGE_BLN_PRO);
        } else if (isPackageExists(PACKAGE_BLN)) {
            launchPackage(PACKAGE_BLN);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getLaunchIntentForPackage
This code example shows how to use the following methods:getLaunchIntentForPackage
 
		PackageManager packageManager = context.getPackageManager();
		mNotificationManager = (NotificationManager) context
				.getSystemService(Context.NOTIFICATION_SERVICE);
 
		Intent resumeActivityIntent = packageManager
				.getLaunchIntentForPackage(getContext().getPackageName());
		resumeActivityIntent.addCategory(Intent.CATEGORY_LAUNCHER);
		resumeActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
				| Intent.FLAG_ACTIVITY_SINGLE_TOP);
		mContentIntent = PendingIntent.getActivity(getContext(),
				NOTIFICATION_NU, resumeActivityIntent, 0);
	} 
 
	@Override 
	public void onSongChanged(Song song) {
		if (song != null) {
			onTitleChanged(song.getTitle());
			onArtistChanged(song.getArtist());
			onAlbumArtChangedToUri(song.getAlbumArt());
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getLaunchIntentForPackage
        return wrapped.canonicalToCurrentPackageNames(names);
    } 
     
    @Override 
    public Intent getLaunchIntentForPackage(String packageName) {
        return wrapped.getLaunchIntentForPackage(packageName);
    } 
 
    @Override 
    public int[] getPackageGids(String packageName) throws NameNotFoundException {
        return wrapped.getPackageGids(packageName);
    } 
 
    @Override 
    public PermissionInfo getPermissionInfo(String name, int flags)
    throws NameNotFoundException { 
        return wrapped.getPermissionInfo(name, flags);
    } 
 
    @Override 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related PackageManager getLaunchIntentForPackage Questions & Answers:

getLaunchIntentForPackage Method Overview
Return a "good" intent to launch a front-door activity in a package, for use for example to implement an "open" button when browsing through packages.
See Code Examples for other Android PackageManager Methods: