How do we make Launcher/Home android app for AndroidTV device? - android-tv

I did in Manifest.xml file
<!-- Start For Android Tv Box-->
<uses-feature
android:name="android.software.leanback"
android:required="true" />
<uses-feature
android:name="android.software.live_tv"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<!-- End For Android Tv Box-->
MainActivity is my first activity which is the firest screen of my app.
<activity
android:name=".MainActivity"
android:hardwareAccelerated="false"
android:screenOrientation="landscape"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:launchMode="singleInstance"
android:autoRemoveFromRecents="true"
android:resumeWhilePausing="true"
android:resizeableActivity="true"
tools:targetApi="n">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<meta-data android:name="supports_leanback" android:value="true" />
</activity>
When user tapped on Home button of AndroidTv remote Home/Launcher popup should come up and choose a launcher app for AndroidTv device, then whenever user power on device my app should be come as a launcher app.

Making an app as the launcher in Android TV is the same as other android devices. You only need to add a category named android.intent.category.HOME in your activiy's intent-filter. Use the following lines to change your AndroidManifest.xml:
<activity
android:name=".MainActivity"
...>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
...
</intent-filter>
</activity>

Related

Sending message to android emulator using firebase cloud message

I am testing to send a notification to my android emulator, it is working as it prints the details as it able to receive and means that is being triggered but the problem here is it doesn't pop up and even show on the notification panel of the android.
Firebase cloud messaging
Terminal
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rnfirebaseapp101">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name=".MainApplication"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Change the value to true to enable pop-up for in foreground on receiving remote notifications (for prevent duplicating while showing local notifications set this to false) -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground" android:value="false"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color" android:resource="#color/white"/> <!-- or #android:color/{name} to use a standard color -->
<!-- <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="#string/default_notification_channel_id" /> -->
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
EDIT:
Here is the guide I am following: https://blog.jscrambler.com/implementing-react-native-push-notifications-in-android-apps

Android TV launcher app not working as Home screen app

I am trying to create a default launcher app for Android TV box. Here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.raza.mlauncher">
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<queries>
<intent>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
</intent>
</queries>
<application
android:allowBackup="true"
android:banner="#mipmap/ic_launcher"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme.NoActionBar">
<activity
android:launchMode="singleTask"
android:name=".MainActivity"
android:exported="true"
android:priority="2">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER_APP" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
</activity>
</application>
</manifest>
But when I press home button on Android TV simulator, it does not ask to select the default home app. Even in settings of the device, there is no option available to choose a default launcher from installed ones. Is there any limitation on creating launcher apps for Android TV boxes?

flutter unresolved class 'FacebookActivity'

I don't know why it says unresolved class, although the documentation doesn't mention anything related to declaring it or anything.
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
in both the customTabActivity and FacebookActivity it says unresolved class
Class referenced in the manifest, com.facebook.CustomTabActivity, was
not found in the project or the libraries
and
Class referenced in the manifest, com.facebook.FacebookActivity, was
not found in the project or the libraries

same site issue for .net apps hosted on Azure IAAS with Azure AD integration

We have ASP.NET Webforms as well as ASP.NET MVC apps with Azure AD Integration which is hosted on Azure IAAS environment. Due to recent Chrome security release version > 80 and above, most of the apps started breaking. Please find below framework version
All the APPS were running on 4.5.2 and also dependent NuGet package
To fix the issue we explored the below option. As we have multiple options we need expert inputs on what option is best for APPS with Azure AD Integration.
To set IIS rewrite rule under the system.webServer tag. It is working without any code changes and framework upgrade
<rewrite>
<outboundRules>
<preConditions>
<!-- Checks User Agent to identify browsers incompatible with SameSite=None -->
<preCondition name="IncompatibleWithSameSiteNone" logicalGrouping="MatchAny">
<add input="{HTTP_USER_AGENT}" pattern="(CPU iPhone OS 12)|(iPad; CPU OS 12)" />
<add input="{HTTP_USER_AGENT}" pattern="(Chrome/5)|(Chrome/6)" />
<add input="{HTTP_USER_AGENT}" pattern="( OS X 10_14).*(Version/).*((Safari)|(KHTML, like Gecko)$)" />
</preCondition>
</preConditions>
<!-- Adds or changes SameSite to None for the session cookie -->
<!-- Note that secure header is also required by Chrome and should not be added here -->
<rule name="SessionCookieAddNoneHeader">
<match serverVariable="RESPONSE_Set-Cookie" pattern="(.*)(SameSite=.*)?" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
</conditions>
<action type="Rewrite" value="{R:1}; SameSite=None; Secure" />
</rule>
<!-- Removes SameSite=None header from all cookies, for most incompatible browsers -->
<rule name="CookieRemoveSameSiteNone" preCondition="IncompatibleWithSameSiteNone">
<match serverVariable="RESPONSE_Set-Cookie" pattern="(.*)(SameSite=.*)?" />
<action type="Rewrite" value="{R:1}" />
</rule>
</outboundRules>
</rewrite>
The other option we tried to update the Framework version to 4.7.2 and respective nuget packages. It required code changes at OpenIDconnect. We tried to implement the same based on documentation provided by Microsoft
https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-handle-samesite-cookie-changes-chrome-browser?tabs=dotnet
The third was to try to downgrade the framework version to 4.5.0 and respective NuGet packages. This option is also working fine.

Visual Studio localhost IIS Server Not Found

I'm trying to run an ASP.NET webforms website that I downloaded from an FTP server, but I'm running into problems when I try to build and run the project.
When I build and run the website, it opens my browser window, but adds "www." before the localhost address and I get a server not found error. I'm able to successfully build and run other websites, so I think I must have something wrong in the web.config or website properties. Here's a screenshot of my browser window:
Visual Studio Version: 15.7.2
IS Express: 10.0.1743
I tried changing the IIS port being used in the application.config file to see if that helped, but it gets replaced by a new site tag after I edit the original one. For example if my original port is 51060 and I change it to 51065 like this:
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<site name="mywebsite" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\me\Documents\mywebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51065:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
The application.config file changes to:
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<site name="mywebsite" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\me\Documents\mywebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51065:localhost" />
</bindings>
</site>
<site name="mywebsite(1)" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\me\Documents\mywebsite" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:51060:localhost" />
</bindings>
</site>
<siteDefaults>
<logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" />
<traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
Thanks for any help.
Right click on your web forms application project and then properties, navigate to the Web section, then look at the Servers section, and look at the Project Url that is being used, you can also mark the option Override application root URL if needed.
I hope it helps.

Resources