Emulator launchs activity that is not declared as starting - android-activity

Here is my manifest snippet:
<activity android:name=".EntranceView" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity >
<activity android:name=".MainView">
</activity>
The problem is that on application start the .MainView activity launchs, not .EntranceView that is declared as starting activity.

I've changed .MainView to .GeneralView. Weird, but it works for me.

Related

firebase_dynamic_links in Flutter does not work on Android version 13

I am using firebase_dynamic_links 5.0.11 and Flutter 3.3.9. I did implement the dynamic link by firebase and it is working as it is expected on Android version 12 or less.
The problem is just on Android version 13 that the link can not open the app.
I did find some solutions for android 13 like adding the SHA-256 key to Firebase and adding the android:autoVerify="true" to AndroidManifest. But they do not solve the problem.
Does anyone have any clue about the solution?
check do you have in your manifest
<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="YOUR_CONTENT_LINK_DOMAIN"
android:scheme="https"/>
</intent-filter>
I had the same issue on android 13 but on 12 and lower was ok. With this intent filter working ok for me
The problem got solved by moving intent-filter inside the activity.
I changed it from:
<activity>
.....
<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="YOUR_CONTENT_LINK_DOMAIN"
android:scheme="https"/>
</intent-filter>
</activity>
to
<activity>
<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="YOUR_CONTENT_LINK_DOMAIN"
android:scheme="https"/>
</intent-filter>
.....
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
.....
</activity>

flutter local notification manifest plugins

i am using flutter local notification, but in the repository example does not implemented any code for scheduling or notification at all.
should i put them or not?
the manifest XML file is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dexterous.flutter_local_notifications_example">
<application
android:label="flutter_local_notifications_example"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:showWhenLocked="true"
android:turnScreenOn="true">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Yes, you need to. And also you need to put the following in AndroidManifest.xml in order to have a proper notification behaviour setup. They are all self-explanatory. If you have any other confusion leave a comment.
<application ...>
<activity ...>
...
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
...
</application>

How to open pdf file in flutter app when a user clicks on a pdf file in file manager

i wanted to know how to make my app as a default pdf viewer. Please see the screenshot below :
So when a user clicks on the pdf file the flutter app should open it. and should be visible in the list of pdf openers.
check out receive_sharing_intent
and add below code in your manifest
<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.MANAGE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"/>
<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" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>

Mobile game restarts when using Application.Quit

Okay, so I upgrade my old 4.6 Unity project into Unity 5.0. Overall, the process was relatively painless, but now my Quit button doesn't work when I build for Android.
And I get a very odd message via logcat:
E/Unity (23691): RenderTexture warning: Destroying active render texture. Switching to main context.
E/Unity (23691):
E/Unity (23691): (Filename: Line: 295)
E/Unity (23691):
My quit code in my GameController script is pretty simple:
public void Quit () {
Application.Quit();
}
void OnApplicationQuit () {
if (showAds) { //just in case
adController.DestroyAll();
}
}
What should I be looking for? Is it a texture issue? I do have a custom shader, but the game worked fine with Unity 4.6 before.
So, it all went back to Unity5 and how it integrates older plugins like Admob. Apparently, there is no ProxyActivity needed anymore for Android builds. So I completely removed the following out of the AndroidManifest.xml file:
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And then moved the <intent-filter> into the UnityPlayerActivity:
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Now Application.Quit() works no problem!
Complete AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="com.example.admobtest" android:versionName="1.0" android:versionCode="1">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<!-- Mobile Ads Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="#drawable/app_icon" android:label="#string/app_name" android:debuggable="false">
<!-- meta-data tag for Google Play services -->
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
<meta-data android:name="android.app.lib_name" android:value="unity" />
</activity>
<activity android:name="com.unity3d.player.VideoPlayer" android:label="#string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" >
</activity>
<!-- Google Mobile Ads Activity -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<!-- PurpleBrain AdBuddiz Activity -->
<activity android:name="com.purplebrain.adbuddiz.sdk.AdBuddizActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent">
</activity>
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
</manifest>
#theprisoner6 aswer doesn't work for me but for reference the another option is to hide an application (move it to back). This has added value that if the Android decide it is worth to keep the app in memory you will avoid loading an application which should improve user experience. This could be handled as a plugin but hey, there is no need for that! Very simple C# code:
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
var movedToBack = jo.Call<bool>("moveTaskToBack", true);
Swap that code with Application.Quit() and you are done.

Registering share intents on Google Glass

Is there a way to to register my share intent so that in the normal Glass photo app I can register a card with my own Activity, i.e. share with x? This is straightforward in Android but doesn't seem to translate to Google Glass.
This is what I am trying now:
<activity
android:name="com.x.ShareActivity"
android:label="#string/app_name"
android:icon="#drawable/x" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
This is currently not possible. The "share with x" screen only shows Glass contacts (See : https://developers.google.com/glass/develop/mirror/contacts) At this time, only glasswares using Mirror Api can register them self as a contact.
There is no way for the default camera app (that was invoked directly) to share a photo with your GDK app at this moment.