Android widget only showing up for debug; app icon always showing - android

My simple widget application installs and works perfectly when signed as a debug app, but as soon as I try to sign it ready for the market, I experience strange behaviour: it doesn't show up in the widget list until I uninstall the app when it appears as the standard Android 'I don't have this' robot icon.
Attempting to drag this 'missing' widget to a screen results in a Launcher crash.
To investigate this, I added a MAIN/LAUNCH intent to one of the Activities, and that shows up as expected on install and vanishes when I uninstall.
What's super-creepy is that if I re-install, while the Launcher is displaying the 'I don't have this' robot icon, my widget briefly replaces that icon, and then vanishes from the list.
I don't see any error messages or issued intents in the log, beyond the normal 'I'm un/installing this'.
Is there something stupid and obvious I'm missing, like a 'signed apps must register their widgets specially', that isn't necessary under debug mode?
Here're my manifest and widget properties:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
package="uk.org.baverstock.appghoul">
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="9"/>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<receiver android:name="uk.org.baverstock.appghoul.AppGhoulWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/appwidget_provider"/>
</receiver>
<activity android:name=".Configure"
android:excludeFromRecents="true"
>
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
<intent-filter>
<!-- Why does this show up, when the widget doesn't? -->
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".ControlsChoiceActivity"
android:theme="#android:style/Theme.Dialog"
android:excludeFromRecents="true"
/>
<activity android:name=".ReconfigureWidget"
android:theme="#android:style/Theme.Dialog"
android:excludeFromRecents="true"
/>
<receiver
android:name=".WidgetRescanner"
android:label="WidgetRescanner"
>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_CHANGED"/>
<action android:name="android.intent.action.PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<data android:scheme="package"/>
</intent-filter>
</receiver>
</application>
</manifest>
and the widget properties:
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="72dp"
android:minHeight="72dp"
android:updatePeriodMillis="86400000"
android:initialLayout="#layout/widget"
android:configure="uk.org.baverstock.appghoul.Configure"
android:previewImage="#drawable/icon"
android:widgetCategory="home_screen">
<!--
android:resizeMode="horizontal|vertical"
android:initialKeyguardLayout="#layout/example_keyguard"
-->
</appwidget-provider>

I thought it might relate to some problem with the release signing key being too long, but various experiments show this happens even with a 2048 key.
It also happens when I use Gradle to build http://javatechig.com/android/app-widgets-example-in-android/ so it doesn't seem to be my code.
I can't think anything I do should be able to crash the launcher after my app is uninstalled, so it seems to me this has to be an Android bug: I've reported it at https://code.google.com/p/android/issues/detail?id=61387

Related

Set Android phone for ShowRoom

We, my company, are facing a problem. We have a phone in public use where we can't be always near the phone. It's a show room where public user can test our Android app.
The problem is :
1) Can we block the phone in our app ? we just pin it but it doesn't block the phone. We found some apps the make something like that but not good results
2) A test user just add a security password to lock the phone. So now, we can't unlock the phone. We need to forbid user to add a lock password but we don't want to add one because if the phone is sleeping, a user should be able to unlock it.
**Edit : ** We can't block user from accessing settings
So, is there a solution for that ? like a "ShowRoom" mod ?
If you need more precisions, please ask.
Thanks
First you need to add the following attribute to your activity:
android:launchMode="singleTask"
Then add two categories to the intent filter :
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
The result could look something like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dummy.app"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.dummy.app.MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
</application>
</manifest>
please read this answer to block exiting app
https://stackoverflow.com/a/16333555/5223973
if you want to use any third party app to lock your app you can use any
android parental control apps

HOME activity will not show up or act as home activity

This is my first time asking a question on on here, but I have found the answer to innumerable questions I've had before on here. However, I just can't make this one work. I'm simply trying to write an app to replace the homescreen. Here is what I am trying, and I can't see what I'm missing.
To keep it as simple as possible, I reduced it to just this testing application. The only thing I changed after starting a new project was the manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hometesting"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<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>
<activity
android:name=".HomeActivity"
android:theme="#style/AppTheme"
android:launchMode="singleTop"
android:stateNotNeeded="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.categoty.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
I have tried it both in the emulator and my own phone, in the latter, it doesn't show up in the chooser. I can select it as the default home application in the user settings, but when i hit the home button, it just brings up the chooser without my app as an option. The pre-installed home screens and one other app that I downloaded show up as options, but my app doesn't. In the emulator, a click on the home button just brings up the default homescreen.
I have tried it with and without the separate launcher activity, and with and without the LAUNCHER intent. I have tried installing, uninstalling, restarting, and every permutation thereof.
All I want is for the home button to lead back to an activity that I wrote. Any help would be greatly appreciated.
Update: I also tried it on a generic cheap Chinese device, and still nothing.

Titanium Android activity not maintaining state

I am trying to set up a mobile website that opens my mobile app when a link is clicked in the Android browser. To accomplish this task, I added an intent filter to AndroidManifest.xml, as seen in the code below:
<activity android:name=".MyAppActivity" android:label="#string/app_name" android:theme="#style/Theme.Titanium" android:configChanges="keyboardHidden|orientation" android:alwaysRetainTaskState="true" android:launchMode="singleInstance">
<intent-filter>
<data android:scheme="myapp" android:host="app"/>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
The link itself in the browser works great, and I'm easily able to gather parameters when the app is first opened using Ti.Android.currentActivity. The problem comes when the app is already open, but a user clicks the link to open it from within the mobile browser. When my app opens, instead of resuming where I left off before, I simply see the splashscreen. This goes both ways: If I opened the app first from the mobile browser, then tried to resume it later from the Android homescreen or app drawer, I only see the splash screen. Per tips I saw on other places of the internet, I tried adding the code below to AndroidManifest.xml (as seen above):
android:alwaysRetainTaskState="true" android:launchMode="singleInstance"
This however, appears to have no effect on anything, and the same problem persists. What am I missing here? Any help would be greatly appreciated.
The way i have done was like this
<android xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>
<manifest android:installLocation="preferExternal"
android:versionCode="1" android:versionName="1.0">
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application android:label="App Name" android:largeHeap="true">
<activity
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:launchMode="singleTop"
android:name=".mainActivity" android:theme="#style/Theme.Titanium">
<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:scheme="schemaname"/>
</intent-filter>
</activity>
</application>
</manifest>
</android>
and its working fine for me . for Android 4.XX

Android: Widgets not showing in app drawer ICS

I have two widgets and neither of them will show up in the app drawer. What's weird is that if I remove one from the manifest it won't show up either but I can't see what I am doing wrong. From all the other questions I searched it looks right. The app is not being installed on the SD card.
Anyone have any ideas?
AndroidManifest.xml
<receiver
android:name=".appwidgets.WidgetLarge"
android:label="#string/Widget_large"
android:icon="#drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.groggs.action.CACHE_UPDATE_FINISHED" />
</intent-filter>
<intent-filter>
<action android:name="WIDGET_UPDATE" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_large_info" />
</receiver>
<receiver
android:name=".appwidgets.WidgetSmall"
android:label="#string/Widget_small"
android:icon="#drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.groggs.action.CACHE_UPDATE_FINISHED" />
</intent-filter>
<intent-filter>
<action android:name="WIDGET_UPDATE" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_small_info" />
</receiver>
widget_large_info.xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:maxWidth="450dp"
android:maxHeight="352dp"
android:updatePeriodMillis="0"
android:initialLayout="#layout/widget_layout_large"
android:configure="com.groggs.appwidgets.config.HubQuickViewWidgetConfig" >
</appwidget-provider>
widget_small_info.xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:maxWidth="450dp"
android:maxHeight="82dp"
android:updatePeriodMillis="0"
android:initialLayout="#layout/widget_layout_small"
android:configure="com.groggs.appwidgets.config.HubQuickViewWidgetConfig" >
</appwidget-provider>
Add "minHeight" and "minWidth" attributes to your appwidget-provider elements for each of your appwidgets and see if this does the trick for you.
If you check logcat when running it in the emulator, you should notice the launcher outputting a message about invalid dimensions and the name of your widget will be attached to this line.
I just had this issue and this is how I solved it (although I had one min and on max provided on accident). The logcat message said I had a dimension of (108, 0). This lead me into looking at all my dimensions since it was yelling at me for height being 0.
This was my post:
App Widget not displaying in ICS app drawer
If your app is only an appwidget, with no activities besides a configuration one, you need a dummy main activity to make your appwidget appear in the drawer.
See the original issue in Google Code: http://code.google.com/p/android/issues/detail?id=24208, this answer: Android 4.0: widgets not appearing? and also this interesting thread in Android Devs Google Group: https://groups.google.com/forum/?fromgroups#!topic/android-developers/bvlk3EOV6Xk (it's about Honeycomb, but applies to Android versions 3.x and greater)

Android app installs but doesn't show up in app tray

I'm building a time logging application and i have created the main layout.
I tried to debug my application on my phone Samsung Galaxy S and it starts fine, but if i close it and want to run it again it's not in my app drawer. It shows up in Settings->Programs->Manage and in Recent when holding down the home button.
Here is the manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.doweb.timelog" android:versionCode="1">
<application android:icon="#drawable/icon" 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">
<category android:name="android.intent.category.LAUNCHER">
</category></action></intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8">
</uses-sdk>
</manifest>
I think your closing </action> tag in the intent-filter is in the wrong position.
Should look like:
<intent-filter>
<action android:name="android.intent.action.MAIN" > </action>
<category android:name="android.intent.category.LAUNCHER"> </category>
</intent-filter>
That filter is a signal to the system that this activity should be visible in the app-drawer. When it's not correct or present, the activity won't be visible.
Usually it's best to use closed empty elements to prevent this error:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You're also missing a . in front of your activitys class. This always relates to your apps package name. It will internally be joined to packagename + classname. Therefore the dot, otherwise it would result in com.doweb.timelogMainActivity, which is obviously not the correct reference. So it should be android:name=".MainActivity".
your activity's name like this android:name=".MainActivity", you can have a try

Categories

Resources