I try to do this for my application to launch automatically when device is rebooted.But this is not working on android 11 devices.
<uses-permissionandroid:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver
android:name=".boot.StartUpBootReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
You can't launch an Activity from the background on Android 11. The Receiver is working fine most likely. It's the launching that is no longer allowed by the OS.
If you want to make a kiosk mode app, the correct way to do this is to make this app the launcher app so it takes over the home screen.
Related
I use the automatic launch of my application when I turn on my ACER tablet Iconia one (6.0), but the android home page appears before for a few seconds.
Is it possible to run the application without showing android homepage ?
Regards,
François
Is it possible to run the application without showing android homepage ?
Make your app be the "android homepage", by implementing a MAIN/HOME <intent-filter>:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
</intent-filter>
Am working with two apps, In A App on clicking button, i hit the playstore link of B App and send data in playstore url and when app is installed, i get parameters from "referrel"
I used InstallReferrelReciever in manifest of B app as like:
<receiver android:name=".data.AppInstallReceiver"
android:permission="android.permission.INSTALL_PACKAGES"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
so here i get issue on some devices like Redmi and Oppo InstallReferrelReceiver is not called sometime but that works fine on Samsung devices.
I want to listen to APN Changes in my Android App.
Therefore I start a Service on android.intent.action.BOOT_COMPLETED.
This Service starts a ContentObserver which listens to changes to
content://telephony/carriers/preferapn.
I tested this setup on a few different devices (e.g. LG Spirit with Android 5.0, Samsung A3 with 6.0, Emulator Nexus5 with 7.0 and Huawei P9 Lite with 7.0)
On the Huawei phone onCreate of my Service is not called.
My other approach with android.intent.action.ANY_DATA_STATE in combination with a BroadcastReceiver which is registerd in the Manifest doesn't work either on this phone.
relevant parts of my manifest:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
...
<receiver android:name=".ConnectivityChangeReceiver">
<intent-filter>
<action android:name="android.intent.action.ANY_DATA_STATE" />
</intent-filter>
</receiver>
<receiver android:name=".APNChangedServiceStarter" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>
<service android:name=".APNChangedService"></service>
Just for an update, Huawei changed the menu path in the Android 9 version.
On Huawei Mate 10 pro the way to get to this menu:
Settings -> Battery -> App launch -> Disable automatic management for your app.
A pop-up will appear, asking what you want to allow (all true by default). make sure that the first, Auto-launch is enabled
Huawei Phones have a built-in startup manager, it could be that the app is not yet enabled.
Go to Settings > All, and choose Startup manager.
This program is used to manage startup apps on Android phone.
Allow or disallow app to run automatically after the Huawei phone starts up.
I've got an app with the following in the manifest
<receiver android:name="com.redacted.BroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"></action>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<activity android:name="com.redacted.activity.UserLaunch" android:label="#string/app_name" android:launchMode="standard" android:clearTaskOnLaunch="true" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If I install and run the app via Android Studio, then reboot the phone then the BroadcastReceiver's onReceive() gets called as a consequence of connectivity changes settling down after boot up.
However if I build an .apk and then install that, then on device reboot the onReceive() is not getting called. (There is a Log.d() statement in the onReceive which I'm looking for in logcat after bootup, it appears with the first installation method but not with the second).
Why is there this difference?
Apps are installed in a so-called "stopped state". It takes an explicit Intent starting up one of the app's components to move out of the stopped state. Usually, that's running the launcher activity. While in the stopped state, no registered broadcast receivers will work.
So, when you run from Android Studio, the launcher activity moves your app out of the stopped state, and all is good. Installation by some other means would require you to run the launcher activity yourself to move out of the stopped state.
I am trying to run the Timer sample google glass app, but when I run the project, it gets installed and then says DONE, however, I don't see anything on the emulator. I know there is no Launcher and so I tried the RUN CONFIGURATION but I don't see any activity in the dropdown when I chose the Launch option. Any thoughts or guides on to do this ?
First of all there is no avd/emulator available for Glass.But if still you are interested converting your mobile phone into glass.Check these link i.e 1,2,3.But no one works completely treating your phone as Glass.
As you have mentioned above that you try to install an app on emulator.The main reason why it is not showing up is that:
Move to AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
This is the normal code for the main launcher activity of android.This is the main activity which is launched in the emulator/avd
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
While in Glass code you find something like this.There is no launcher in Glass but still you can add.Here you only found out the voice trigger which open your app
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voicetrigger" />
</activity>