I am trying to develop a setup wizard for Android, as I would like to add some functionality to the one existing from Google. Is it possible to somehow interact with the Android wizard? Because when I have searched for information I've seen that not using Google's Wizard might cause some trouble, regarding gmail account activation and so on.
If not, could an activity be called immediately before or after Google's wizard? Would it be enough to just listen to the BOOT_COMPLETED event?
Thank you very much in advance!
I don't know how you will use this unless you are making a rom and can add your app to system but basically you make your setupwizard add-on a Home activity with action MAIN, and categories HOME,DEFAULT. You should also set the priority higher than 1. If any of this is unclear you can look at the Launcher source/manifest that is publicly available.
When your activity is done it should deactivate itself with the PackageManager (setComponentEnabledSetting) and that should be it.
You can add additional activities that start the first time the phone is boot up. You just have to mimic the same behavior as Google's SetupWizardActivity.
Here's the relevant portion in the AndroidManifest.xml for reference:
<activity android:theme="#style/InvisibleNoTitle" android:label="#string/setup_wizard_title" android:name="SetupWizardActivity" android:excludeFromRecents="true" android:launchMode="singleTop" android:immersive="true">
<intent-filter android:priority="5">
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.DEVICE_INITIALIZATION_WIZARD" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
This will allow you to run your application before/after SetupWizardActivity, depending on your priority. I believe higher numbers for android:prioirity run first, but don't quote me on that.
You can find out the AndroidManifest xml for various Android-related apks using apktool. You can even inspect some of apks you picked up from the Play Store or whatever other sources.
Related
I have an application for smartphones. In my AndroidManifest.xml file placed activity with special intent-filter
<activity
android:name=".feature.splashscreen.SplashScreenVm"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Now, I need to launch my application on wearable devices. Obviously, default activity for wearable device should be WearableActivity.class. How to configure my AndroidManifest.xml to launch different activities depending on device's type? Or maybe it should be handled not by manifest?
As far as i know, for wearable devices(e.g watches), you need to have a different apk.
It currently is not possible to create a single APK that works on a phone and watch.
for more info you can check :
https://developer.android.com/training/wearables/apps/packaging.html
EDIT:
I also found a tutorial about how to do what you plan;
https://medium.com/#manuelvicnt/android-wear-add-a-wear-app-to-your-already-existing-android-app-2a668442dd0a
It is true the apks are different. I would advise if you to build a second app for wearables with limited functionality or only the important functions that are in your smartphone app. Take note wearable devices have limited screen real estate so you might want to just use it for something such as just notifications.
I need to launch "my hypothetical application" in order to show certain events which have been tracked on the application which has installed my "hypothetical library". But I can’t figure out how to achieve it, and the only library which perform this kind of behaviour -as far as I know, is LeakCanary.
Any thoughts will be appreciate.
I don't think LeakCanary installs separate apk which will work as exported service and allow applications to be bound to. I went through the flow how it works, when you call LeakCanary.install(context) it starts HeapAnalyzerService which is a Service which depends on application lifecycle callbacks.
What you see as separate application is the DisplayLeakActivity which has it's intent declared as:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
Any activity with MAIN action and category LAUNCHER will be placed in the launcher.
I created a basic Android app from the Eclipse wizard. I then added the following intent filter to AndroidManifest.xml, after the existing one. This makes it support a custom "sample://" URL scheme:
<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="sample" />
</intent-filter>
If I run Chrome or the default browser, and click a "sample://" link, it launches my app. However, if I look at the task switcher, my app isn't listed. Instead, Chrome is shown, with my app's screen shot.
Why is this? Can it be fixed? I'm running Android 4.2.2 on a Galaxy Nexus phone.
I notice that if I add android:launchMode="singleInstance" to the activity, it opens in a separate app. But the docs say this is "not recommended for general use". Why not?
The reason why you Activity appears in Recent Apps as Chrome is because it now belongs to the Chrome task, because it was launched from there.
As you noticed android:launchMode="singleInstance" solves your problem, however it is not recommended or discouraged because it would brake the user experience and navigation and how users expect your application to behave.
Fortunately, I think there's a way of specifying Intent flags in your HREF, try something like this:
<A HREF="intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.example.package/.MyActivity;end" />
in the previous example launchFlags=FLAG_ACTIVITY_NEW_TASK. This flag is generally used by activities that want to present a "launcher" style behavior: they give the user a list of separate things that can be done, which otherwise run completely independently of the activity launching them.
I am making changes to an app which necessitate changing the default launch activity away from the old default to a new one which is becoming a landing page for my app. Basically I'm just updating the manifest.xml to add the new activity and move the intent filter over from the old one:
<activity
android:label="#string/app_name"
android:name=".NewActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".OldActivity" >
<!-- Launcher used to be here -->
</activity>
Does anyone know if this can cause problems for users who are upgrading from an older version of the app? For example if they have a shortcut to the app, does it still work. Additionally do any of the standard app stores such as Google Marketplace (Play Store) / Amazon etc. have any requirements which mean I can't do this?
I suppose the workaround if the activity must remain the same is I can hack the classes so the old activity points to the new class but if I'm worrying over nothing then I prefer to do it cleanly.
Well basically when you build your application, all the xml that were changed are compiled into binary and are deployed on the device. So if you change the AndroidManifest.xml, when you build and deploy to device (in the development state), the application from devices is updated, and the new manifest is used.
So if you change your application's manifest.xml and build an update for the market, it should work the same, I mean by updating the user application and changing the default activity, because the new manifest binary will be loaded.
Good luck,
Arkde
When I launch my android application from eclipse, it shows the home screen, and I then need to unlock the screen and go to my app. I would like it to just show my app by default.
I have tried right clicking on the app and selecting Run As..., but Android Application is not a choice there. I need to manually create a new Android run configuration for my application and then I launch that.
Is there a way to just make my app show by default? I'm running with the emulator for Android version 2.2?
Note: I'm also getting an error that says "Emulator] Unknown savevm section type 95" which I'm not sure what that means yet
thanks,
Jeff
The emulator always starts with the screen locked. Unlock it and wait a moment, sometimes it needs a minute to launch your app. If it doesn't work after a few moments, leave the emulator open and try running it again. If it doesn't launch now, there's something wrong.
I'm thinking you either didn't create your project as an android project to begin with, or if you did you didn't create a starting activity (or deleted the one that you did create)? Either way, you probably need to go edit your AndroidManifest.xml file and add an intent filter to an activity. Just guessing. Should look similar to this:
<activity
android:name={String for the name of your app}
android:label={String for the name displayed on the icon}>
<intent-filter>
<action
android:name="android.intent.action.MAIN"/>
<category
android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
** posted before your edit ^^^
In terms of your error, I have no clue what that is, so maybe it has nothing to do with your AndroidManifest, then. :T
Check your manifest, and make sure your activity has the correct intent-filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
BTW, Previous to Android 1.6 i think the emulator always started with the screen locked then they changed that and it starts with your app