I'd like to open a new instance of the same application, much like chrome used to by default when opening a new tab (See this)
here's what I've tried so far:
PackageManager pm = getContext().getPackageManager();
Intent launcher = pm.getLaunchIntentForPackage("my.package.name");
launcher.setAction(Intent.ACTION_VIEW);
launcher.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
launcher.setData(Uri.parse(result.getExtra()));
getContext().startActivity(launcher);
it does start a new activity and also loads the correct data, but it doesn't open a new screen.
how would I achieve this?
HERE'S MY MANIFEST FILE
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.depa.browsing.stack">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:fullBackupContent="true"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:hardwareAccelerated="true">
<activity android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateAlwaysHidden"
android:targetActivity=".MainActivity"
android:icon="#mipmap/ic_launcher">
<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" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".About"/>
<activity android:name=".Donate"/>
<activity android:name=".Settings"/>
<activity android:name=".GPL"/>
<activity android:name=".History"/>
<!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
Related
I integrated OneSignal push notification into my app and everything worked perfectly well until I upgraded to Android 12 (31). When I upgraded, AndroidStudio reports this error to me, I really don't know what I need to do to avoid it:
Manifest merger failed : android:exported needs to be explicitly specified
for <service>. Apps targeting Android 12 and higher are required to specify
an explicit value for `android:exported` when the corresponding component
has an intent filter defined.
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.my.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="oppo.permission.OPPO_COMPONENT_SAFE"/>
<uses-permission android:name="com.huawei.permission.external_app_settings.USE_COMPONENT"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:name="com.my.app.MainApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:networkSecurityConfig="#xml/network_security_config"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="#string/admob_app_ID" />
<activity
android:name="com.my.app.activity.StepActivity"
android:screenOrientation="portrait"
android:theme="#style/Splash">
</activity>
<activity android:name="com.my.app.activity.PrivacyPolicyActivity"
android:screenOrientation="portrait"/>
<activity android:name="com.my.app.activity.TermsToUseActivity"
android:screenOrientation="portrait"/>
<activity android:name="com.my.app.activity.SplashActivity"
android:screenOrientation="portrait"
android:exported="true"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.my.app.activity.MainActivity"
android:screenOrientation="portrait"/>
<activity android:name="com.my.app.activity.PremiumActivity"
android:screenOrientation="portrait"/>
<activity android:name="com.my.app.activity.ChooseServerActivity"
android:screenOrientation="portrait"/>
<service
android:name="com.my.app.OneSignal.MyNotificationExtenderService"
android:exported="true"
tools:node="merge"
android:permission="android.permission.BIND_JOB_SERVICE">
<intent-filter>
<action android:name="com.onesignal.NotificationExtender" />
</intent-filter>
</service>
<service
android:name="com.my.app.service.BackgroundJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:enabled="true"
android:exported="true"
tools:node="merge"/>
<service
android:name="com.my.app.service.MyService"
android:exported="false"
tools:node="merge">
<intent-filter>
<action android:name="androidsrc.intent.action.PICK_PLUGIN" />
<category android:name="androidsrc.intent.category.ADD_PLUGIN" />
</intent-filter>
</service>
<receiver android:name="com.my.app.service.BootCompletedReceiver"
android:enabled="true"
android:exported="true"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
</application>
build.gradle (app):
manifestPlaceholders = [onesignal_app_id : "xxxxx-xxxx-xxxx-xxx-xxxxxxxx",
onesignal_google_project_number: "REMOTE"]
We are facing an error of default activity is not found after update android studio to version "3.2". On another PC, which is running lower version 3.1.4 of android studio, this same application is working. If anyone has a solution then please suggest us.
I have attached manifest file of screen shot of android studio for that error.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.exmple.com">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="portrait" >
</activity>
<activity android:name=".Category_item"
android:screenOrientation="portrait"/>
<activity android:name=".ImageDatail"
android:screenOrientation="portrait"/>
<activity android:name=".SplashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW"/>
</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="your-own-uri" />
</intent-filter>
</activity>
<service android:name=".FireBase.MyFirebaseMessagingService"
android:exported="true"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".FireBase.MyFirebaseInstanceIDService"
android:exported="true"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".Util.ConnectivityReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.qualifiedapps.inspirationalquotes.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
</application>
</manifest>
When I install my application it's working fine, the icon is displayed and have no issues, however when installing the application on the device from the apk it does not show the application name, it shows the package with no icon, when uploading to playstore it gives me an error stating I should add an icon to the application.
This use to work until recently.
ic_launcher icon file does exist.
my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.package">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:name="android.support.multidex.MultiDexApplication">
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="com.my.package.MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name="com.my.package.LoginActivity"
android:label="#string/title_activity_login"
android:theme="#style/Theme.CustomTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.my.package.NotificationsActivity"
android:label="#string/title_activity_login"
android:theme="#style/AppThemeNoti"></activity>
<service android:name="com.my.package.FirebaseService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.my.package.FirebaseToken">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="keyhere" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
I found the problem:
<application
android:name="android.support.multidex.MultiDexApplication">
I removed the > after MultiDexApplication. Figured the android:icon was greyed out and hence not working.
Thanks.
I am developing an app and somehow after fixing up some things in the manifest file there is no app icon so I cannot launch the app from the app drawer anymore :/ I was looking at some other threads but they gave me no luck
Here is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.emiliogaines.fuelfinder" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<data android:scheme="db-XXX" />
<meta-data
android:largeHeap="true"
android:name="com.google.android.maps.v2.API_KEY"
android:value="XXX-XXX" />
<activity
android:name="com.dropbox.client2.android.AuthActivity"
android:launchMode="singleTask"
android:configChanges="orientation|keyboard">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
first make sure your folder 4 mipmap folders exists in folder res, and...
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You have this in your code:
android:icon="#mipmap/ic_launcher"
You have to check if this path is correct (If you have an Android Studio's project, you have to go to your project's folder, go to "app>src>main>res>mipmap" and check if there is a image file called "ic_launcher" -probably a PNG-).
Good look
app icon determine from here android:icon="#mipmap/ic_launcher"
make sure this path is not Empty and make sure you have ic_launcher in all other drawable folers
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
I am trying to upload a text file to my Dropbox, but it shows an error in manifest.
This is my Manifest file and the logcat error, what am I doing wrong can anyone help me please...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ondropbox"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.ondropbox.MainActivity"
android:launchMode="singleTask"
android:configChanges="orientation|keyboard" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="db-5qiq4z06ikagxfb" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
The Error is:
**java.lang.IllegalStateException: URI scheme in your app's manifest is not set up correctly. You should have a com.dropbox.client2.android.AuthActivity with the scheme: db-5qiq4z06ikagxfb**
What should I do?
Thanks for any kind of help.
because you are missing to add activity,,,
<activity
android:name="com.example.ondropbox.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.dropbox.client2.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="db-5qiq4z06ikagxfb" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
and you are done.
I had a very similar issue after migrating my app from Dropbox API v1 to v2. I used an official tutorial for migration - https://www.dropbox.com/developers/reference/migration-guide, but there are no word about Android, only basic examples in Java. So I opened this GitHub repo and used it as reference - https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android.
But in new API they changed a package of AuthActivity and I forgot to check, so had a Runtime crash - Unable to find com.dropbox.core.android.AuthActivity.
The solution is to change old package to new one - com.dropbox.client2.android.AuthActivity to com.dropbox.core.android.AuthActivity.