I have created an android app using android studio. When i run my code on the IDE, its runs as expected on the connected phone. The problem is, it does not leave behind an icon on my phone to use it next time. I will again have to run from android studio to use the app. This was fine initially, i don't realize what made the icon vanish. The app is also present in the settings.
When i go to
Settings->apps
i can very well find my app over there. It is not disabled. I tried uninstalling the app and trying again. It still doesn't give me the icon.
I cleared defaults, forced closed and tried everything possible. Nothing is helping me.
Please help.
My AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".TwitterLogin"
android:label="#string/title_activity_twitter_login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".NextActivity"
android:label="#string/title_activity_next" >
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="b1fe9f0c7d80c3c24879d634b199f2d0e474b4ba" />
<activity
android:name=".WebViewActivity"
android:label="#string/title_activity_web_view" >
</activity>
</application>
</manifest>
You should specify a different for every intent that can launch your app. So one for the BROWSER category with your url data, and one for the LAUNCHER category.
From the App Manifest Guide.
Components advertise their capabilities — the kinds of intents they can respond to — through intent filters. Since the Android system must learn which intents a component can handle before it launches the component, intent filters are specified in the manifest as elements. A component may have any number of filters, each one describing a different capability.
Your code would become something like:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
</intent-filter>
Related
Is there a way to make my app the only running app in a device, what I mean is the only visible and open app? Once the device booted, the app will launch automatically while any tap to settings at status bar, back, home and recent apps button are disabled. Probably a custom Android OS is required or rooting the device will be enough? We plan to have a set of devices where users can only operate with one app. Thanks
You need to be able to remove current launcher app to the system part of the device.
Then it's as simple as:
Adding android:launchMode="singleTask" to activity tag in AndroidManifest.xml
Adding <category android:name="android.intent.category.DEFAULT" /> and
<category android:name="android.intent.category.HOME" /> to your intent filter
The end result should look similar to this:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.app.MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>
I've followed the steps in the android documentation Here to implement linking in my application. I dont really need any fancy parameter passing, all I want is when the user clicks a link on the browser that my app opens. All I did was modify my AndroidManifest. Here is the relevant part
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="u2player" android:host="open.my.app" />
</intent-filter>
</activity>
I am using react-native-navigation and trying to browse from either the chrome browser or the native browser to any of u2player:// u2player://open.my.app u2player://open.my.app/ doesn't work. I have also binded the url event from the Linking module but nothing works. I restarted, uninstalled, etc.
Help appreciated
Try using branch. It solves most of the problem that you are facing and it also has a very clean documentation. Please go through and let me know if you have any issues
I recently started testing my react-native android application and noticed that it doesn't create an app icon on installation. When I debug - it seems to install and run fine, but when I look for it in the app icon to launch - it does not show up. Looking at the list of installed apps, it's there. How can I debug this? Do I need to change the launch mode from singleTop to something else? I tried changing it to singleInstance and it still had the same issue. If I remove some of the intent filters it seems to work - so maybe I messed up the branch.io installation instructions? Do I need to create a seperate intent filter xml node for the other intents? https://dev.branch.io/getting-started/sdk-integration-guide/guide/react/#android-configure-manifest
AndroidManifest.xml
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="www.foo.com"
android:pathPrefix="/event" />
<!-- note that the leading "/" is required for pathPrefix-->
<data android:scheme="fooapp" android:host="open" />
</intent-filter>
<intent-filter>
<action android:name="fcm.ACTION.EVENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Update
Splitting up the intent-filters seems to have fixed it - but a bit unclear if that is the correct thing to do. In the branch.io instructions - did they mean for me to create a new intent-filter and not add to the existing main one?
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="http"
android:host="www.foo.com"
android:pathPrefix="/event" />
<!-- note that the leading "/" is required for pathPrefix-->
<data android:scheme="fooapp" android:host="open" />
</intent-filter>
The launcher is typically specific software developed by the individual hardware manufacturers. On all of the devices i have, an app does not get installed on the homescreen when it is not installed from the play store, but it does show up in the list of apps. However, that behaviour will be specific to the launcher you are using i think.
You should not need to go to settings->apps though just to see it. Is that the problem you are having?
Perhaps a screenshot as well as a description of your test device (s) would make the question clearer.
Update....
Typically the startup activity has one intent filter with only MAIN and LAUNCHER. I would just try to remove the other things from that intent filter and see if that resolves the problem. Then one by one, add the rest of the things you have listed until you identify the problem child.
Looking at this again, I am not sure that you can define 2 actions in a single event filter. So it seems you need to remove VIEW.
Every time I open my app, I am being routed through my main activity, rather than returning to the last activity that was previously opened. This only started occurring once I started using branch.io for deep-linking functionality. Why might this be happening? I assume that it has something to do with my manifest.. I'll post a snippet:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:name="roof.android.Application"
android:theme="#style/AppThemeNoAnimation"
android:largeHeap="true"
>
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_bpzpbF3KFoq5TlSQFp0TdnaauEf6iBuU" />
<activity
android:name="roof.android.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="https://roof.app.link/RwKeFhqi5v" android:host="open" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
There are several activities which follow this, but I suppose it is not necessary to post them.
Alex from Branch.io here: looks like you have a mistake when defining your URI scheme:
<data android:scheme="https://roof.app.link/RwKeFhqi5v" android:host="open" />
should look more like
<data android:scheme="myscheme" android:host="open" />
(more about this step in our docs here).
You definitely will need to fix that, but I'm not sure if it would be causing the issue you are seeing. Give it a try and if you're still having trouble, I'd suggest submitting a ticket to our Integrations team so they can take a closer look at the code.
My problem is thus; I am new to programming on the ANDROID platform and have a 'working' application that piggy-backs on the API-Docs example. I wish it to launch three tabs one containing a list of reports, one a form to file a report and the last to show the geo-located reports. It doesn't appear as a separate application, it instead appears as a list to be launched by the API-Docs example. Below is my manifest code...
<activity android:name=".HelloFlamingos">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".Controls2" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".List1" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".ReviewTab" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
HelloFlamingos is the initial page that I wish to be displayed, I realise that the intents for this are wrong, have thought about using category: VIEWS, action: DEFAULT, however is seemingly unwilling to work. Thanks!
In what context is the activity started? If you're looking to have the HelloFlamingos activity the first displayed from the Android OS, you should change its category in the manifest to category.LAUNCHER.
If you're looking to start the activity from elsewhere in your app, create an Intent which matches what you've specified (category.SAMPLE_CODE) and use startActivity or startActivityForResult.