Android TV launcher app not working as Home screen app - android-tv

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?

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

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

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>

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

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.

How do you manage web.config files in different projects within same solution when you need shared rules?

In my solution, I have 2 projects, call them Foo and Bar. When deployed, Foo is the root site (http://mycompany.com) and Bar is a sub-directory (http://mycompany.com/sub).
When I work on them locally in IIS Express on my local machine, I need to replicate things into web.config of both projects since I work on them separately. For example, I have one of the HMTL5 Boilerplate rules for "cache busting" in my Rewrite rules:
<rewrite>
<rules>
<rule name="Cachebusting">
<match url="^(.+)\.\d+(\.(js|css|png|jpg|gif)$)" />
<action type="Rewrite" url="{R:1}{R:2}" />
</rule>
</rules>
</rewrite>
If I just leave it in the web.config for Foo, then when I work on Bar, it's not applied and I get errors since the rewrite isn't happening. So I've replicated sections into the web.config for both projects.
But when I publish the solution to Azure, I get conflicts because of the inheritance rules since the web.config for Foo is in the root.
What is the best way to manage this? I tried to search on this topic but couldn't find this exact problem described.
Update:
My applicationhost.config for IIS Express is as such:
<site name="Bar" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\Code\mycompany\Bar\Bar" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:65052:localhost" />
</bindings>
</site>
<site name="Foo" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\Code\mycompany\foo" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:50477:localhost" />
</bindings>
</site>
I tried editing it to make both apps part of the same site, with these changes but no luck. Seems to have broken everything :)
<site name="Foo" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\Code\mycompany\foo" />
</application>
<application path="/Sub" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\Code\mycompany\Bar\Bar" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:65052:localhost" />
</bindings>
</site>
Make your root site (http://mycompany.com) as a website in IIS, and your sub-directory as virtual directory in IIS.
IIS shares the Rules defined in root website ('s web.config) with the virtual directory.
Use web.debug.config and web.Release.config to manage the development and release environment difference. For more please follow this SO POST or this MSDN blog

Resources