Skip to content Skip to sidebar Skip to footer

How To Use Activity Attribute Android:showforallusers In Xamarin?

The attribute is not implemented in Xamarin. This mean I can't declare it as an attribute of my Activity Class like it should: [Activity(Label = '@string/app_name', Theme = '@style

Solution 1:

On your Activity attribute, applied a Name to avoid the MD5-based Java class auto-naming:

[Activity(Name = "com.sushihangover.MainActivity")]

In your manifest use the same fully-qualified name (no abbreviated dot notation) with the attributes you wish to apply to this activity:

<activityandroid:name="com.sushihangover.MainActivity"android:showForAllUsers="true"android:icon="@mipmap/icon"android:label="MainActivity" ><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity>

Note: All the attributes for this Activity need to be added within the manifest, not the Activity class attribute.

The final manifest entries will be merged correctly:

<activityandroid:name="com.sushihangover.MainActivity"android:showForAllUsers="true"android:icon="@mipmap/icon"android:label="MainActivity"><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity>

Post a Comment for "How To Use Activity Attribute Android:showforallusers In Xamarin?"