Tag: intent

[QA] android start activity with Intent URI

Uri uri = new Uri.Builder()
 .scheme("http")
 .authority("ynjan.com")
 .appendPath("mypath")
 .appendPath("mysubpath")
 .build();
 Log.i(TAG, "uri=" + uri); // http://www.mydomain.com/mypath/mysubpath
 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 context.startActivity(intent);
<intent-filter>
   <action android:name="android.intent.action.VIEW"/> 
   <category android:name="android.intent.category.DEFAULT"/>
   <data 
      android:scheme="http"
      android:host="ynjan.com"
      android:path="/mypath/mysubpath"/>
</intent-filter>
Tags : ,

[QA] How to get launch / main activity class in android

String packageName = context.getPackageName(); 
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName); 
String className = launchIntent.getComponent().getClassName();
Tags : , ,