set application default android - java

I have an android media player application and I want to set that default after installation . How can i do it? I am posting its manifest below .
Any code will be appreciated .
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mP.myplayer"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="mP.myplayer.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.MUSIC_PLAYER"/>
<category android:name="android.intent.category.APP_MUSIC"/>
<data android:mimeType="audio/*"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
</manifest>

You can't.
Third party developers cannot set their own app as default applications. Only the users of your app can do this on their own devices.
You can however, register to receive intents of the types your app supports so that users can select your app as their default. For example, to register your app as a music player, see here.

This is impossible. this can not be done using code . if one application need to set as default it must do by the user.not thrid party

Related

Android App ist running on Device in USB-Debug-Mode but not after APK-Install

I am very new In Android Development and developed a "Time Stamp Clock - App" which reads NFC-Tags.
Everything fine, it is running on Device via USB-Debug-Mode without Errors as expected. When I build APK and install on the same Device, the installing is without errors, but after that, the open-button is grayed out and inactive and there is no desktop-icon to launch. In the APPS Overview it is displayed, but not able to open.
Can someone tell me, what can i do, to figure it out, what is going wrong there?
EDIT:
Manifest:
<?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.example.comidoszeiterfassung">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="30"></uses-sdk>
<application
android:name=".myGLOBAL"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.ComidosZeiterfassung"
tools:ignore="Instantiatable">
<activity
android:name=".ui.login.MainActivity"
android:label="#string/title_activity_main"
android:theme="#style/Theme.ComidosZeiterfassung.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".ui.login.LoginActivity"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
It is a simple structure in the app. LoginActivity as Start-Activity and a TabbedActivity for the NFC-Stuff.

Google play supported devices 0 with pdfbox-android

Have a problem with an already-published application on Google Play.
The application is in the store, but no one can download, because of an error Supported devices 0.
I did refactor the project, removed all unnecessary with the manifest. Compiled a new apk, and again "Supported devices 0".
I use pdfbox-android-1.8.8.jar.
If I remove the pdfbox from project, then are "Supported devices 7700".
I build project with Eclipse.
What does this mean?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.firm.project"
android:versionCode="3"
android:versionName="1.01" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="21"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:name=".App"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".StartActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".OneActivity" android:screenOrientation="portrait">
</activity>
</application>
</manifest>

Android Application isn't installed after deployment

I've developed an application using Eclipse and when I run it on my Droid Ultra the application runs when running through Eclipse. To my understanding when that happens the application should be installed on the device. However, when I unplug the device and try to run the app by going through my phone applications it displays a toast message saying "App isn't installed". Does anyone know why this is happening? Is this a code problem, an environment issue, anything?
Here is my manifest if it helps?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.ggc.thinkfast"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="20" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" android:permission="android.permission.BLUETOOTH">
<activity
android:name=".MainScreen"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".FactScreen"
android:screenOrientation="portrait"
android:noHistory="true"></activity>
<activity android:name=".CategoryScreen"
android:screenOrientation="portrait"></activity>
<activity android:name=".TimerScreen"
android:screenOrientation="portrait"
android:noHistory="true"></activity>
<activity android:name=".QuestionScreen"
android:screenOrientation="portrait"
android:noHistory="true"></activity>
<activity android:name=".NextQuestionScreen"
android:theme="#android:style/Theme.Dialog"
android:screenOrientation="portrait"
android:noHistory="true"></activity>
</application>
Do you already have the app installed previously on the device?If so please uninstall the existing app and try again with eclipse.The problem may be due to incorrectly signed certificates.

Launcher activity not starting first

The title explains it pretty much, here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.craym.vulcrum.firstgametnb"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Splash"
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=".StartingPoint"
android:label="#string/app_name" >
<intent-filter>
<action android:name="eu.craym.vulcrum.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
Yet whenever I run this application, the StartingPoint classed is called first:
[2013-03-09 18:36:40 - FirstGameTNB] Starting activity eu.craym.vulcrum.firstgametnb.StartingPoint on device emulator-5554
Why is this happening? I thought the MAIN and LAUNCHER were supposed to make it so the Splash class gets called first, but this never happens. Note that when I delete the StartingPoint activity, it goes to Splash.
You're right. You may try a clean on your project.
android.intent.action.MAIN: Start as a main entry point, does not
expect to receive data.
Source

How to fix INSTALL_PARSE_FAILED_MANIFEST_MALFORMED in my android application

Hi I am trying to experiment with gcm but unable to make it work. Don't know where I am messing with it, below is the error I am getting. I am trying to deploy my application directly on device and debug from there but when ever I try to deploy it gives this error
Waiting for device.
Target device: HT24LW108632
Uploading file
local path: D:\Data\Android\AndroidTest\out\production\AndroidTest\AndroidTest.apk
remote path: /data/local/tmp/Android.Test
Installing Android.Test
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/Android.Test"
pkg: /data/local/tmp/Android.Test
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Android.Test"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="14"/>
<permission
android:name="Android.Test.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="Android.Test.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<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>
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="Android.Test" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>
My Device is HTC OneX
Android Version: 4.03
HTC Sense Version: 4.0
Software number: 1.29.110.11
HTC SDK API Level: 4.12
HTC Extension version: HTCExtension_403_1_GA_7
Please guide as I am new fish in Android Sea.
Edit-1:
I have noticed that if I comment this below line then application does deploy and execute but obviously I cant go forward without below mentioned permission ... please help....
<permission android:name="Android.Test.permission.C2D_MESSAGE" android:protectionLevel="signature" />
Change name package with Caps letters to little letters.
Change your
android:name="MainActivity"
TO
android:name=".MainActivity"
OR add the fully qualified package name in lowercase before your class name
android:name="thepackage.MainActivity"
Do change all the attributes named as android:name inside the activity tags as I suggested.
Instead of:
<permission android:name="android.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
to:
<uses-permission android:name="android.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
Try that.
<activity android:name="MainActivity"
should be formed like
<activity android:name="com.company.appname"
to do this without errors go to package (right click) > android tools > rename app package
try to write activity name follow by "."
Instead of
<activity android:name="MainActivity"
android:label="#string/app_name">
use
<activity android:name=".MainActivity"
android:label="#string/app_name">
I met this same issue in android studio
what solve this is to let company domain to be all small letters,
There's issue about this: http://code.google.com/p/android/issues/detail?id=37658
Capital letters can't be used in package names within permissions. You got (same as me) into difficult situation when you have deployed application with package name like this and you need to use GCM.
I tried to use some kind of short form of permission:
<permission android:name=".permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name=".permission.C2D_MESSAGE" />
I also defined service in the same way. It had to be in application package.
It worked on Android 4.3. Probably on 4.2 also. I know that on 4.0.3 it didn't.
make sure your package name is in small letters...
worked for me
write the java package name and all folders name in lowercase, it will work fine...
In my case I was mentioned the package name in small letters only. But for few of the activities I named it with partial name i.e android:name=".ContactUs" . After I solved it by prefixing full package name before all the activity name, service name and broadcast provider name in Manifest file.
Working code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="vcan.doit.com">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.DesignDemo">
<activity
android:name="vcan.doit.com.LoginActivity"
android:label="#string/app_name">
<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>
<activity
android:name="vcan.doit.com.MainActivity"
android:theme="#style/Theme.DesignDemo" />
<activity
android:name="vcan.doit.com.CheeseDetailActivity"
android:parentActivityName="vcan.doit.com.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="vcan.doit.com.MainActivity" />
</activity>
<service android:name="vcan.doit.com.PushNotification.MyAndroidFirebaseMsgService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="vcan.doit.com.PushNotification.MyAndroidFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<activity
android:name="vcan.doit.com.AboutUs"
android:label="#string/abt_us"
android:parentActivityName="vcan.doit.com.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="vcan.doit.com.MainActivity" />
</activity>
<activity
android:name="vcan.doit.com.ContactUs"
android:label="#string/contact_us"
android:parentActivityName="vcan.doit.com.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="vcan.doit.com.MainActivity" />
</activity>
<activity android:name="vcan.doit.com.WriteToUs"
android:label="#string/write_us"
android:parentActivityName="vcan.doit.com.MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="vcan.doit.com.MainActivity" />
</activity>
</application>
I had this problem. My device memory was full. I solved my problem with freeing device memory.
For Android 12 (Android ", API Level 31) you can find this same error because of behavioural changes.
To get rid of it you must add android:exported="true" (or false*) to any <activity>, <activity-alias>,<service>, or <receiver> components that have <intent-filter>s declared in the app’s AndroidManifest.xml file.
* More info: Related official documentation

Categories