Android - How to develop Custom Launcher for Home Key? - java

Since many days Em wondering to find a solution for Android Launcher Application. What we want is to make customized launcher application so we can hide some of the applications from our office devices.
What I did till now?
I used the below Code in Manifest.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
But this doesn't work at all.

add this, you must have to declare category as Home
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />

Related

How can i make two activities to one file?

I made two activities in Android Studio. One of them is an empty activity the other is a Basic activity. My Problem now is that if I run the app my Smartphone Shows me two files. How can I make this into one file?
[]
It seems both of your activities have the android.intent.category.LAUNCHER
<activity
android:name=".YourActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

PreferenceActivity subclass should not be exported in the manifest (ExportedPreferenceActivity)

Android Studio is throwing a lint warning saying
PreferenceActivity subclass com.myapp.app.SettingsActivity should not be
exported in the manifest
Inspection info:Fragment injection gives anyone who can send your
PreferenceActivity an intent the ability to load any fragment, with any
arguments, in your process. Issue id: ExportedPreferenceActivity
I've never actually noticed when this warning started appearing, but I can't find a way to fix it without breaking the activity. SettingsActivity is an AppCompatPreferenceActivity with two PreferenceFragments and gets created after a SplashScreen. I've tried setting android:exported="false" in my Manifest.xml already, but it gives an error because action.VIEW cannot have export turned off.
Relevant Manifest.xml code:
<activity
android:name=".SettingsActivity"
android:label="#string/app_name"
android:theme="#style/SplashScreen">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts"
android:resource="#xml/shortcuts" />
</activity>
don't expose it with a launcher (which sounds alike what it complains about):
<category android:name="android.intent.category.LAUNCHER"/>
If possible remove:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
If you can't remove all of it just delete this line:
<action android:name="android.intent.action.VIEW" />

Android App does not open through schema (default/chrome browsers)

I have searched google every where to find a solution for 'Android App does not open through schema (default/chrome browsers)'. But I could not find a proper solution.
Below code set I added to Android Manifest.xml to link schema with browser.
<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="com.qa-soft.team" />
android:pathPrefix="/"/>
</intent-filter>
<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="com.qa-soft.team" />
</intent-filter>
but when I access ( com.qa-soft.team://OPENPDF-INDEX.pdf ) through default/chrome browser, it will be redirected to google search.
Anyhow when I access through firefox browser, it is working fine. (load the app activity)
what is the real issue for this and how can I overcome it?

Opening Android application from website not working

I want to implement such functionality in my simple Android app: when user visits a certain link (www.example.org let's say) in the web browser - Android OS should open my Android application if it is installed.
I tried to play with intent-filters like this:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<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:host="example.org"
android:pathPattern="/.*"
android:scheme="http" />
<data
android:host="www.example.org"
android:pathPattern="/.*"
android:scheme="http"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
But it's not working at all in google chrome mobile browser. In firefox, when I visit that link I get such Android icon on the right side of the search bar:
When I press that icon - my app opens. But still it is not what exactly I want to achieve.
Any idea why my code above doesn't work? I tried many variations of intent-filter declarations which I found on internet but nothing seem to work. I have nexus 5 device with Android 6 installed.
I have found a solution to my problem. Whole internet is full of old examples.
Since chrome version 25, google made slight changes in app deep linking functionality. More info: https://developer.chrome.com/multidevice/android/intents
So my working code looks like this:
Intent filter in Android side:
<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:host="launcher"
android:path="/"
android:scheme="test" />
</intent-filter>
Web page html:
Launch app
Try it like this, removing the path pattern:
<intent-filter>
<data android:scheme="http" android:host="twitter.com"/>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
More info:
Launch custom android application from android browser
<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:host="example.org"
android:scheme="http" />
</intent-filter>

Add my Android app to the "send via" menu

I use the OSMand Navi app. In there I want to click on a point a hit the Share button. Then there is a list of apps I can send the coordinates to.
I want my app being in that list. I read about it and added an <intent-filter> to my AndroidManifest.xml.
<application
<activity
android:name=".MyMainActivity"
android:label="My App" >
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
But my app is still not on the list. I even tried to reinstall it and restarted my phone.
"Share" is usually implemented via ACTION_SEND, not ACTION_GET_CONTENT.

Categories