When I open my app from a play store link it doesn't load any activity and goes white screen - android

I have an application published in the play store. When I share the link on facebook or on other social and then I click on it from mobile, if the device has already the app instead of opening the play store it loads directly my application. The problem is that when it happens the app doesn't load any activity and got stuck on white screen. I think that this is probably related to the Application class but I don't know how to solve this.
public class AppGlobal extends Application {
#Override
public void onCreate() {
super.onCreate();
// things that I must do by extending application
if(DEBUG)
Log.e("AppGlobal","Started");
}
}
Update: This is the link that users click on the facebook posts. Please note that the behaviour I described occurs only when the post has been clicked on facebook app and the user has already installed my application on the same device.
https://play.google.com/store/apps/details?id={package-name-of-app}
When I try to clink the play store link this is the debug logging.
04-10 12:32:47.955 11111-11111/? E/Zygote: v2
04-10 12:32:47.956 11111-11111/? E/Zygote: accessInfo : 0
04-10 12:32:49.056 11111-11111/it.mybeautifullApp E/AppGlobal: Started
I've also read online that this could be related to the lack of intent filters in the manifest, but I think that I've set them correctly:
Update 2: posted the whole manifest (updated with new deep linking attempts)
<application
android:name=".AppGlobal"
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:icon,android:allowBackup">
<activity
android:name=".SplashActivity"
android:theme="#style/NoActionBar">
<intent-filter android:label="from_play_store">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="play.google.com" />
</intent-filter>
<intent-filter android:label="from_play_store_market">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="market"
android:host="details?id=it.cineprime" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:theme="#style/NoActionBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
<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>
<activity
android:name=".SignupActivity"
android:theme="#style/NoActionBar" />
<activity
android:name=".MainActivity.MainActivity"
android:screenOrientation="portrait" />
<activity android:name=".CheckoutActivity" />
<activity
android:name=".SurveyActivity"
android:theme="#style/NoActionBar" />
<activity android:name=".BarcodeActivity" />
<activity
android:name=".SettingsActivity"
android:label="#string/title_activity_settings"
android:parentActivityName=".MainActivity.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="it.cineprime.MainActivity.MainActivity" />
</activity>
<activity
android:name=".IntroActivity"
android:screenOrientation="portrait"
android:theme="#style/NoActionBar" />
<activity
android:name=".DetailActivity"
android:theme="#style/NoActionBarCollapsing" />
</application>
So the question is: How can I intercept when my application is called in the way described above or how can I at least avoid the white screen stuck?

make <item name="android:windowBackground">#null</item> in your theme for getting rid of white screen

You don't say what kind of URL you are using for linking to the app. Here is some documentation on recommended formats. Putting the URL you are sharing on social media in your question would help.
But you might want to read the documentation on linking to specific content in your app. I suspect you are using one of these links, but haven't set up the intent filter for it, as described here.
Specifically you will need:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
to handle default views in the Intent. I suspect the <data> coming in is not #string/fb_login_protocol_scheme so there is no activity to handle it.

Related

Enabling Deep Linking In Android App

I am trying to enable deep linking in my android app using this official guide.I am not able to understand where and how to add URI under data element. What would be the value of URI for my app. Is it referring to package name?Do I have to add intent filter tag for each android name activity? Any one example would be enough to make things clear. Please suggest.
My Manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.praveen.healthcareit">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="com.myapp.praveen.healthcareit.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.myapp.praveen.healthcareit.EvlHealthPlans" />
<activity android:name="com.myapp.praveen.healthcareit.ConHealthInsurance" />
<activity android:name="com.myapp.praveen.healthcareit.HealthPlanNetworks" />
<activity android:name="com.myapp.praveen.healthcareit.ProvCompensation" />
<activity android:name="com.myapp.praveen.healthcareit.CdphpPlans" />
<activity android:name="com.myapp.praveen.healthcareit.HmoPlans" />
<activity android:name="com.myapp.praveen.healthcareit.PpoPlans" />
<activity android:name="com.myapp.praveen.healthcareit.ProviderTypes" />
<activity android:name="com.myapp.praveen.healthcareit.UtilizationManagement" />
<activity android:name="com.myapp.praveen.healthcareit.EDIConcept" />
<activity android:name="com.myapp.praveen.healthcareit.ClaimProcessing" />
<activity android:name="com.myapp.praveen.healthcareit.CobraHippa" />
<activity android:name="com.myapp.praveen.healthcareit.GovernmentPrograms"></activity>
</application>
</manifest>
No need filter to all activity need only for the activity which you want to invoke from deep link url. in manifest
<activity
android:name="yourpackagename"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#style/actioncolor">
<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="schemename"
android:host="hostname" />
</intent-filter>
</activity>
your URI will be schemename://hostname?hereextraparametersifyouwant
here you get the full example with steps
https://codelabs.developers.google.com/codelabs/android-deep-linking/index.html?index=..%2F..%2Findex
Add following intent filter in the activity tag which you want to launch while deep linking.
<activity android:name="com.myapp.praveen.healthcareit.MainActivity">
<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.example.com"
android:pathPrefix="/appx"
android:scheme="http" />
</intent-filter>
</activity>
where your url is like http://www.example.com?appx=45. So here scheme is http or https. If you want both then add two intent filters, one with http and another with https. Then pathPrefix is the url parameters you want to identify. Not pathprefix can be empty or *. And finally host is your website address to be deep linked.

Android: Can install apk but can't open (open greyed out)

I'm well down the road of creating my first android application. I can run it on my phone (Android 6.1) fine from android studio via the ADB, however am completely unable to access it when not connected to the computer.
If I install the apk manually, the app installs fine but the "Open" button is greyed out at the end of the installation. The app also doesn't appear in my app draw, however does appear in my installed applications under settings.
Has anyone got any suggestions?
Here is my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.domain.mediasyncer">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:enabled="true"
android:theme="#style/AppTheme.NoActionBar">
<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:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>
<activity
android:name=".ShowActivity"
android:label="#string/title_activity_show"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".SeasonActivity"
android:label="#string/title_activity_season"
android:theme="#style/AppTheme.NoActionBar" />
</application>
</manifest>
Edit: I am able to install apks from unknown sources.
It seems that removing the following allows me to open the app. Any suggestions how I can include that in my intent and still open my app?
<data android:host="oauthresponse" android:scheme="mediasyncer" />
Copied from here: https://stackoverflow.com/a/29477867/1226095 with slight adaptations
Due to the intent-filter matching/resolution process, when Android "shows the applications" in the launcher, it shows the list using matching mechanism, and when you add you app doesn't match, because the system doesn't bring any data when it displays the launcher.
The solution is create another intent-filter, for example:
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:enabled="true"
android:theme="#style/AppTheme.NoActionBar">
<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" />
<data
android:host="oauthresponse"
android:scheme="mediasyncer" />
</intent-filter>
</activity>

Call back issue in twitter4j android

I am using twitter4j library to post on twitter from android app. I have followed this question. I am having one issue it displays login screen, but after entering username and password, it's displaying this screen.
I tried to display on sign in 4-5 times, but still it's displaying me this screen and not going back to my app again.
Manifest File
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.objectlounge.OBLTwitter.MainActivity"
android:label="#string/app_name" >
android:launchMode="singleInstance">
<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="OBLTwitter"
android:scheme="app" />
</intent-filter>
</activity>
</application>
There was something wrong with api key and api secret. I regenerated both and it started working.

Android intents with multiple categories

I have a program that posts tweets on the user's behalf. Everything works in the AVD. However, I cannot seem to allow my program to have an icon. The strange thing is when I remove the lines for the BROWSABLE category and the data tag, the icon shows up and the program shows up in the program list as normal.
I think there is a problem with my Android Manifest, but I can't seem to get everything working. Please help!
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:theme="#style/Theme.AppCompat.Light"
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTask" >
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.TAB"/>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="howsmydriving-oauth-twitter" android:host="callback"/>
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
</application>
Alright, so, I figured out my problem.
I need two intent-filters for this. Changing the intent filter portion to the following allowed me to both view my app in the installed app listing and get the OAuth redirect:
<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="howsmydriving-oauth-twitter" android:host="callback"/>
</intent-filter>
You are missing the android:icon entry. It should be equal to a string #drawable/$NAME, i.e. android:icon="#drawable/ic_launcher" This might help.

Receive text from the Android share menu

I can't find this problem anywhere, so it's probably something stupidly simple.
I'm trying to register my app's MainActivity to receive plain text from other apps via the share menu, but nothing I do seems to get it working. When I select text in the web browser and click the "share" icon my app is not listed as an option.
Here's the relevant part of the android manifest:
<application
android:name=".App"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I also tried other actions such as SENDTO and VIEW to no avail. The problem I have is that my app simply does not appear as an option in the share menu.
From the Example you forget to add data mimeType
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>

Categories

Resources